|
|
|
@ -79,9 +79,9 @@ class OrderController extends Controller
|
|
|
|
|
|
|
|
|
|
|
|
$duo_xuan_yi = request('duo_xuan_yi'); //多选1
|
|
|
|
$duo_xuan_yi = request('duo_xuan_yi'); //多选1
|
|
|
|
$plan_id = request('plan_id');//号源id
|
|
|
|
$plan_id = request('plan_id');//号源id
|
|
|
|
$plan_nmr_id = request('plan_nmr_id');//核磁号源id
|
|
|
|
$plan_nmr_info = request('plan_nmr_info');//核磁号源信息
|
|
|
|
$doctor = request('doctor');//预约的医生名字
|
|
|
|
$doctor = request('doctor');//预约的医生名字
|
|
|
|
$coupon_id=request('coupon_id');//优惠券
|
|
|
|
$coupon_id = request('coupon_id');//优惠券
|
|
|
|
$jifen = request('jifen', 0); //使用的积分数量
|
|
|
|
$jifen = request('jifen', 0); //使用的积分数量
|
|
|
|
$yucunkuan = request('yucunkuan', 0);//使用的预存款数量
|
|
|
|
$yucunkuan = request('yucunkuan', 0);//使用的预存款数量
|
|
|
|
|
|
|
|
|
|
|
|
@ -91,6 +91,12 @@ class OrderController extends Controller
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!isset($hospital_id)) return \Yz::echoError1('医院id不能为空');
|
|
|
|
if (!isset($hospital_id)) return \Yz::echoError1('医院id不能为空');
|
|
|
|
|
|
|
|
if ($hospital_id == 1) {
|
|
|
|
|
|
|
|
$yyid = 6;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($hospital_id == 4) {
|
|
|
|
|
|
|
|
$yyid = 2;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (!isset($openid)) return \Yz::echoError1('openid不能为空');
|
|
|
|
if (!isset($openid)) return \Yz::echoError1('openid不能为空');
|
|
|
|
if (!isset($person_id)) return \Yz::echoError1('person_id不能为空');
|
|
|
|
if (!isset($person_id)) return \Yz::echoError1('person_id不能为空');
|
|
|
|
if (!isset($type)) return \Yz::echoError1('type体检类型不能为空');
|
|
|
|
if (!isset($type)) return \Yz::echoError1('type体检类型不能为空');
|
|
|
|
@ -316,7 +322,7 @@ class OrderController extends Controller
|
|
|
|
return \Yz::echoError1("预约日期不在单位有效时间范围内,请重新选择");
|
|
|
|
return \Yz::echoError1("预约日期不在单位有效时间范围内,请重新选择");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$plan_nmr_appointment_info=[];
|
|
|
|
//校验积分和预存款
|
|
|
|
//校验积分和预存款
|
|
|
|
$env = config('app.globals.Env');
|
|
|
|
$env = config('app.globals.Env');
|
|
|
|
$AspNet = new AspNetZhuanController();
|
|
|
|
$AspNet = new AspNetZhuanController();
|
|
|
|
@ -335,49 +341,64 @@ class OrderController extends Controller
|
|
|
|
if ($true_price < 0) $true_price = 0;
|
|
|
|
if ($true_price < 0) $true_price = 0;
|
|
|
|
|
|
|
|
|
|
|
|
//如果使用了代金券
|
|
|
|
//如果使用了代金券
|
|
|
|
$quanInfo=false;
|
|
|
|
$quanInfo = false;
|
|
|
|
if(isset($coupon_id) and !empty($coupon_id)){
|
|
|
|
if (isset($coupon_id) and !empty($coupon_id)) {
|
|
|
|
if($true_price==0) return \Yz::echoError1("无需使用代金券");
|
|
|
|
if ($true_price == 0) return \Yz::echoError1("无需使用代金券");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($env=='pro') { //如果是正式环境
|
|
|
|
|
|
|
|
$AspNet=new AspNetZhuanController();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$data=[
|
|
|
|
$AspNet = new AspNetZhuanController();
|
|
|
|
'ghzid'=>$person->ghzid,
|
|
|
|
$data = [
|
|
|
|
'action'=>1,
|
|
|
|
'ghzid' => $person->ghzid,
|
|
|
|
|
|
|
|
'action' => 1,
|
|
|
|
];
|
|
|
|
];
|
|
|
|
$YouHuiQuanList=$AspNet::YouHuiQuan($data);
|
|
|
|
$YouHuiQuanList = $AspNet::YouHuiQuan($data);
|
|
|
|
foreach ($YouHuiQuanList as $key=>$quan){
|
|
|
|
foreach ($YouHuiQuanList as $key => $quan) {
|
|
|
|
if($quan['DZJID']==$coupon_id){
|
|
|
|
if ($quan['DZJID'] == $coupon_id) {
|
|
|
|
$quanInfo=$quan;
|
|
|
|
$quanInfo = $quan;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if($quanInfo['是否在有效内']===true and $quanInfo['TimeNuZTTextm']=="有效" and $quanInfo['ZT']==1){
|
|
|
|
if ($quanInfo['是否在有效内'] === true and $quanInfo['TimeNuZTTextm'] == "有效" and $quanInfo['ZT'] == 1) {
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
return \Yz::echoError1("此代金券不可用");
|
|
|
|
return \Yz::echoError1("此代金券不可用");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$quanType=false;
|
|
|
|
$quanType = false;
|
|
|
|
$YouHuiQuanType=$AspNet::YouHuiQuan(['action'=>2]);
|
|
|
|
$YouHuiQuanType = $AspNet::YouHuiQuan(['action' => 2]);
|
|
|
|
foreach ($YouHuiQuanType as $key=>$qtype){
|
|
|
|
foreach ($YouHuiQuanType as $key => $qtype) {
|
|
|
|
if($quanInfo['DZJLBID']==$qtype['DZJLBID']){
|
|
|
|
if ($quanInfo['DZJLBID'] == $qtype['DZJLBID']) {
|
|
|
|
$quanType=$qtype;
|
|
|
|
$quanType = $qtype;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// if($qtype['TJXCXHX']==1 and ($qtype['MKJE']===0 || $qtype['MKJE']>=$true_price)){
|
|
|
|
// if($qtype['TJXCXHX']==1 and ($qtype['MKJE']===0 || $qtype['MKJE']>=$true_price)){
|
|
|
|
// $YouHuiQuanType_ids[]=$qtype['DZJLBID'];
|
|
|
|
// $YouHuiQuanType_ids[]=$qtype['DZJLBID'];
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($quanType===false or $quanInfo===false) return \Yz::echoError1("此代金券不可用");
|
|
|
|
if ($quanType === false or $quanInfo === false) return \Yz::echoError1("此代金券不可用");
|
|
|
|
if($quanType['TJXCXHX']!=1 ) return \Yz::echoError1("此代金券不可用");
|
|
|
|
if ($quanType['TJXCXHX'] != 1) return \Yz::echoError1("此代金券不可用");
|
|
|
|
if($quanType['MKJE']==0 or $quanType['MKJE']>=$true_price){
|
|
|
|
if ($quanType['MKJE'] == 0 or $quanType['MKJE'] >= $true_price) {
|
|
|
|
//抵扣代金券金额,折扣暂未实现
|
|
|
|
//抵扣代金券金额,折扣暂未实现
|
|
|
|
$true_price=($true_price-$quanInfo['JE'])>0 ? $true_price-$quanInfo['JE']:0;
|
|
|
|
$true_price = ($true_price - $quanInfo['JE']) > 0 ? $true_price - $quanInfo['JE'] : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($plan_nmr_info) and !empty($plan_nmr_info)) {
|
|
|
|
|
|
|
|
$plan_nmr_temp = [];
|
|
|
|
|
|
|
|
foreach ($plan_nmr_info as $key => $plan_nmr) {
|
|
|
|
|
|
|
|
if ($plan_nmr['item_id'] <> -1) {
|
|
|
|
|
|
|
|
$p_nmr_data = [
|
|
|
|
|
|
|
|
'item_id' => $plan_nmr['item_id'],
|
|
|
|
|
|
|
|
'name' => $plan_nmr['name'],
|
|
|
|
|
|
|
|
'date' => substr($plan_nmr['time'], 0, 10),
|
|
|
|
|
|
|
|
'time' => substr($plan_nmr['time'], 10, 5),
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
//调用接口校验号源是否可用
|
|
|
|
|
|
|
|
$erxian_status = $AspNet::ErXian(['YYRQ' => $p_nmr_data['date'], 'YYSJ' => $p_nmr_data['time'], 'yyid' => $yyid, 'action' => 4], uniqid());
|
|
|
|
|
|
|
|
if ($erxian_status !== true) return \Yz::echoError1($p_nmr_data['name'] . '号源不可用,请重新选择');
|
|
|
|
|
|
|
|
$plan_nmr_temp[] = $p_nmr_data;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$plan_nmr_appointment_info=$plan_nmr_temp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -402,6 +423,7 @@ class OrderController extends Controller
|
|
|
|
'status' => 1,
|
|
|
|
'status' => 1,
|
|
|
|
'appointment_date' => $plan->date,
|
|
|
|
'appointment_date' => $plan->date,
|
|
|
|
'appointment_time' => $plan->time,
|
|
|
|
'appointment_time' => $plan->time,
|
|
|
|
|
|
|
|
'erxian_appointment_info' => json_encode($plan_nmr_appointment_info, JSON_UNESCAPED_UNICODE),
|
|
|
|
'plan_id' => $plan->id,
|
|
|
|
'plan_id' => $plan->id,
|
|
|
|
'plan_number' => $plan->plan_number,
|
|
|
|
'plan_number' => $plan->plan_number,
|
|
|
|
'combo_id' => $combo_id,
|
|
|
|
'combo_id' => $combo_id,
|
|
|
|
@ -412,7 +434,7 @@ class OrderController extends Controller
|
|
|
|
'birthday' => $person->birthday,
|
|
|
|
'birthday' => $person->birthday,
|
|
|
|
'married' => $person->married,
|
|
|
|
'married' => $person->married,
|
|
|
|
'wj_flag' => $wj_flag,
|
|
|
|
'wj_flag' => $wj_flag,
|
|
|
|
'youhuiquan'=>$quanInfo===false?'':json_encode(['id'=>$quanInfo['DZJID'],'name'=>$quanInfo['DZJLBMC']],JSON_UNESCAPED_UNICODE),
|
|
|
|
'youhuiquan' => $quanInfo === false ? '' : json_encode(['id' => $quanInfo['DZJID'], 'name' => $quanInfo['DZJLBMC']], JSON_UNESCAPED_UNICODE),
|
|
|
|
'created_at' => $now_datetime,
|
|
|
|
'created_at' => $now_datetime,
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
@ -430,13 +452,7 @@ class OrderController extends Controller
|
|
|
|
$jifen_dikou_status = true;
|
|
|
|
$jifen_dikou_status = true;
|
|
|
|
$yucunkuan_dikou_status = true;
|
|
|
|
$yucunkuan_dikou_status = true;
|
|
|
|
$youhuiquan_dikou_status = true;
|
|
|
|
$youhuiquan_dikou_status = true;
|
|
|
|
$r_yyid = $hospital_id;
|
|
|
|
|
|
|
|
if($r_yyid==1){
|
|
|
|
|
|
|
|
$yyid=6;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if($r_yyid==4){
|
|
|
|
|
|
|
|
$yyid=2;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($env == 'pro') { //如果是正式环境
|
|
|
|
if ($env == 'pro') { //如果是正式环境
|
|
|
|
if ($jifen > 0) {
|
|
|
|
if ($jifen > 0) {
|
|
|
|
$jifen_dikou_status = false;
|
|
|
|
$jifen_dikou_status = false;
|
|
|
|
@ -448,16 +464,16 @@ class OrderController extends Controller
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//核销优惠券
|
|
|
|
//核销优惠券
|
|
|
|
if(isset($coupon_id) and !empty($coupon_id)){
|
|
|
|
if (isset($coupon_id) and !empty($coupon_id)) {
|
|
|
|
$youhuiquan_dikou_status=false;
|
|
|
|
$youhuiquan_dikou_status = false;
|
|
|
|
$data=[
|
|
|
|
$data = [
|
|
|
|
'action'=>3,
|
|
|
|
'action' => 3,
|
|
|
|
'ghzid'=>$person->ghzid,
|
|
|
|
'ghzid' => $person->ghzid,
|
|
|
|
'dzjid'=>$coupon_id,
|
|
|
|
'dzjid' => $coupon_id,
|
|
|
|
'hxbz'=>"抵扣体检H5订单",
|
|
|
|
'hxbz' => "抵扣体检H5订单",
|
|
|
|
'yyid'=>$yyid
|
|
|
|
'yyid' => $yyid
|
|
|
|
];
|
|
|
|
];
|
|
|
|
$youhuiquan_dikou_status=$AspNet::YouHuiQuan($data);
|
|
|
|
$youhuiquan_dikou_status = $AspNet::YouHuiQuan($data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -688,12 +704,12 @@ class OrderController extends Controller
|
|
|
|
$WaitingPaymentTime = config('app.globals.WaitingPaymentTime');//支付等待時間
|
|
|
|
$WaitingPaymentTime = config('app.globals.WaitingPaymentTime');//支付等待時間
|
|
|
|
$orderInfos = DB::table('orders')->where(['status' => 1])->get();
|
|
|
|
$orderInfos = DB::table('orders')->where(['status' => 1])->get();
|
|
|
|
foreach ($orderInfos as $k => $orderInfo) {
|
|
|
|
foreach ($orderInfos as $k => $orderInfo) {
|
|
|
|
$person=DB::table('web_user_person')->where(['id' => $orderInfo->person_id])->first();
|
|
|
|
$person = DB::table('web_user_person')->where(['id' => $orderInfo->person_id])->first();
|
|
|
|
$datetime = new DateTime($orderInfo->created_at);
|
|
|
|
$datetime = new DateTime($orderInfo->created_at);
|
|
|
|
$timestamp = $datetime->getTimestamp();
|
|
|
|
$timestamp = $datetime->getTimestamp();
|
|
|
|
$orderInfo->end_time = $timestamp + (60 * $WaitingPaymentTime);
|
|
|
|
$orderInfo->end_time = $timestamp + (60 * $WaitingPaymentTime);
|
|
|
|
if (time() > $orderInfo->end_time) {
|
|
|
|
if (time() > $orderInfo->end_time) {
|
|
|
|
$do=new OrderService();
|
|
|
|
$do = new OrderService();
|
|
|
|
$do->Cancel($orderInfo);
|
|
|
|
$do->Cancel($orderInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|