From d7f8ae9c5731a1d8f0919758ee64aae9d978659b Mon Sep 17 00:00:00 2001 From: yanzai Date: Mon, 2 Dec 2024 11:17:43 +0800 Subject: [PATCH] =?UTF-8?q?H5=E5=8F=B7=E6=BA=90=E6=80=A7=E5=88=AB=E7=AD=9B?= =?UTF-8?q?=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/API/H5/PlanController.php | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/Laravel/app/Http/Controllers/API/H5/PlanController.php b/Laravel/app/Http/Controllers/API/H5/PlanController.php index 7385a7d..0a4f9fd 100644 --- a/Laravel/app/Http/Controllers/API/H5/PlanController.php +++ b/Laravel/app/Http/Controllers/API/H5/PlanController.php @@ -32,12 +32,12 @@ class PlanController extends Controller ->where(['hospital_id'=>$hospital_id,'type'=>1]) ->where('is_vip','<>',1) ->whereIn('use_type',[0,$use_type]); -// if($use_type==1){ -// $list=$list->where(['amount_limit1'=>0])->orWhere('amount_limit1','>=',$amount); -// } -// if($use_type==2){ -// $list=$list->where(['amount_limit2'=>0])->orWhere('amount_limit2','>=',$amount); -// } + if(isset($person_id)){ + $personInfo=DB::table('web_user_person')->where(['id'=>$person_id])->first(); + if(!!$personInfo){ + $list=$list->whereIn('sex',[0,$personInfo->sex]); + } + } if ($use_type == 1) { $list = $list->where(function ($query) use ($amount) { $query->where('amount_limit1', 0)->orWhere('amount_limit1', '>=', $amount); @@ -93,6 +93,10 @@ class PlanController extends Controller $checkup_type_id=(string)request('checkup_type_id');//体检类型表对应id $amount=request('amount');//总金额 if(!isset($checkup_type_id)) return \Yz::echoError1("体检类型不能为空"); + $personInfo=false; + if(isset($person_id)){ + $personInfo=DB::table('web_user_person')->where(['id'=>$person_id])->first(); + } $currentDateTime = now(); $list=DB::table('plans') ->where('date',$date)->whereIn('status',[1,2]) @@ -101,6 +105,10 @@ class PlanController extends Controller ->where(['hospital_id'=>$hospital_id,'type'=>1]) ->where('is_vip','<>',1) ->whereIn('use_type',[0,$use_type]); + + if(!!$personInfo){ + $list=$list->whereIn('sex',[0,$personInfo->sex]); + } if ($use_type == 1) { $list = $list->where(function ($query) use ($amount) { $query->where('amount_limit1', 0)->orWhere('amount_limit1', '>=', $amount); @@ -131,12 +139,10 @@ class PlanController extends Controller ->where(['hospital_id'=>$hospital_id,'type'=>1]) ->where('is_vip','<>',1) ->whereIn('use_type',[0,$use_type]); -// if($use_type==1){ -// $weeklist=$weeklist->where(['amount_limit1'=>0])->orWhere('amount_limit1','>=',$amount); -// } -// if($use_type==2){ -// $weeklist=$weeklist->where(['amount_limit2'=>0])->orWhere('amount_limit2','>=',$amount); -// } + if(!!$personInfo){ + $weeklist=$weeklist->whereIn('sex',[0,$personInfo->sex]); + } + if ($use_type == 1) { $weeklist = $weeklist->where(function ($query) use ($amount) { $query->where('amount_limit1', 0)->orWhere('amount_limit1', '>=', $amount);