创建订单,判断是否收费,免费则直接预约思信

wenjuan
yanzai 1 year ago
parent ee5e791199
commit f552410b30

@ -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('操作失败');

@ -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();

@ -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)
{

@ -5,7 +5,7 @@ return [
'WxAppid' => 'wx526430047d34c85c', //岚科公众号
'WxAppSecret' => '975b8a8b627b1bde71bbe49149134549', //岚科公众号
'WaitingPaymentTime'=>20, //等待支付时间,单位分钟
'PayNotifyUrl' =>"https://www.xxxxxxxxx.xxxx/h5/#/pages/main/order/CheckPay"//支付完成后小程序跳转H5路径
],
/*

Loading…
Cancel
Save