admin/addon/servicer/Readme.md

124 lines
4.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 客服插件说明文档
***
## 目前定义的消息类型
消息格式 { type': '消息类型关键字', data: { 消息数据体 }}
目前定义的消息类型:
| 类型标识 | 类型说明 | 发送方向 |
| :-----------: | :----------------------------------------: | :---------: |
| connect | 客户发起咨询,通知客服有客户接入 | 客户>>>会员 |
| string | 文本消息类型 | 双向 |
| order | 订单消息类型 | 双向 |
| goodssku | 商品消息类型 | 双向 |
| close | 客户或者客服主动下线时,回发给自己的消息 | 自身 |
| disconnect | 客户下线,发消息给客服 | 客户>>>会员 |
| force_offline | 客服多地登录时,新登录处向原登录处发送消息 | 客服>>>客服 |
***
## 服务开发说明文档
### 继续开发客户服务
+ 修改 新目录下 Events.php文件
只修改 onConnect 和 onClose 两个方法内逻辑onMessage方法由于采用的是GatewayClient不会触发
### 开发新的服务
+ 复制 gateway/Applications/Service目录为新的服务目录名
+ 修改 新目录下start_businessworker.php文件
```php
// worker名称
$worker->name = 'NiuShop_Service_Business_Worker';
```
+ 修改 新目录下 Events.php文件
只修改 onConnect 和 onClose 两个方法内逻辑onMessage方法由于采用的是GatewayClient不会触发
***
### 接口文档说明
#### 客服端接口
1. ***获取当前及历史联系人列表***
地址: servicer/servicer/index/index
参数:
* page 获取数据当前页数 *整形*
1. ***获取当前客服与指定会员的聊着天记录***
地址: servicer/servicer/index/dialogs
参数:
* member_id 当前会员ID
* page 当前页数
* limit 每页数据容量
2. ***获取当前会员详情***
地址: servicer/servicer/index/getMember
参数:
* member_id 当前会员ID
3. ***历史聊天会员列表***
地址: servicer/servicer/index/historyMembers
参数:
* page 当前页数
4. ***客服登录绑定通道***
地址: servicer/servicer/chat/bind
参数:
* client_id socket 会话临时ID
5. ***获取当前商户信息***
地址: servicer/servicer/chat/siteInfo
参数:
* site_id 商户ID
6. ***获取订单详情***
地址: servicer/servicer/chat/orderDetail
参数:
* order_id 商户ID
7. ***获取商品详情***
地址: servicer/servicer/chat/goodSkuDetial
参数:
* sku_id 商户ID
8. ***客服回答咨询问题***
地址: servicer/servicer/chat/answer
参数:
* member_id 当前会员ID
* content_type 消息类型
* servicer_say 文本内容
* goods_id 商品ID
* order_id 订单ID
9. ***客服主动下线***
地址: servicer/servicer/chat/bye
11. ***结束与某个客户的聊天***
地址: servicer/servicer/chat/closeMember
参数:
* member_id 当前会员ID
### 客户端接口
1. ***获取当前及历史联系人列表***
地址: servicer/api/chat/hasServicers
参数:
* site_id 商户ID
2. ***获取当前会员详情***
地址: servicer/api/chat/bind
参数:
* client_id socket 会话临时ID
* site_id 商户ID
3. ***获取当前商户信息***
地址: servicer/api/chat/siteInfo
参数:
* site_id 商户ID
4. ***获取订单详情***
地址: servicer/api/chat/orderDetail
参数:
* order_id 商户ID
5. ***获取商品详情***
地址: servicer/api/chat/goodSkuDetial
参数:
* sku_id 商户ID
6. ***客户咨询问题***
地址: servicer/api/chat/say
参数:
* member_id 当前会员ID
* message 消息类型
* servicer_say 文本内容
* goods_id 商品ID
* order_id 订单ID
* site_id 商户ID
7. ***获取当前客户与指定会员的聊着天记录***
地址: servicer/api/chat/dialogs
参数:
* member_id 当前会员ID
* page 当前页数
* limit 每页数据容量
8. ***客户主动下线***
地址: servicer/api/chat/bye