|
|
|
@ -14,16 +14,38 @@ class UserController extends Controller
|
|
|
|
public function info(Request $request)
|
|
|
|
public function info(Request $request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$openid = $request->post('openid');
|
|
|
|
$openid = $request->post('openid');
|
|
|
|
|
|
|
|
if(!isset($openid)) return \Yz::echoError1("openid不能为空");
|
|
|
|
|
|
|
|
$user=DB::table('web_users')->where(['openid'=>$openid])->first();
|
|
|
|
|
|
|
|
$userid=false;
|
|
|
|
|
|
|
|
if(!$user){
|
|
|
|
|
|
|
|
$userid=DB::table('web_users')->insertGetId(['openid'=>$openid]);
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
$userid=$user->id;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if($userid) {
|
|
|
|
|
|
|
|
if(self::UpdatePersonList($openid)){//调用更新就诊人方法
|
|
|
|
|
|
|
|
//查询默认就诊人
|
|
|
|
|
|
|
|
$person_list=DB::table('web_user_person')->where(['user_id'=>$userid,'is_del'=>0])->get();
|
|
|
|
|
|
|
|
$default_person=DB::table('web_user_person')->where(['user_id'=>$userid,'is_default'=>1,'is_del'=>0])->first();
|
|
|
|
|
|
|
|
$count=count($person_list);
|
|
|
|
|
|
|
|
if($count>0 and !$default_person){
|
|
|
|
|
|
|
|
DB::table('web_user_person')->where(['id'=>$person_list[0]->id])->update(['is_default'=>1]);
|
|
|
|
|
|
|
|
$default_person=$person_list[0];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$info = [
|
|
|
|
$info = [
|
|
|
|
'name' => '演示用户',
|
|
|
|
'name' => isset($default_person->name)? $default_person->name:null,
|
|
|
|
'sex' => '2',
|
|
|
|
'sex' => isset($default_person->sex)?$default_person->sex:null,
|
|
|
|
'count' => 1,
|
|
|
|
'count' => $count,
|
|
|
|
'openid' => $openid,
|
|
|
|
'openid' => $openid,
|
|
|
|
];
|
|
|
|
];
|
|
|
|
return \Yz::Return(true, '获取成功', [
|
|
|
|
return \Yz::Return(true, '获取成功', [
|
|
|
|
'info' => $info
|
|
|
|
'info' => $info
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//获取名下体检人列表
|
|
|
|
//获取名下体检人列表
|
|
|
|
public function GetPersonList()
|
|
|
|
public function GetPersonList()
|
|
|
|
@ -77,12 +99,11 @@ class UserController extends Controller
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//更新用户列表,调用远程小程序接口
|
|
|
|
//更新用户列表,调用远程小程序接口
|
|
|
|
public function UpdatePersonList()
|
|
|
|
public function UpdatePersonList($openid)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$XCX=new XCXApiController();
|
|
|
|
$XCX=new XCXApiController();
|
|
|
|
$list=$XCX::Post('就诊人列表',['a'=>1]);
|
|
|
|
// $list=$XCX::Post('就诊人列表',['a'=>1]);
|
|
|
|
dd($list);
|
|
|
|
// $openid = "234243";
|
|
|
|
$openid = "234243";
|
|
|
|
|
|
|
|
$ApiPersonList = [
|
|
|
|
$ApiPersonList = [
|
|
|
|
[
|
|
|
|
[
|
|
|
|
'ghzid' => 'ghz11',
|
|
|
|
'ghzid' => 'ghz11',
|
|
|
|
@ -150,7 +171,13 @@ class UserController extends Controller
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
if($d) $success_count++;
|
|
|
|
if($d) $success_count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return \Yz::Return(true,"更新",['success_count'=>$success_count]);
|
|
|
|
//设置默认体检人
|
|
|
|
|
|
|
|
// $default=DB::table('web_user_person')->where(['user_id' => $user->id,'is_del'=>0,'is_default'=>1])->get();
|
|
|
|
|
|
|
|
// $p_list=DB::table('web_user_person')->where(['user_id' => $user->id,'is_del'=>0])->get();
|
|
|
|
|
|
|
|
// if(count($p_list)>0 and count($default)===0){
|
|
|
|
|
|
|
|
// DB::table('web_user_person')->where(['id'=>$p_list[0]->id])->update(['is_default'=>1]);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|