|
@@ -8,19 +8,62 @@ use think\Cache;
|
|
|
|
|
|
class Plantask extends Controller
|
|
|
{
|
|
|
- //未支付订单N分钟后自动取消
|
|
|
+ //未支付订单,下单N分钟后,自动取消
|
|
|
public function auto_cancel_nopay_order(){
|
|
|
+ $nowtime = time();
|
|
|
+ $second = config('site.nopay_order_autocancel_minute') * 60;
|
|
|
+ $lasttime = $nowtime - $second;
|
|
|
+
|
|
|
+ //dump(datetime($lasttime));exit;
|
|
|
+ Db::name('wenzhen_order')->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,
|
|
|
+ ]);
|
|
|
+
|
|
|
+ //不仅改状态,还要自动退款,放到队列处理
|
|
|
}
|
|
|
|
|
|
- //自动取消未接诊订单
|
|
|
- public function auto_cancel_noaccept_order(){
|
|
|
+ //视频订单,已拨打,通话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_videoorder(){
|
|
|
+ //图文订单,已接诊,接诊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,
|
|
|
+ ]);
|
|
|
}
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|