fuyu 5 年之前
父节点
当前提交
19f31b99bd
共有 1 个文件被更改,包括 56 次插入56 次删除
  1. 56 56
      application/inter/controller/Wechat.php

+ 56 - 56
application/inter/controller/Wechat.php

@@ -43,7 +43,7 @@ class Wechat extends Base {
     }
 
     public function  wechatCallback() {
-        try {
+        // try {
              // $param = $_REQUEST['param'];
             // $repsone = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
             Log::record('-----微信支付回调----开始----');
@@ -51,62 +51,62 @@ class Wechat extends Base {
             Log::record('-----微信支付返回----xml----');
             $xml = file_get_contents("php://input");
             Log::record($xml);
-            Log::record('-----xml转数组--------');
-            $data = (array)simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); //将微信返回的XML 转换成数组
-            Log::record($data);
-            $out_trade_no = $data['out_trade_no'];
-            $data['timestamp'] = time();
-            Log::record('-----添加流水记录----');
-            Log::record($data);
-            die;
-            Db::table("wechat_pay_log")->insert($data);
+        //     Log::record('-----xml转数组--------');
+        //     $data = (array)simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); //将微信返回的XML 转换成数组
+        //     Log::record($data);
+        //     $out_trade_no = $data['out_trade_no'];
+        //     $data['timestamp'] = time();
+        //     Log::record('-----添加流水记录----');
+        //     Log::record($data);
+        //     die;
+        //     Db::table("wechat_pay_log")->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, exam_class")->find();
-            Log::record($order);
-            if($order && $order['status'] === Application::ORDER_STATUS['CREATE']) {
-                $order['status'] = Application::ORDER_STATUS['PAYCOMPLTET'];
-                $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', $aid)->field('exam_id')->find();
-                $exam_id = $application['exam_id'];
-                $r_info = DB::table('report')->where('exam_id',$exam_id)->where('remote_application_id', $aid)->field('id')->find();
-                $t = '收到一条远程诊断申请';
-                $ins = DB::table('institution')->where('id',$order['hospital_id'])->field('name')->find();
-                $doctor = DB::table('doctors')->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 $repsone;
-                }
-                $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('-----短信通知-----');
-                    send_message::sendSms2Apply($d_phone,$d_time,$d_name);
-                }
-            }
-            Log::record('---微信支付回调---结束---');
-            // return $repsone;
-        } catch (\Throwable $th) {
-            Log::record('支付回调异常');
-            Log::record($th->getMessage());
-            //throw $th;
-        }
+        //     Log::record('-----获取订单信息-----');
+        //     $order = Db::table("remote_order")->where("id", $out_trade_no)->field("id, status, super_doctor_id, application_id, hospital_id, doctor_id, exam_class")->find();
+        //     Log::record($order);
+        //     if($order && $order['status'] === Application::ORDER_STATUS['CREATE']) {
+        //         $order['status'] = Application::ORDER_STATUS['PAYCOMPLTET'];
+        //         $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', $aid)->field('exam_id')->find();
+        //         $exam_id = $application['exam_id'];
+        //         $r_info = DB::table('report')->where('exam_id',$exam_id)->where('remote_application_id', $aid)->field('id')->find();
+        //         $t = '收到一条远程诊断申请';
+        //         $ins = DB::table('institution')->where('id',$order['hospital_id'])->field('name')->find();
+        //         $doctor = DB::table('doctors')->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 $repsone;
+        //         }
+        //         $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('-----短信通知-----');
+        //             send_message::sendSms2Apply($d_phone,$d_time,$d_name);
+        //         }
+        //     }
+        //     Log::record('---微信支付回调---结束---');
+        //     // return $repsone;
+        // } catch (\Throwable $th) {
+        //     Log::record('支付回调异常');
+        //     Log::record($th->getMessage());
+        //     //throw $th;
+        // }
 
 
         // $order_id = $param['order_id'];