123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <?php
- namespace App\Console;
- use App\Console\Commands\AutoPayment;
- use App\Console\Commands\EveryDayInfo;
- use App\Models\Goodtest;
- use App\Models\Ordertest;
- //<<<<<<< HEAD
- //use Carbon\Carbon;
- //use Illuminate\Console\Scheduling\Schedule;
- //use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
- //=======
- use App\Models\User;
- use App\Models\UserCert;
- use Carbon\Carbon;
- use Illuminate\Console\Scheduling\Schedule;
- use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
- use Illuminate\Support\Facades\DB;
- //>>>>>>> 9aa477479386789a8615d89285e74706ec72fbab
- use Illuminate\Support\Facades\Log;
- class Kernel extends ConsoleKernel
- {
- /**
- * The Artisan commands provided by your application.
- *
- * @var array
- */
- protected $commands = [
- AutoPayment::class,
- EveryDayInfo::class,
- ];
- /**
- * Define the application's command schedule.
- *
- * @param \Illuminate\Console\Scheduling\Schedule $schedule
- * @return void
- */
- protected function schedule(Schedule $schedule)
- {
- // $schedule->command('inspire')
- // ->hourly();
- $schedule->call(function (){
- $now=Carbon::now()->timestamp;
- $data=Goodtest::whereNotNull('show_time')->where('is_deleted',0)->get();
- foreach ($data as $k=>$v){
- $good=Goodtest::find($v->id);
- if (strtotime($v->show_time)<$now&&strtotime($v->off_time)>$now){
- $good->is_show=3;
- //<<<<<<< HEAD
- // }elseif (strtotime($v->show_time)<$now){
- // $good->is_show=1;
- // }elseif (strtotime($v->off_time)<$now){
- // $good->is_show=4;
- //=======
- }elseif (strtotime($v->show_time)>$now&&strtotime($v->off_time)>$now+3){
- $good->is_show=1;
- }elseif (strtotime($v->off_time)<$now+3){
- $good->is_show=4;
- $good->show_time=null;
- //>>>>>>> 9aa477479386789a8615d89285e74706ec72fbab
- }
- $good->save();
- }
- Log::error('111');
- Log::error('111');
- })->everyMinute();
- $schedule->call(function (){
- $data=Ordertest::where('status',3)->where('pay_status',2)->whereNotNull('receive_time')->get();
- foreach ($data as $k=>$v){
- $now=Carbon::now()->timestamp;
- if (strtotime($v->receice)>$now){
- $order=Ordertest::find($v->id);
- $order->status=4;
- $order->save();
- Log::error('订单编号为'.$v->order_num.'的商品已经自动收货');
- }
- }
- })->everyMinute();
- //自动支付
- $schedule->command('autoPayment')->everyMinute();
- $schedule->call(function (){
- $re=User::where('cert_status',2)->whereNull('deleted_at')->select('id','mobile')->get();
- $s=0;
- foreach ($re as $k=>$v){
- $res=UserCert::where('user_id',$v->id)->get();
- foreach ($res as $ke=>$va){
- if ($va->recom_audit==1&& $va->agent_audit==1){
- Log::error($v->mobile);
- }
- }
- }
- Log::error('这是相关数据'.$s);
- })->dailyAt('15:32');
- }
- /**
- * Register the commands for the application.
- *
- * @return void
- */
- protected function commands()
- {
- $this->load(__DIR__.'/Commands');
- require base_path('routes/console.php');
- }
- }
|