客服对接API
<p>[TOC]</p>
<h2>环境</h2>
<p>正式:<a href="http://sobot-kefu.idreamsky.com">http://sobot-kefu.idreamsky.com</a> 或者 <a href="https://sobot-kefu.idreamsky.com">https://sobot-kefu.idreamsky.com</a>
沙盒:<a href="http://sobot-sandbox-kefu.idreamsky.com">http://sobot-sandbox-kefu.idreamsky.com</a>
测试:<a href="http://192.168.5.183:9988">http://192.168.5.183:9988</a>
开发:<a href="http://192.168.118.110:9988">http://192.168.118.110:9988</a></p>
<h2>接口说明</h2>
<h4>1、游戏内,在线客服H5 (用浏览器打开以下地址即可连接客服)</h4>
<p>方法:GET
path: /{gameId}/sdk/onlineService ,其中gameId表示游戏ID, 即乐逗Gameid</p>
<p><strong>入参:</strong>
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/9de14bab5ec784e5fe9d9c3f6565fe3b?showdoc=.jpg" alt="" /></p>
<h4>2、自助提单</h4>
<p>方法:POST (以表单形式提交)</p>
<p>path: /{gameId}/sdk/ticket/create,其中gameId表示游戏ID, 即乐逗Gameid</p>
<p><strong>通用入参:</strong>
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/ef09c4ee95d6981ff161701ffb7724e3?showdoc=.jpg" alt="" /></p>
<p>1、网游-游戏问题 typeId = 1时
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/dc33e6190c5c4939804de1baf640c828?showdoc=.jpg" alt="" /></p>
<p>2、网游-充值问题 typeId = 2时
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/a6146351dae8a510eff2ec788a67c331?showdoc=.jpg" alt="" /></p>
<p>3、休闲-游戏问题 typeId = 3时
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/e0fb334284e13fb6b00c31b23d3993a0?showdoc=.jpg" alt="" /></p>
<p>4、休闲-充值问题 typeId = 4
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/715c0cfdee348d2dbcd386dcf2e516e7?showdoc=.jpg" alt="" /></p>
<p>5、休闲-bug反馈 typeId = 5时
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/0b3c2e1b0c3836d10c25a9c06a25b117?showdoc=.jpg" alt="" /></p>
<p>6、网游-bug反馈 typeId = 6时
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/eb01b74fb7296daebceafb309942e537?showdoc=.jpg" alt="" /></p>
<p><strong>回参:</strong></p>
<p>正常:</p>
<pre><code>{
"status": 0,
"message": "",
"data": {
"ticketId":"feji324jf114jisjafeaf"
}
}</code></pre>
<p>异常:</p>
<pre><code>{
"status": 1,
"message": "缺少必填字段gameName",
"data": null
}</code></pre>
<h4>3、查询工单列表</h4>
<p>方法:GET
path: /{gameId}/sdk/ticket/list,其中gameId表示游戏ID, 即乐逗Gameid</p>
<p><strong>入参:</strong>
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/f642ddb6a5c80f2c5be89ae35a732779?showdoc=.jpg" alt="" /></p>
<p><strong>回参:</strong>
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/6356bbf3008c90950db38663d52a3d8e?showdoc=.jpg" alt="" /></p>
<h4>4、查询某个工单详情</h4>
<p>方法:GET
path: /{gameId}/sdk/ticket/detail,其中gameId表示游戏ID, 即乐逗Gameid</p>
<p><strong>入参:</strong>
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/f7d57d35d9c88da82f65210d0810b735?showdoc=.jpg" alt="" /></p>
<p><strong>出参:</strong>
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/c7f471fc12d097d95b414b5adef129da?showdoc=.jpg" alt="" /></p>
<p><strong>回参示例:</strong></p>
<pre><code>{
"status": 0,
"message": "",
"data": {
"ticketTitle": "自助火攻3",
"replayList": [
{
"startType": 0,
"replyTime": 1570693534,
"fileStr": ""
},
{
"startType": 0,
"replyTime": 1570693531,
"replyContent": "<p>89</p>",
"fileStr": ""
}
],
"gameName": "梦工厂",
"ticketContent": "玛法糖dsaf儿阿股份热风个人无花果热狗惹我",
"replyContent": "<p>89</p>",
"ticketTypeName": "自助提单/网游-游戏问题",
"fileStr": "http://ww.baidu.com",
"ticketCode": 1557909492,
"mobile": "13058065807",
"updateTime": 1570693534,
"createTime": 1569502820,
"ticketStatus": 0,
"areaServer": "非",
"roleName": "积极",
"typeId": 1,
"ticketId": "4a60a11fe1884777b2d96f07dbe844c6",
"account": "23"
}
}</code></pre>
<h4>5、附件上传</h4>
<p>方法:POST</p>
<p>path: /{gameId}/sdk/ticket/uploadFile,其中gameId表示游戏ID, 即乐逗Gameid</p>
<p><strong>入参:</strong>
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/18775022b331699253bbe05182e3d402?showdoc=.jpg" alt="" /></p>
<p><strong>回参:</strong>
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/21128ef13d1919dd750f1b229902493b?showdoc=.jpg" alt="" /></p>
<pre><code>{
"status": 0,
"message": "",
"data": "http://zcsupport-dev.ids111.com/console/8c37aee8bd6d47579fa871d61ba67ec5/ticket/Desert_1569553040336.jpg"
}</code></pre>
<h2>签名规则</h2>
<p>签名key用游戏的乐逗appkey (与Gameid对应的), 需要将其配置在http://sobot-kefu.idreamsky.com/server/config 后台, 接入时请通知colby.luo或wiley.wang配置.如无配置以下步骤无法执行.</p>
<p><strong>例子:</strong></p>
<p>以乐逗gameid为12580的游戏, 请求 "在线客服" 接口 作为范例</p>
<p>0、该游戏的 游戏内IM 地址(正式环境) url: <a href="http://sobot-kefu.idreamsky.com/12580/sdk/onlineService">http://sobot-kefu.idreamsky.com/12580/sdk/onlineService</a></p>
<p>1、该url请求路径 path 为:/12580/sdk/onlineService</p>
<p>2、get参数pid=1519826793,timestamp=1568096156786 , 备注: 如上传的timestamp跟服务端时间(北京时间) 相差一个小时以上的, 将视为无效.主要是为了链接的安全性, 防止重放</p>
<p>3、先将所有请求参数名(除sign外)按字母顺序进行排序并拼接成querystring,得到querystring为:
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/951ed677011263785623daac919c9b3f?showdoc=.jpg" alt="" /></p>
<p>4、rawStr = path+"?"+ querystring 得到 :
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/e2bb63e365757da31284a70d9da3dfed?showdoc=.jpg" alt="" /></p>
<p>5、sign = md5(rawStr + key) = xxxxxxxxxxxxxxxxxxxx 算法说明: 使用32位md5</p>
<p>6、综上, 最终完整请求为(请求时参数无顺序要求)</p>
<p><img src="https://www.showdoc.cc/server/api/common/visitfile/sign/7dfbaf73831c8f3fb7e7ee0f3b488df9?showdoc=.jpg" alt="" /></p>
<p><strong>JAVA签名示例</strong></p>
<pre><code class="language-java">public static void main(String[] args) {
String key = "游戏appkey, 同时找colby.luo在后台配置";
String host = "localhost:9988";
String path = "/12580/sdk/onlineService";
String gameId = CaptureUtil.getGameId(path);
TreeMap<String, String> treeMap = new TreeMap<>();
treeMap.put("pid", "1519826793");
treeMap.put("timestamp", "" + System.currentTimeMillis());
StringBuilder rawStr = new StringBuilder(path).append("?");
treeMap.forEach((k, v) -> {
rawStr.append(k).append("=").append(v).append("&");
});
String toSignStr = rawStr.substring(0, rawStr.length() - 1);
String realSign = CommonUtil.toMd5HexString(toSignStr + key);
System.out.println(realSign);
}</code></pre>