| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace App\Console\Commands;
- use App\RejectedBill;
- use Carbon\Carbon;
- use Illuminate\Console\Command;
- use Illuminate\Support\Facades\Log;
- class ReceiveRecord extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'record:scan';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = 'scan rejected record status';
- /**
- * Create a new command instance.
- *
- * @return void
- */
- public function __construct()
- {
- parent::__construct();
- }
- private static $delayedHour = 48;
- /**
- * Execute the console command.
- *
- */
- public function handle()
- {
- $delayedDateTime = Carbon::now()->subHours(self::$delayedHour)->toDateTimeString();
- Log::info("退件记录",["signTime"=>$delayedDateTime,"result"=>\App\ReceiveRecord::query()->where("record_at","<=",$delayedDateTime)
- ->where("delayed",0)->select("logistic_number")->pluck("logistic_number")->toArray()]);
- \App\ReceiveRecord::query()->where("record_at","<=",$delayedDateTime)
- ->where("delayed",0)
- ->update(["delayed"=>2]);
- \App\ReceiveRecord::query()
- ->where("record_at",">",$delayedDateTime)
- ->where("delayed",0)
- ->whereIn("logistic_number",RejectedBill::query()->select("logistic_number_return")
- ->where("created_at",">",$delayedDateTime)->whereIn("logistic_number_return",
- \App\ReceiveRecord::query()->select("logistic_number")
- ->where("record_at",">",$delayedDateTime)
- ->where("delayed",0)))->update(["delayed"=>1]);
- }
- }
|