用户信息优化
parent
9f0a612abe
commit
0cec480a6d
|
|
@ -131,7 +131,7 @@ class User extends Common
|
|||
$this->data_post['gender'] = empty($this->data_post['gender']) ? 0 : ($this->data_post['gender'] == 'f') ? 1 : 2;
|
||||
return UserService::AuthUserProgram($this->data_post, 'alipay_openid');
|
||||
} else {
|
||||
$user['is_mandatory_bind_mobile'] = intval(MyC('common_user_is_mandatory_bind_mobile'));
|
||||
$user = UserService::AppUserInfoHandle($user);
|
||||
return DataReturn('授权成功', 0, $user);
|
||||
}
|
||||
return DataReturn('获取用户信息失败', -100);
|
||||
|
|
@ -212,7 +212,7 @@ class User extends Common
|
|||
return UserService::AuthUserProgram($result, 'weixin_openid');
|
||||
}
|
||||
} else {
|
||||
$user['is_mandatory_bind_mobile'] = intval(MyC('common_user_is_mandatory_bind_mobile'));
|
||||
$user = UserService::AppUserInfoHandle($user);
|
||||
return DataReturn('授权成功', 0, $user);
|
||||
}
|
||||
return DataReturn(empty($result) ? '获取用户信息失败' : $result, -100);
|
||||
|
|
|
|||
|
|
@ -1586,9 +1586,6 @@ class UserService
|
|||
*/
|
||||
public static function AuthUserProgram($params, $field)
|
||||
{
|
||||
// 是否强制绑定手机号码
|
||||
$is_mandatory_bind_mobile = intval(MyC('common_user_is_mandatory_bind_mobile'));
|
||||
|
||||
// 用户信息
|
||||
$data = [
|
||||
$field => $params['openid'],
|
||||
|
|
@ -1604,7 +1601,8 @@ class UserService
|
|||
{
|
||||
$data = $user;
|
||||
} else {
|
||||
if($is_mandatory_bind_mobile != 1)
|
||||
// 不强制绑定手机则写入用户信息
|
||||
if(intval(MyC('common_user_is_mandatory_bind_mobile')) != 1)
|
||||
{
|
||||
$ret = self::UserInsert($data, $params);
|
||||
if($ret['code'] == 0)
|
||||
|
|
@ -1616,11 +1614,31 @@ class UserService
|
|||
}
|
||||
}
|
||||
|
||||
// 是否强制绑定手机号码
|
||||
$data['is_mandatory_bind_mobile'] = $is_mandatory_bind_mobile;
|
||||
|
||||
// 返回成功
|
||||
return DataReturn('授权成功', 0, $data);
|
||||
return DataReturn('授权成功', 0, self::AppUserInfoHandle($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* app用户信息
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-11-06
|
||||
* @desc description
|
||||
* @param [arrat] $user [用户信息]
|
||||
*/
|
||||
public static function AppUserInfoHandle($user)
|
||||
{
|
||||
if(!empty($user))
|
||||
{
|
||||
// 用户信息处理
|
||||
$user = self::GetUserViewInfo(0, $user);
|
||||
|
||||
// 是否强制绑定手机号码
|
||||
$user['is_mandatory_bind_mobile'] = intval(MyC('common_user_is_mandatory_bind_mobile'));;
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue