diff --git a/app/home/service/UserService.php b/app/home/service/UserService.php index 67a7196e..18f88ede 100644 --- a/app/home/service/UserService.php +++ b/app/home/service/UserService.php @@ -187,11 +187,15 @@ class UserService extends BaseHomeService // 查询用户绑定的客服chat_uuid $customerChatUuid = ""; $customerChatName = ""; + $customerChatShowName = ""; if (!empty($info['customer_id'])) { - $customerChatInfo = UserChatLinkModel::where(['user_id' => $info['customer_id'], 'user_type' => UserChatLinkModel::USER_CHAT_LINK_USER_TYPE_ADMIN])->find(); + $customerChatInfo = UserChatLinkModel::with('admin')->where(['user_id' => $info['customer_id'], 'user_type' => UserChatLinkModel::USER_CHAT_LINK_USER_TYPE_ADMIN])->find(); if ($customerChatInfo) { $customerChatUuid = $customerChatInfo->chat_uuid; $customerChatName = $customerChatInfo->chat_name; + + // 客服显示名称 + $customerChatShowName = $customerChatInfo->admin->nick_name ?? $customerChatInfo->chat_name; } } // 获取当前用户代理创建的群聊信息 @@ -271,6 +275,7 @@ class UserService extends BaseHomeService 'user_chat_name' => $userChatName, 'customer_chat_uuid' => $customerChatUuid, 'customer_chat_name' => $customerChatName, + 'customer_chat_show_name' => $customerChatShowName, 'customer_chat_avatar' => '/bs/image/default.jpeg', 'group_chat_name' => $group_chat_name, 'group_chat_uuid' => $group_chat_uuid, diff --git a/app/model/UserChatLinkModel.php b/app/model/UserChatLinkModel.php index 5e6ad4e7..069c5ca7 100644 --- a/app/model/UserChatLinkModel.php +++ b/app/model/UserChatLinkModel.php @@ -1,8 +1,15 @@ belongsTo(AdminModel::class, 'user_id', 'id'); + } +}