LightController.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Http\Controllers\api\thirdPart\haiq;
  3. use App\Services\ForeignHaiRoboticsService;
  4. use App\Services\StationCacheShelfGridService;
  5. use Illuminate\Http\Request;
  6. use Illuminate\Support\Facades\Http;
  7. class LightController
  8. {
  9. protected $request;
  10. /** @var ForeignHaiRoboticsService $service */
  11. private $service;
  12. public function __construct(){
  13. $this->service=app('ForeignHaiRoboticsService');
  14. }
  15. public function lightOn($post){
  16. $response = Http::post(config('api.haiq.storage.light'),$post);
  17. return $response->body();
  18. }
  19. public function lightOff(Request $request){
  20. }
  21. /**
  22. * @param Request $request {"areaCode":"1004","locCode":"HAIB2-02-03","displayInfo":null,"PTLAction":0,"PTLSettings":null}
  23. * @param StationCacheShelfGridService $gridService
  24. * @return array
  25. */
  26. public function update(Request $request,StationCacheShelfGridService $gridService){// 拍灯以后的消息发至此处
  27. $gridService->lightOff($request['locCode'],$request['PTLAction']);
  28. $success = $request->input('success');
  29. $location = $success?200:0;
  30. app('LogService')->log(__METHOD__,__FUNCTION__,json_encode($request->all()));
  31. return ['location'=>$location,'errMsg'=>'','data'=>$request->all()];
  32. }
  33. }