12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- namespace App\Jobs;
- use App\Models\Bike;
- use Carbon\Carbon;
- use Illuminate\Support\Facades\Log;
- class BikeTemporaryWaitOverThirtyAutoCloseOrderJob extends Job
- {
- protected $mobile = '';
- protected $bike_no = '';
- protected $start_use_time = '';
- protected $redisKey = '';
- public $tries = 1;
- private $url = '';
-
- public function __construct($mobile, $bike_no, $start_use_time, $redisKey, Carbon $delay)
- {
- $this->mobile = $mobile;
- $this->bike_no = $bike_no;
- $this->start_use_time = $start_use_time;
- $this->redisKey = $redisKey;
-
- $this->delay($delay);
- $this->url = config("app.url") . "/api/relay/order/auto-close?key=" . config('auth.api_token');
- }
-
- public function handle()
- {
- $res = app()->redis->get($this->redisKey);
- if ($res) {
-
- $time = Carbon::parse($res);
- $int = (new Carbon)->diffInMinutes($time, true);
- if ($int >= 0) {
- $bike_no = $this->bike_no;
- $box_no = Bike::where('bike_no', $bike_no)->value('box_no');
-
- $status = json_decode(file_get_contents($this->url . "&box_no={$box_no}&bike_no={$bike_no}&type=临时停车超时"), true);
- return;
- }
- }
- }
- }
|