where(['openid'=>$openid,'status'=>1,'is_del'=>0])->first(); if(!$user) return \Yz::echoError1('openid对应用户不存在'); $person=DB::table('web_user_person')->where(['user_id'=>$user->id,'is_del'=>0,'id'=>$person_id])->first(); if(!$person) return \Yz::echoError1('就诊人信息查询失败'); $jifen=0; $yucunkuan=0; $YouHuiQuanType_ids=[]; $coupon_list=[]; $env=config('app.globals.Env'); if($env=='pro') { //如果是正式环境 $AspNet=new AspNetZhuanController(); $jifen= $AspNet::GetJiFen_YuCunKuan(1,$person->ghzid); $yucunkuan= $AspNet::GetJiFen_YuCunKuan(2,$person->ghzid); $YouHuiQuanType=$AspNet::YouHuiQuan(['action'=>2]); foreach ($YouHuiQuanType as $key=>$type){ if($type['TJXCXHX']==1){ $YouHuiQuanType_ids[]=$type['DZJLBID']; } } if(count($YouHuiQuanType_ids)>0){ $data=[ 'ghzid'=>$person->ghzid, 'action'=>1, ]; $YouHuiQuanList=$AspNet::YouHuiQuan($data); foreach ($YouHuiQuanList as $key=>$quan){ if(in_array($quan['DZJLBID'],$YouHuiQuanType_ids) and $quan['是否在有效内']===true and $quan['TimeNuZTTextm']=="有效" and $quan['ZT']==1){ $coupon_list[]=[ 'id'=>$quan['DZJID'], "title"=>$quan['DZJLBMC'], "date_range"=>[substr($quan['YSQKSSJ'],0,10),substr($quan['YSQJSSJ'],0,10)], 'price'=>$quan['JE'], "desc"=>$quan['DZJLBMC'] ]; } } } } if($env=='dev') {//如果是开发环境 $jifen=50; $yucunkuan=20; $coupon_list=[ [ 'id'=>1, "title"=>"新人专属", "date_range"=>['2024-05-01','2024-12-31'], 'price'=>'12', "desc"=>"满299可用" ], [ 'id'=>2, "title"=>"新人专属2", "date_range"=>['2024-08-01','2024-11-10'], 'price'=>'60', "desc"=>"满500可用" ] ]; } return \Yz::Return(true,"查询完成",[ 'person'=>$person, 'integral'=>$jifen, 'save_money'=>$yucunkuan, 'coupon_list'=>$coupon_list, ]); } //获取本单可用积分 public function UsableIntegralSaveMoney(){ $ysje =request('ysje'); $ssje =request('ssje'); $type =request('type'); //1积分2预存款(预存款暂时不用此接口查) $openid =request('openid'); $person_id =request('person_id'); if(!isset($type)) return \Yz::echoError1("type不能为空"); $user=DB::table('web_users')->where(['openid'=>$openid,'status'=>1,'is_del'=>0])->first(); if(!$user) return \Yz::echoError1('openid对应用户不存在'); $person=DB::table('web_user_person')->where(['user_id'=>$user->id,'is_del'=>0,'id'=>$person_id])->first(); if(!$person) return \Yz::echoError1('就诊人信息查询失败'); $count=0; $env=config('app.globals.Env'); if($env=='pro') { //如果是正式环境 $AspNet=new AspNetZhuanController(); $count= $AspNet::GetEnableCount($person->ghzid,$ysje,$ssje); } if($env=='dev') {//如果是开发环境 $count=30; } if($type==1){ return \Yz::Return(true,"查询完成",['keyong_jifen'=>$count]); } return \Yz::echoError1("查询失败"); } }