|
@@ -159,17 +159,73 @@ class AppiontController extends Controller
|
|
public function orverTime()
|
|
public function orverTime()
|
|
{
|
|
{
|
|
$st = strtotime('2021-02-25 18:00:00');
|
|
$st = strtotime('2021-02-25 18:00:00');
|
|
- $orders = Order::select('id')
|
|
|
|
- ->where(['product_type'=>4,'order_status'=>7])
|
|
|
|
- ->where('appoint_end_time','<',$st)->get();
|
|
|
|
-// DB::enableQueryLog();
|
|
|
|
-// $orders = Order::leftjoin('order_patients','order_patients.order_id','=','orders.id')->where(['orders.product_type'=>4,'orders.order_status'=>7])->where('order_patients.appoint_end_time','<',$st)->get(['orders.id']);
|
|
|
|
-// dd(DB::getQueryLog());
|
|
|
|
- if(request('c') && !empty($orders)) return count($orders->toArray());
|
|
|
|
- if(request('b') && !empty($orders)) dd($orders->toArray());
|
|
|
|
- foreach ($orders as $order){
|
|
|
|
- Order::where('id',$order->id)->update(['order_status'=>6]);
|
|
|
|
|
|
+ $type = intval(request('type'));
|
|
|
|
+ if($type == 2){
|
|
|
|
+ $orders = Order::where(['product_type'=>2,'order_status'=>6])->where('appoint_end_time','<',$st)->get();
|
|
|
|
+ foreach ($orders as $order){
|
|
|
|
+ if(strpos($order->order_notes,'取') || in_array(intval($order->payment_status),[3,4,5])){
|
|
|
|
+ Order::where('id',intval($order->id))->update(['order_status'=>5]);
|
|
|
|
+ echo 'id:---'.$order->id.PHP_EOL;
|
|
|
|
+ }
|
|
|
|
+ if(intval($order->payment_status) == 0 || intval($order->payment_status) == 1){
|
|
|
|
+// echo 'id:---'.$order->id.PHP_EOL;
|
|
|
|
+ Order::where('id',intval($order->id))->update(['order_status'=>1]);
|
|
|
|
+ }
|
|
|
|
+ if(intval($order->payment_status) == 4){
|
|
|
|
+// echo 'id:---'.$order->id.PHP_EOL;
|
|
|
|
+ Order::where('id',intval($order->id))->update(['order_status'=>5]);
|
|
|
|
+ }
|
|
|
|
+ if(intval($order->payment_status) == 2 && intval($order->receiving_time) > 0 && $order->end_time == 0 ){
|
|
|
|
+ Order::where('id',intval($order->id))->update(['order_status'=>3]);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(intval($order->payment_status) == 2 && $order->end_time > 0 ){
|
|
|
|
+ Order::where('id',intval($order->id))->update(['order_status'=>4]);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(intval($order->payment_status) == 2 && intval($order->receiving_time) == 0 ){
|
|
|
|
+ Order::where('id',intval($order->id))->update(['order_status'=>2]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else if($type == 1) {
|
|
|
|
+ $orders = Order::where(['product_type'=>1,'order_status'=>6])->where('appoint_end_time','<',$st)->get();
|
|
|
|
+
|
|
|
|
+ foreach ($orders as $order){
|
|
|
|
+ if(strpos($order->order_notes,'取') || in_array(intval($order->payment_status),[3,4,5])){
|
|
|
|
+ Order::where('id',intval($order->id))->update(['order_status'=>5]);
|
|
|
|
+ echo 'id:---'.$order->id.PHP_EOL;
|
|
|
|
+ }
|
|
|
|
+ if(intval($order->payment_status) == 0 || intval($order->payment_status) == 1){
|
|
|
|
+// echo 'id:---'.$order->id.PHP_EOL;
|
|
|
|
+ Order::where('id',intval($order->id))->update(['order_status'=>1]);
|
|
|
|
+ }
|
|
|
|
+ if(intval($order->payment_status) == 4){
|
|
|
|
+// echo 'id:---'.$order->id.PHP_EOL;
|
|
|
|
+ Order::where('id',intval($order->id))->update(['order_status'=>5]);
|
|
|
|
+ }
|
|
|
|
+ if(intval($order->payment_status) == 2 && intval($order->receiving_time) > 0 && $order->end_time == 0 ){
|
|
|
|
+ Order::where('id',intval($order->id))->update(['order_status'=>3]);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(intval($order->payment_status) == 2 && $order->end_time > 0 ){
|
|
|
|
+ Order::where('id',intval($order->id))->update(['order_status'=>4]);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(intval($order->payment_status) == 2 && intval($order->receiving_time) == 0 ){
|
|
|
|
+ Order::where('id',intval($order->id))->update(['order_status'=>2]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+//// DB::enableQueryLog();
|
|
|
|
+// $orders = Order::leftjoin('order_patients','order_patients.order_id','=','orders.id')->where(['orders.product_type'=>4,'orders.order_status'=>7])->where('order_patients.appoint_end_time','<',$st)->get(['orders.id']);
|
|
|
|
+//// dd(DB::getQueryLog());
|
|
|
|
+// if(request('c') && !empty($orders)) return count($orders->toArray());
|
|
|
|
+// if(request('b') && !empty($orders)) dd($orders->toArray());
|
|
|
|
+// foreach ($orders as $order){
|
|
|
|
+// Order::where('id',$order->id)->update(['order_status'=>6]);
|
|
|
|
+// }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|