这是码表
<h1>例如.</h1>
<pre><code>#消息列表
{
"cmd": 3,
"msg": "success",
"from_uid": null,
"from_user_type": null,
"to_uid": null,
"to_user_type": null,
"data": {
"total": 148,
"per_page": 20,
"current_page": 1,
"last_page": 8,
"data": [{
"from_uid": "16",
"from_user_type": 2,
"to_uid": "1",
"to_user_type": 1,
"content": "\u4f60\u597d",
"content_type": 1
}, {
"from_uid": "16",
"from_user_type": 2,
"to_uid": "1",
"to_user_type": 1,
"content": "\u4f60\u597d",
"content_type": 1
}]
},
"extra": null,
"time": null
}</code></pre>
<pre><code>#一条IM消息
{
"cmd": 1,
"msg": "success",
"from_uid": "16",
"from_user_type": "2",
"to_uid": "1",
"to_user_type": "1",
"data": {
"content": "\u6d4b\u8bd5\u5e38\u7528\u8bed\u6d4b\u8bd5\u5e38\u7528\u8bed\u6d4b\u8bd5\u5e38\u7528\u8bed\u6d4b\u8bd5\u5e38\u7528\u8bed9",
"content_type": "1"
},
"extra": null,
"time": 1555052268
}</code></pre>
<pre><code># 一条提示消息,提示验证通过
{
"cmd": 2,
"msg": "login_success",
"from_uid": null,
"from_user_type": null,
"to_uid": null,
"to_user_type": null,
"data": {
"content": "验证通过",
"content_type": 1
},
"extra": "",
"time": null
}</code></pre>
<h1>CMD字段</h1>
<pre><code> = 1;//消息发送
证明这是一条im消息
= 2;//系统提示
这是一个提示结合msg字段进行判断
默认msg为success不需要处理
= 3;//消息列表
证明这条消息返回的是消息列表
= 4;//详情接口
获取你和对方的详细信息
=5;//list_item
=6;//常用语列表</code></pre>
<h1>用户类型from_user_type,to_user_type</h1>
<pre><code>1:买家
2:卖家</code></pre>
<h1>消息类型content_type</h1>
<pre><code>= 1;//content-type 文字消息
= 2;//content-type 图片消息</code></pre>
<h1>MSG</h1>
<pre><code>success:默认succes
## 仅在CMD=2时才会出现以下msg
token_invalid:token无效
login_success: token验证成功(ws握手完成后返回)
miss_link:缺少link
error:出错时提示.
uid_error:发消息时to_uid错误</code></pre>