|
|
@@ -37,41 +37,6 @@ class PublicService extends BaseService
|
|
|
return [$chatId, $firstName, $username];
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- * 设置用户的访客ID
|
|
|
- * @param $memberId string 会员编号
|
|
|
- * @param $visitorId string 访客ID
|
|
|
- * @return void
|
|
|
- * @throws Exception
|
|
|
- */
|
|
|
- public static function setVisitorId(string $memberId, string $visitorId): void
|
|
|
- {
|
|
|
-
|
|
|
- try {
|
|
|
- $user = User::where('member_id', $memberId)->first();
|
|
|
- if (!$user) throw new Exception('验证失败', HttpStatus::CUSTOM_ERROR);
|
|
|
- if (empty($user->visitor_id)) {
|
|
|
- if (User::where('visitor_id', $visitorId)->exists()) {
|
|
|
- User::where('visitor_id', $visitorId)->update(['status' => 1]);
|
|
|
- $user->status = 1;
|
|
|
- }
|
|
|
- $user->visitor_id = $visitorId;
|
|
|
- }
|
|
|
- if (empty($user->register_ip)) {
|
|
|
- $registerIp = request()->ip();
|
|
|
- if (User::where('register_ip', $registerIp)->exists()) {
|
|
|
- User::where('register_ip', $registerIp)->update(['status' => 1]);
|
|
|
- $user->status = 1;
|
|
|
- }
|
|
|
- $user->register_ip = $registerIp;
|
|
|
- }
|
|
|
- $user->save();
|
|
|
- } catch (Exception $e) {
|
|
|
- throw new Exception('验证失败', HttpStatus::CUSTOM_ERROR);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 用户初始化 (用户注册)/ 更新用户昵称
|
|
|
* @param $chatId
|