From f552410b309dc65ab5832c49f7f1416f5ca326f0 Mon Sep 17 00:00:00 2001 From: yanzai Date: Sun, 22 Sep 2024 23:59:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=AE=A2=E5=8D=95=EF=BC=8C?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E6=94=B6=E8=B4=B9=EF=BC=8C?= =?UTF-8?q?=E5=85=8D=E8=B4=B9=E5=88=99=E7=9B=B4=E6=8E=A5=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E6=80=9D=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/API/H5/OrderController.php | 20 ++++++++++++++++--- .../Http/Controllers/API/H5/PayController.php | 2 +- .../Http/Controllers/API/XCXApiController.php | 2 +- Laravel/config/app.php | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Laravel/app/Http/Controllers/API/H5/OrderController.php b/Laravel/app/Http/Controllers/API/H5/OrderController.php index bc7288e..9a57ae2 100644 --- a/Laravel/app/Http/Controllers/API/H5/OrderController.php +++ b/Laravel/app/Http/Controllers/API/H5/OrderController.php @@ -107,7 +107,7 @@ class OrderController extends Controller if (!isset($openid)) return \Yz::echoError1('openid不能为空'); if (!isset($person_id)) return \Yz::echoError1('person_id不能为空'); if (!isset($type)) return \Yz::echoError1('type体检类型不能为空'); - if ($type !== '1' && $type !== '2') { + if ($type != 1 && $type != 2) { return \Yz::echoError1('type参数,体检类型错误'); } if (!isset($plan_id)) return \Yz::echoError1('号源id不能为空'); @@ -283,13 +283,27 @@ class OrderController extends Controller 'married' => $person->married, ]; DB::beginTransaction(); - $insert = DB::table('orders')->insert($data); + $insert = DB::table('orders')->insertGetId($data); $up_plan = DB::table('plans')->where(['id' => $plan->id, 'status' => 1])->update([ 'status' => 2 ]); if ($insert and $up_plan) { DB::commit(); - return \Yz::return(true, "操作成功", []); + $action=false; + if($true_price==0){ + //如果是免费的,直接去预约 + $yuyue= self::Finish($order_num); + if($yuyue['status']===true){ + return \Yz::return(true, "操作成功", ['action' => $action]); + }else{ + return \Yz::echoError1($yuyue['msg']); + } + } + if($true_price>0){ + //如果大于0则提示前端去支付 + $action="pay"; + } + return \Yz::return(true, "操作成功", ['action' => $action]); } else { DB::rollBack(); return \Yz::echoError1('操作失败'); diff --git a/Laravel/app/Http/Controllers/API/H5/PayController.php b/Laravel/app/Http/Controllers/API/H5/PayController.php index aa7927c..67d047a 100644 --- a/Laravel/app/Http/Controllers/API/H5/PayController.php +++ b/Laravel/app/Http/Controllers/API/H5/PayController.php @@ -55,7 +55,7 @@ class PayController extends Controller 'orderid' => $orderInfo->order_number, 'order_desc' => $orderInfo->title, 'amount' => (int)($orderInfo->true_price * 100), - 'notify_url'=>$XCXApi::$pay_notify_url + 'notify_url'=>config('app.globals.PayNotifyUrl') ]; $nonce=self::nonce(); $timestamp=(string)time(); diff --git a/Laravel/app/Http/Controllers/API/XCXApiController.php b/Laravel/app/Http/Controllers/API/XCXApiController.php index e38e31e..c41ba20 100644 --- a/Laravel/app/Http/Controllers/API/XCXApiController.php +++ b/Laravel/app/Http/Controllers/API/XCXApiController.php @@ -16,7 +16,7 @@ class XCXApiController extends Controller public static $appid = "13a159e438a742dd932c9bddbfaa41e5";//appid public static $signType = "OPENAPI-SHA256-RSA2048";//签名认证类型 public static $baseUrl = "https://xdfe-api.hnxdfe.com/hisminitest"; - public static $pay_notify_url = "https://www.xxxxxxxx.com/h5/#/pages/main/order/CheckPay";//支付完成后小程序跳转H5路径 + public static function Api($url_code) { diff --git a/Laravel/config/app.php b/Laravel/config/app.php index bfb255a..751a6ca 100644 --- a/Laravel/config/app.php +++ b/Laravel/config/app.php @@ -5,7 +5,7 @@ return [ 'WxAppid' => 'wx526430047d34c85c', //岚科公众号 'WxAppSecret' => '975b8a8b627b1bde71bbe49149134549', //岚科公众号 'WaitingPaymentTime'=>20, //等待支付时间,单位分钟 - + 'PayNotifyUrl' =>"https://www.xxxxxxxxx.xxxx/h5/#/pages/main/order/CheckPay"//支付完成后小程序跳转H5路径 ], /*