From af7e8c141fe253a6f45aeeb544eb194562d6b870 Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Sun, 14 May 2023 18:12:31 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E6=A0=87=E8=AF=86=E5=94=AF=E4=B8=80=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/UserService.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/app/service/UserService.php b/app/service/UserService.php index 57fafba39..7fb9fa4e8 100755 --- a/app/service/UserService.php +++ b/app/service/UserService.php @@ -2176,6 +2176,9 @@ class UserService 'referrer' => isset($params['referrer']) ? $params['referrer'] : 0, ]; + // 用户唯一方法 + $method = self::UserUniqueMethod(); + // 是否一键登录 $is_onekey_mobile_bind = isset($params['is_onekey_mobile_bind']) && $params['is_onekey_mobile_bind'] == 1 ? 1 : 0; @@ -2202,7 +2205,7 @@ class UserService if(empty($user['mobile']) && !empty($data['mobile']) && $is_onekey_mobile_bind == 1) { // 手机号码不存在则绑定到当前账号下 - $temp = self::UserBaseInfo('mobile', $data['mobile']); + $temp = self::$method('mobile', $data['mobile']); if(empty($temp)) { $upd_data = [ @@ -2253,7 +2256,7 @@ class UserService if(empty($unionid_user_base['mobile']) && !empty($data['mobile']) && $is_onekey_mobile_bind == 1) { // 手机号码不存在则绑定到当前账号下 - $temp = self::UserBaseInfo('mobile', $data['mobile']); + $temp = self::$method('mobile', $data['mobile']); if(empty($temp)) { $upd_data = [ @@ -2289,7 +2292,7 @@ class UserService { // 如果手机号码存在则直接绑定openid // 不存在添加,存在更新openid - $user = self::UserBaseInfo('mobile', $data['mobile']); + $user = self::$method('mobile', $data['mobile']); if(!empty($user)) { // 上面openid和unionid都没存在信息,但是存在手机号码信息则增加用户平台数据 @@ -2792,7 +2795,8 @@ class UserService $is_appmini = array_key_exists(APPLICATION_CLIENT_TYPE, MyLang('common_appmini_type')); // 手机号码获取用户信息 - $mobile_user = self::UserBaseInfo('mobile', $data['mobile']); + $method = self::UserUniqueMethod(); + $mobile_user = self::$method('mobile', $data['mobile']); // 额外信息 if(empty($mobile_user)) @@ -2908,6 +2912,16 @@ class UserService } if(isset($user_id) && $user_id > 0) { + // 用户平台信息、不存在则添加 + $user_platform = self::UserPlatformInfo('user_id', $user_id); + if(empty($user_platform)) + { + if(!self::UserPlatformInsert(['user_id' => $user_id], $params)) + { + return DataReturn(MyLang('insert_fail'), -1); + } + } + // 清除验证码 $obj->Remove(); return DataReturn(MyLang('bind_success'), 0, self::AppUserInfoHandle(['where_field'=>'id', 'where_value'=>$user_id]));