insert($data); Log::record('-----获取订单信息-----'); $order = Db::table("remote_order")->where("id", $out_trade_no)->field("id, status, super_doctor_id, application_id, hospital_id, doctor_id")->find(); Log::record($order); if($order && $order['status'] === 1) { $order['status'] = 2; $d = $order['super_doctor_id']; $aid = $order['application_id']; // todo 消息通知 Log::record('-----更新订单状态-----'); DB::table("remote_order")->where("id", $out_trade_no)->update($order); $application = DB::table('remote_application')->where('id', $order['application_id'])->field('exam_id')->find(); $exam_id = $application['exam_id']; $r_info = DB::table('report')->where('exam_id',$exam_id)->where('remote_application_id', $aid)->find(); $t = '收到一条远程诊断申请'; $ins = DB::table('institution')->where('id',$order['hospital_id'])->field('name')->find(); $doctor = DB::table('doctor')->where('id',$order['doctor_id'])->field('realname')->find(); $c = $ins['name'].$doctor['realname'].'医师向您发起一条远程诊断申请'; $type = '1'; $url = Message::url(null, $exam_id,1,$order['exam_class'],$r_info['id'],$aid); Log::record('-----系统内消息通知-----'); Message::insert($t,$c,$d,$type,$url,1,$aid); //保存 申请 if(empty($d)) { Log::record('---微信支付回调---结束---没有远程医生'); return; } $dinfo = DB::table('doctors')->where('id',$d)->find(); $d_phone = $dinfo['phone']; $d_name = $dinfo['realname']; if($order['is_urgent'] === 1) { $d_time = date('H:i',strtotime('+30 min')); } else { $d_time = date('H:i',strtotime('+1 hour')); } if($dinfo['institution_id'] == '22100003' || $dinfo['send_sms'] == 1){ //魏庙 Log::record('-----短信通知-----'); $repsone = send_message::sendSms2Apply($d_phone,$d_time,$d_name); } } Log::record('---微信支付回调---结束---'); // $order_id = $param['order_id']; // $remote_order = DB::table('remote_order')->where('id', $order_id)->find(); // if(!$remote_order) { // return json_encode(['status'=>'fail','code'=>'3001','msg'=> "没有找到该订单"]); // } // if($remote_order !== Application::ORDER_STATUS['CREATE']) { // return json_encode(['status'=>'fail','code'=>'3002','msg'=> "订单状态出错"]); // } // DB::table('remote_order')->where('id', $order_id)->update(["status" => Application::ORDER_STATUS['PAYCOMPLTET']]); // return json_encode(['status'=>'ok','code'=>'0000','msg'=> "支付回调成功"]); } }