'微信支付', 2 => '余额支付', 3 => '服务包支付']; //支付方式 $payType = array_search($row[16], $pay_types) + 1; if ($payType == 1) $payType = 2; $order = Order::where('order_sn',$row[0])->first(); if(!empty($order)){ $orderInfo = [ 'order_sn' => $row[0], 'order_status' => $order_status, 'order_notes' => '', 'payment_status'=>$pay_status, ]; $old_order_status = intval($order->order_status); $old_notice = intval($order->order_notes); if($old_order_status == 5 && ($old_notice == '医生超时未接单自动取消' || $old_notice == '医生超时未接单自动取消') ){ $log = UserBalanceLog::where(['relation_id'=>$order->id])->first(); if(!empty($log)){ $user = \App\Models\User::where('id',$order->user_id)->first(); if($user->balance >0){ User::where('id',$order->user_id)->decrement('balance',$log->change_balance); UserBalanceLog::where('id',$log->id)->delete(); } } Order::where('id',$order->id)->update($orderInfo); } } else { continue; } } return null; } public function getValue($model,$where,$field) { return $model->where($where)->value($field); } }