Browse Source

chore: 客服显示名称

master
liyang 19 hours ago
parent
commit
85aaf64a3c
  1. 7
      app/home/service/UserService.php
  2. 9
      app/model/UserChatLinkModel.php

7
app/home/service/UserService.php

@ -187,11 +187,15 @@ class UserService extends BaseHomeService
// 查询用户绑定的客服chat_uuid // 查询用户绑定的客服chat_uuid
$customerChatUuid = ""; $customerChatUuid = "";
$customerChatName = ""; $customerChatName = "";
$customerChatShowName = "";
if (!empty($info['customer_id'])) { 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) { if ($customerChatInfo) {
$customerChatUuid = $customerChatInfo->chat_uuid; $customerChatUuid = $customerChatInfo->chat_uuid;
$customerChatName = $customerChatInfo->chat_name; $customerChatName = $customerChatInfo->chat_name;
// 客服显示名称
$customerChatShowName = $customerChatInfo->admin->nick_name ?? $customerChatInfo->chat_name;
} }
} }
// 获取当前用户代理创建的群聊信息 // 获取当前用户代理创建的群聊信息
@ -271,6 +275,7 @@ class UserService extends BaseHomeService
'user_chat_name' => $userChatName, 'user_chat_name' => $userChatName,
'customer_chat_uuid' => $customerChatUuid, 'customer_chat_uuid' => $customerChatUuid,
'customer_chat_name' => $customerChatName, 'customer_chat_name' => $customerChatName,
'customer_chat_show_name' => $customerChatShowName,
'customer_chat_avatar' => '/bs/image/default.jpeg', 'customer_chat_avatar' => '/bs/image/default.jpeg',
'group_chat_name' => $group_chat_name, 'group_chat_name' => $group_chat_name,
'group_chat_uuid' => $group_chat_uuid, 'group_chat_uuid' => $group_chat_uuid,

9
app/model/UserChatLinkModel.php

@ -1,8 +1,15 @@
<?php <?php
namespace app\model; namespace app\model;
class UserChatLinkModel extends BaseModel class UserChatLinkModel extends BaseModel
{ {
const USER_CHAT_LINK_USER_TYPE_PC = 1; //h5,pc 用户 const USER_CHAT_LINK_USER_TYPE_PC = 1; //h5,pc 用户
const USER_CHAT_LINK_USER_TYPE_ADMIN = 2; // 管理端账号 const USER_CHAT_LINK_USER_TYPE_ADMIN = 2; // 管理端账号
protected $name = 'user_chat_link'; protected $name = 'user_chat_link';
}
public function admin()
{
return $this->belongsTo(AdminModel::class, 'user_id', 'id');
}
}

Loading…
Cancel
Save