Browse Source

chore: 客服显示名称

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

7
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,

7
app/model/UserChatLinkModel.php

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