创建订单校验核磁号源是否可用

main
yanzai 1 year ago
parent 0132594ec8
commit 066383f62b

@ -42,10 +42,10 @@ class AspNetZhuanController extends Controller
return true; return true;
} }
//二线预约 //二线预约
public static function GetNmrList($data,$nonce) public static function ErXian($data,$nonce)
{ {
$res= self::Post(self::$BaseUrl . '/erxianzhongzhuan.aspx?str='.$nonce,$data,'二线号源'); $res= self::Post(self::$BaseUrl . '/erxianzhongzhuan.aspx?str='.$nonce,$data,'二线号源');
return $res['data']; return $res['data']??true;
} }
//发送短信 //发送短信

@ -453,7 +453,7 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4)
} }
if(count($nmr_list)>0){ if(count($nmr_list)>0){
$nmr_list=[ $nmr_list=[
['item_id' => '999999', ['item_id' => $nmr_list[0]['item_id'],
'name' =>$temp_nmr] 'name' =>$temp_nmr]
]; ];

@ -30,7 +30,7 @@ class NMRController extends Controller
} }
$aspnet=new AspNetZhuanController(); $aspnet=new AspNetZhuanController();
$list=[]; $list=[];
$nmr=$aspnet::GetNmrList(['yyid'=>6,'data'=>$days ,'action'=>"1"],uniqid()); $nmr=$aspnet::ErXian(['yyid'=>6,'data'=>$days ,'action'=>"1"],uniqid());
//获取每日数量 //获取每日数量
foreach($nmr as $k=>$v){ foreach($nmr as $k=>$v){
@ -92,7 +92,7 @@ class NMRController extends Controller
$aspnet=new AspNetZhuanController(); $aspnet=new AspNetZhuanController();
$week7=[]; $week7=[];
$currentDate = new DateTime(); $currentDate = new DateTime();
$nmr=$aspnet::GetNmrList(['yyid'=>6,'data'=>$days7,'action'=>"1"],uniqid()); $nmr=$aspnet::ErXian(['yyid'=>6,'data'=>$days7,'action'=>"1"],uniqid());
//获取每日数量 //获取每日数量
foreach($nmr as $k=>$v){ foreach($nmr as $k=>$v){
$t_v=[]; $t_v=[];

@ -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,50 +341,65 @@ 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("无需使用代金券");
$AspNet = new AspNetZhuanController();
if($env=='pro') { //如果是正式环境 $data = [
$AspNet=new AspNetZhuanController(); 'ghzid' => $person->ghzid,
'action' => 1,
$data=[ ];
'ghzid'=>$person->ghzid, $YouHuiQuanList = $AspNet::YouHuiQuan($data);
'action'=>1, foreach ($YouHuiQuanList as $key => $quan) {
]; if ($quan['DZJID'] == $coupon_id) {
$YouHuiQuanList=$AspNet::YouHuiQuan($data); $quanInfo = $quan;
foreach ($YouHuiQuanList as $key=>$quan){
if($quan['DZJID']==$coupon_id){
$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['TJXCXHX']!=1 ) return \Yz::echoError1("此代金券不可用");
if($quanType['MKJE']==0 or $quanType['MKJE']>=$true_price){
//抵扣代金券金额,折扣暂未实现
$true_price=($true_price-$quanInfo['JE'])>0 ? $true_price-$quanInfo['JE']:0;
}
} }
if ($quanType === false or $quanInfo === false) return \Yz::echoError1("此代金券不可用");
if ($quanType['TJXCXHX'] != 1) return \Yz::echoError1("此代金券不可用");
if ($quanType['MKJE'] == 0 or $quanType['MKJE'] >= $true_price) {
//抵扣代金券金额,折扣暂未实现
$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;
}
} }
$now_datetime = date('Y-m-d H:i:s'); $now_datetime = date('Y-m-d H:i:s');
@ -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,13 +704,13 @@ 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);
} }
} }
return \Yz::Return(true, "批量处理完成", []); return \Yz::Return(true, "批量处理完成", []);

@ -279,7 +279,7 @@ const comfrimyy = async () => {
"", "",
item_ids: buyInfo.value.item_ids, item_ids: buyInfo.value.item_ids,
plan_id: plan_id, plan_id: plan_id,
plan_nmr_id: plan_nmr_id, plan_nmr_info:yytjInfo.value?.nmr_list || null,
doctor: yytjInfo.value?.doctor_name || "", doctor: yytjInfo.value?.doctor_name || "",
duo_xuan_yi: $store.getDuoXuanYi(), duo_xuan_yi: $store.getDuoXuanYi(),
jifen: Math.ceil(jifen.value), jifen: Math.ceil(jifen.value),

Loading…
Cancel
Save