where('status',0)->where('createtime','lt',$lasttime)->update([ 'status' => 3, 'cancel_time' => $nowtime, 'cancel_reason' => '超时未支付', 'finish_time' => $nowtime, ]); } //待接诊订单,医生不操作,支付N分钟后,自动退珍 public function auto_tuizhen_noaccept_order(){ $nowtime = time(); $second = config('site.payorder_noaccept_autotuizhen_minute') * 60; $lasttime = $nowtime - $second; //dump(datetime($lasttime));exit; Db::name('wenzhen_order')->where('status',10)->where('pay_time','lt',$lasttime)->update([ 'status' => 16, 'cancel_time' => $nowtime, 'cancel_reason' => '超时未接诊', 'finish_time' => $nowtime, //待退款 'refund_status' => 1, ]); //不仅改状态,还要自动退款,放到队列处理 } //视频订单,已拨打,通话N分钟后,自动结束 public function auto_finish_firstvideo_videoorder(){ $nowtime = time(); $second = config('site.firstvideo_videoorder_autofinish_minute') * 60; $lasttime = $nowtime - $second; Db::name('wenzhen_order')->where('status',25)->where('ordertype',2)->where('video_time','lt',$lasttime)->update([ 'status' => 30, 'finish_time' => $nowtime, ]); } //图文订单,已接诊,接诊N分钟后,自动结束 public function auto_finish_accept_textorder(){ $nowtime = time(); $second = config('site.accept_textorder_autofinish_minute') * 60; $lasttime = $nowtime - $second; Db::name('wenzhen_order')->where('status',20)->where('ordertype',1)->where('accept_time','lt',$lasttime)->update([ 'status' => 30, 'finish_time' => $nowtime, ]); } ///////////////////////////////////////////////////////////////////////// //定时跑用户活跃,改成离线 public function auto_user_active(){ $actitime = time() - 7200; $sql = 'update `mt_user` set is_active = 0 where is_active = 1 and id in (select user_id from mt_user_active where requesttime < '.$actitime.')'; db()->query($sql); } //vip过期的,三个隐私设置改成0 //vip过期的,更新用户表is_vip public function auto_vipend(){ // $sql = 'update `mt_user_power` set yinsi = 0,yinshen = 0,wuhen = 0 where user_id in (select user_id from mt_user_wallet where vip_endtime > 0 and vip_endtime < '.time().')'; // db()->query($sql); /*$sql2 = 'update `mt_user` set is_vip = 0 where is_vip = 1 and user_id in (select user_id from mt_user_wallet where vip_endtime > 0 and vip_endtime < '.time().')'; db()->query($sql2);*/ } }