diff --git a/Laravel/app/Http/Controllers/API/AspNetZhuanController.php b/Laravel/app/Http/Controllers/API/AspNetZhuanController.php index d53cb50..f7b2424 100644 --- a/Laravel/app/Http/Controllers/API/AspNetZhuanController.php +++ b/Laravel/app/Http/Controllers/API/AspNetZhuanController.php @@ -49,10 +49,13 @@ class AspNetZhuanController extends Controller } //发送短信 - public static function SendMsg($yyid,$tel,$name,$time){ - if($yyid==1){ + public static function SendMsg($r_yyid,$tel,$name,$time){ + if($r_yyid==1){ $yyid=6; } + if($r_yyid==4){ + $yyid=2; + } $content="时间:".$time.";科室:健康管理中心1区。温馨提醒:您的预约已成功,请在预约时间前 30 分钟达到科室,凭身份证原件开单。建议您体检前3天清淡饮食、禁烟酒"; $url=self::$BaseUrl."/tuisong.aspx?yyid=".$yyid."&type=8&mobile=".$tel."&msg1=".urlencode($name)."&msg2=".urlencode($content); self::get($url,"短信发送"); diff --git a/Laravel/app/Http/Controllers/API/H5/ComboController.php b/Laravel/app/Http/Controllers/API/H5/ComboController.php index a161128..0ebdaa2 100644 --- a/Laravel/app/Http/Controllers/API/H5/ComboController.php +++ b/Laravel/app/Http/Controllers/API/H5/ComboController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\API\H5; +use App\Http\Controllers\API\AspNetZhuanController; use App\Http\Controllers\Controller; use App\Services\ConfigService; use Illuminate\Http\Request; @@ -226,6 +227,12 @@ select combo_id as c_id,count(*) as count from orders where status in(2,4) group $duo_xuan_yi = request('duo_xuan_yi'); //多选1 $group_id = request('group_id'); //团检登记id $wj_flag= request('wj'); //问卷标记 + $coupon_id=request('coupon_id'); //代金券id + + $person_id = request('person_id'); //就诊人id + $person=DB::table('web_user_person')->where(['id' => $person_id,'is_del'=>0])->first(); + if(!$person) return \Yz::echoError1("用户不存在"); + if (!isset($hospital_id)) return \Yz::echoError1("医院id不能为空"); $hospital = DB::table('hospitals')->where(['id' => 1, 'status' => 1, 'is_del' => 0])->first(); if(isset($wj_flag) and $wj_flag==1){ @@ -377,7 +384,6 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4) $save_money = 150;//预存款抵扣金额 $coupon_money = 50;//优惠券抵扣金额 - //用户真实支付价格,应减去抵扣(二期实现) $group_info = false; @@ -401,10 +407,11 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4) $true_price = $true_price + $group_info[0]['sixi_zong_ji_jin_e']; $true_price = ($true_price - $group_info[0]['tongshou_xiane']) > 0 ? $true_price - $group_info[0]['tongshou_xiane'] : 0; + $all_items = DB::table('items')->where(['status' => 1])->get(); $item_new = []; foreach ($group_info[0]['items'] as $item) { - $item['keshi_name'] = '其他'; + $item['keshi_name'] = '其他'; $item['desc'] = ''; foreach ($all_items as $it) { if ($it->item_id == $item['id']) { @@ -452,6 +459,53 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4) ]; } + //如果使用了代金券 + if(isset($coupon_id) and !empty($coupon_id)){ + if($true_price==0) return \Yz::echoError1("无需使用代金券"); + $quanInfo=false; + $env=config('app.globals.Env'); + if($env=='pro') { //如果是正式环境 + $AspNet=new AspNetZhuanController(); + + $data=[ + 'ghzid'=>$person->ghzid, + 'ghzid'=>"5a798c097bc64bd79c22050175e6236a", + 'action'=>1, + ]; + $YouHuiQuanList=$AspNet::YouHuiQuan($data); + foreach ($YouHuiQuanList as $key=>$quan){ + if($quan['DZJID']==$coupon_id){ + $quanInfo=$quan; + } + } + + if($quanInfo['是否在有效内']===true and $quanInfo['TimeNuZTTextm']=="有效" and $quanInfo['ZT']==1){ + + }else{ + return \Yz::echoError1("此代金券不可用"); + } + + $quanType=false; + $YouHuiQuanType=$AspNet::YouHuiQuan(['action'=>2]); + foreach ($YouHuiQuanType as $key=>$type){ + if($quanInfo['DZJLBID']==$type['DZJLBID']){ + $quanType=$type; + } +// if($type['TJXCXHX']==1 and ($type['MKJE']===0 || $type['MKJE']>=$true_price)){ +// $YouHuiQuanType_ids[]=$type['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; + } + } + + } + + $data = [ 'group_info' => $group_info, 'combo_info' => $combo_info, diff --git a/Laravel/app/Http/Controllers/API/H5/PayController.php b/Laravel/app/Http/Controllers/API/H5/PayController.php index 345a5ff..d595677 100644 --- a/Laravel/app/Http/Controllers/API/H5/PayController.php +++ b/Laravel/app/Http/Controllers/API/H5/PayController.php @@ -141,8 +141,13 @@ class PayController extends Controller $AspNet=new AspNetZhuanController(); $jifen_huifu_status=true; $yucunkuan_huifu_status=true; - $yyid=$orderInfo->hospital_id; - if($yyid==1) $yyid=6; + $r_yyid=$orderInfo->hospital_id; + if($r_yyid==1){ + $yyid=6; + } + if($r_yyid==4){ + $yyid=2; + } if($env=='pro') { //如果是正式环境 if($orderInfo->jifen>0 and $orderInfo->is_refund_jifen==0) { $jifen_huifu_status=false; diff --git a/Laravel/app/Lib/Tools.php b/Laravel/app/Lib/Tools.php index 80c7bea..3ac9296 100644 --- a/Laravel/app/Lib/Tools.php +++ b/Laravel/app/Lib/Tools.php @@ -39,10 +39,13 @@ class Tools } return $weekname; } - public static function SendMsg($yyid,$tel,$name,$time){ - if($yyid==1){ + public static function SendMsg($r_yyid,$tel,$name,$time){ + if($r_yyid==1){ $yyid=6; } + if($r_yyid==4){ + $yyid=2; + } $content="时间:".$time.";科室:健康管理中心1区。温馨提醒:您的预约已成功,请在预约时间前 30 分钟达到科室,凭身份证原件开单。建议您体检前3天清淡饮食、禁烟酒"; $url="http://220.174.210.111:82/tuisong.aspx?yyid=".$yyid."&type=8&mobile=".$tel."&msg1=".urlencode($name)."&msg2=".urlencode($content); diff --git a/Laravel/app/Services/OrderService.php b/Laravel/app/Services/OrderService.php index ced4f00..a0800e4 100644 --- a/Laravel/app/Services/OrderService.php +++ b/Laravel/app/Services/OrderService.php @@ -81,8 +81,13 @@ class OrderService $AspNet=new AspNetZhuanController(); $jifen_huifu_status=true; $yucunkuan_huifu_status=true; - $yyid=$orderInfo->hospital_id; - if($yyid==1) $yyid=6; + $r_yyid=$orderInfo->hospital_id; + if($r_yyid==1){ + $yyid=6; + } + if($r_yyid==4){ + $yyid=2; + } if($env=='pro') { //如果是正式环境 if($orderInfo->jifen>0 and $orderInfo->is_refund_jifen==0) { $jifen_huifu_status=false; diff --git a/Laravel/routes/web.php b/Laravel/routes/web.php index 8a32fec..8272788 100644 --- a/Laravel/routes/web.php +++ b/Laravel/routes/web.php @@ -90,6 +90,6 @@ Route::group(['prefix' => 'api/Web'], function () { //对外------ Route::any('/TJPushInfo', 'App\Http\Controllers\API\Internal\SiXinPushController@PushInfo');//接收思信推送 -Route::any('/TJCheck', 'App\Http\Controllers\API\Internal\OrderController@TJCheck');//到检 +Route::any('/TJCheck', 'App\Http\Controllers\API\Internal\OrderController@TJCheck')->middleware('log');//到检 Route::any('/OrderBatchCancel', 'App\Http\Controllers\API\H5\OrderController@BatchCancel');//批量取消