getUserPhoneNumber($params['code']); $phoneNumber = $response['phone_info']['purePhoneNumber'] ?? ''; if (empty($phoneNumber)) { throw new \Exception('获取手机号码失败'); } $user = User::where([ ['mobile', '=', $phoneNumber], ['id', '<>', $params['user_id']] ])->findOrEmpty(); if (!$user->isEmpty()) { throw new \Exception('手机号已被其他账号绑定'); } // 绑定手机号 User::update([ 'id' => $params['user_id'], 'mobile' => $phoneNumber ]); return true; } catch (\Exception $e) { self::setError($e->getMessage()); return false; } } public static function info($uid) { $data = User::where('id',$uid) ->field('avatar,real_name,nickname,account,mobile,sex,login_ip,user_money') ->find(); //判断是不是员工 if($data){ $data = $data->toArray(); $data['is_staff'] = 0; $data['store_id'] = 0; if(isset($data['mobile']) && $data['mobile']){ $check = SystemStore::where('phone',$data['mobile'])->find()??[]; if ($check){ $data['is_staff'] = 1; $data['store_id'] = $check['store_id']; } } }else{ $data = []; } return $data; } public static function recharge($param) { $param['order_id'] = getNewOrderId('rc'); $param['recharge_type'] = 'wechat'; return UserRecharge::create($param); } }