mirror of
https://gitee.com/farsunset/cim.git
synced 2025-06-16 23:29:57 +08:00
修改SDK文档描述,删除无用的参数
This commit is contained in:
parent
b02d43af32
commit
fe788c50c0
@ -8,7 +8,6 @@ const CIM_URI = "ws://" + CIM_HOST + ":" + CIM_PORT;
|
||||
|
||||
const APP_VERSION = "1.0.0";
|
||||
const APP_CHANNEL = "web";
|
||||
const APP_PACKAGE = "com.farsunset.cim";
|
||||
|
||||
/*
|
||||
*特殊的消息类型,代表被服务端强制下线
|
||||
@ -70,7 +69,6 @@ CIMPushManager.bind = function (account) {
|
||||
body.getDataMap().set("channel", APP_CHANNEL);
|
||||
body.getDataMap().set("appVersion", APP_VERSION);
|
||||
body.getDataMap().set("osVersion", browser.version);
|
||||
body.getDataMap().set("packageName", APP_PACKAGE);
|
||||
body.getDataMap().set("deviceId", deviceId);
|
||||
body.getDataMap().set("deviceName", browser.name);
|
||||
body.getDataMap().set("language", navigator.language);
|
||||
|
@ -191,7 +191,6 @@ public class CIMPushManager {
|
||||
sent.put("deviceName", Build.MODEL);
|
||||
sent.put("appVersion", getVersionName(context));
|
||||
sent.put("osVersion", Build.VERSION.RELEASE);
|
||||
sent.put("packageName", context.getPackageName());
|
||||
sent.put("language", getLanguage());
|
||||
sent.setTimestamp(System.currentTimeMillis());
|
||||
sendRequest(context, sent);
|
||||
|
@ -8,7 +8,6 @@ const CIM_URI = "ws://" + CIM_HOST + ":" + CIM_PORT;
|
||||
|
||||
const APP_VERSION = "1.0.0";
|
||||
const APP_CHANNEL = "web";
|
||||
const APP_PACKAGE = "com.farsunset.cim";
|
||||
|
||||
/*
|
||||
*特殊的消息类型,代表被服务端强制下线
|
||||
@ -70,7 +69,6 @@ CIMPushManager.bind = function (account) {
|
||||
body.getDataMap().set("channel", APP_CHANNEL);
|
||||
body.getDataMap().set("appVersion", APP_VERSION);
|
||||
body.getDataMap().set("osVersion", browser.version);
|
||||
body.getDataMap().set("packageName", APP_PACKAGE);
|
||||
body.getDataMap().set("deviceId", deviceId);
|
||||
body.getDataMap().set("deviceName", browser.name);
|
||||
body.getDataMap().set("language", navigator.language);
|
||||
|
@ -8,7 +8,6 @@ const CIM_URI = "ws://" + CIM_HOST + ":" + CIM_PORT;
|
||||
|
||||
const APP_VERSION = "1.0.0";
|
||||
const APP_CHANNEL = "web";
|
||||
const APP_PACKAGE = "com.farsunset.cim";
|
||||
|
||||
/*
|
||||
*特殊的消息类型,代表被服务端强制下线
|
||||
@ -69,7 +68,6 @@ CIMPushManager.bind = function (account) {
|
||||
body.data.uid = account;
|
||||
body.data.channel = APP_CHANNEL;
|
||||
body.data.appVersion = APP_VERSION;
|
||||
body.data.packageName = APP_PACKAGE;
|
||||
body.data.deviceId = deviceId;
|
||||
body.data.deviceName = browser;
|
||||
|
||||
|
@ -8,7 +8,6 @@ const CIM_URI = "ws://" + CIM_HOST + ":" + CIM_PORT;
|
||||
|
||||
const APP_VERSION = "1.0.0";
|
||||
const APP_CHANNEL = "web";
|
||||
const APP_PACKAGE = "com.farsunset.cim";
|
||||
|
||||
/*
|
||||
*特殊的消息类型,代表被服务端强制下线
|
||||
@ -70,7 +69,6 @@ CIMPushManager.bind = function (account) {
|
||||
body.getDataMap().set("channel", APP_CHANNEL);
|
||||
body.getDataMap().set("appVersion", APP_VERSION);
|
||||
body.getDataMap().set("osVersion", browser.version);
|
||||
body.getDataMap().set("packageName", APP_PACKAGE);
|
||||
body.getDataMap().set("deviceId", deviceId);
|
||||
body.getDataMap().set("deviceName", browser.name);
|
||||
body.getDataMap().set("language", navigator.language);
|
||||
|
@ -1,4 +1,8 @@
|
||||
#微信小程序客户端代码示例
|
||||
```
|
||||
createWebsocketConnection()中设置当前账号和终端ID
|
||||
body.data.uid = '10000';//设置你的用户ID
|
||||
```
|
||||
|
||||
该示例使用json编解码策略,没有使用protobuf,所以服务端需要设置消息编码格式为json
|
||||
|
||||
|
@ -59,7 +59,7 @@ let self;
|
||||
body.data = {};
|
||||
body.data.uid = '10000';//设置你的用户ID
|
||||
body.data.channel = 'wechat';
|
||||
body.data.deviceId = '这里自己创建一个保存到本地的UUID';
|
||||
body.data.deviceId = getDeivceId();
|
||||
body.data.appVersion = '1.0.0';
|
||||
body.data.osVersion = wx.getSystemInfoSync().version;
|
||||
body.data.deviceName = wx.getSystemInfoSync().platform;
|
||||
@ -115,6 +115,24 @@ let self;
|
||||
if(websocketTask != null && websocketTask != undefined){
|
||||
websocketTask.close({code:1000,reason:"FINISH"});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getDeivceId() {
|
||||
let deviceId = wx.getStorageSync('x-device-id');
|
||||
if(deviceId != undefined && deviceId != ''){
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
let d = new Date().getTime();
|
||||
let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||
let r = (d + Math.random() * 16) % 16 | 0;
|
||||
d = Math.floor(d / 16);
|
||||
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
|
||||
});
|
||||
|
||||
let newDeviceId = uuid.replace(/-/g, '');
|
||||
wx.setStorageSync('x-device-id', newDeviceId);
|
||||
return newDeviceId;
|
||||
}
|
||||
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user