update
This commit is contained in:
+10
-10
@@ -26,8 +26,8 @@
|
||||
coop_api_url: null,
|
||||
// websocket 地址
|
||||
coop_ws_url: null,
|
||||
// 标记当前客户端(同一个IP可能打开多个浏览器,需要用client_id区分)
|
||||
client_id: null,
|
||||
// 标记当前客户端(同一个IP可能打开多个浏览器,需要用client_uuid区分)
|
||||
client_uuid: null,
|
||||
// 当前脑图ID
|
||||
coop_mind_id: null,
|
||||
// 上一次操作日志ID
|
||||
@@ -61,7 +61,7 @@
|
||||
},
|
||||
_init_properties: function (_jm) {
|
||||
// 设置属性
|
||||
this.client_id = Jm.util.uuid.newid()
|
||||
this.client_uuid = Jm.util.uuid.newid()
|
||||
this.coop_api_url = _jm.options.coop_api_url
|
||||
this.coop_ws_url = _jm.options.coop_ws_url
|
||||
this.coop_mind_id = _jm.options.coop_mind_id
|
||||
@@ -127,7 +127,7 @@
|
||||
* 构建公共参数
|
||||
*/
|
||||
_build_evt_param: function () {
|
||||
return {'client_id': this.client_id, 'log_uuid': Jm.util.uuid.newid(), 'coop_mind_id': this.coop_mind_id}
|
||||
return {'client_uuid': this.client_uuid, 'log_uuid': Jm.util.uuid.newid(), 'coop_mind_id': this.coop_mind_id}
|
||||
},
|
||||
// 调用jsmind接口
|
||||
_handle_jsmind_with_ws_message: function (message) {
|
||||
@@ -137,16 +137,16 @@
|
||||
// 处理消息广告方法
|
||||
_handle_msg_inner(msg_json, is_batch) {
|
||||
|
||||
// 校验 client_id
|
||||
const client_id = msg_json.client_id
|
||||
if (!client_id) {
|
||||
// 校验 client_uuid
|
||||
const client_uuid = msg_json.client_uuid
|
||||
if (!client_uuid) {
|
||||
return
|
||||
}
|
||||
const log_content = JSON.parse(msg_json.log_content)
|
||||
const log_id = msg_json.id
|
||||
if (log_id > this.coop_mind_log_id) {
|
||||
// 第一次批量获得日志和被动接收日志,设置coop_mind_log_last_id和coop_mind_log_id 相同,不进行批量保存快照
|
||||
if (is_batch || client_id !== this.client_id) {
|
||||
if (is_batch || client_uuid !== this.client_uuid) {
|
||||
this.coop_mind_log_last_id = log_id
|
||||
} else {
|
||||
// 设置 coop_mind_log_last_id 便于批量保存快照
|
||||
@@ -156,7 +156,7 @@
|
||||
}
|
||||
|
||||
// 回放
|
||||
if (client_id === this.client_id) {
|
||||
if (client_uuid === this.client_uuid) {
|
||||
console.log('self msg')
|
||||
} else {
|
||||
const evt = log_content.evt
|
||||
@@ -229,7 +229,7 @@
|
||||
me.timer_push_task = setInterval(function () {
|
||||
const param = {
|
||||
'data': Jm.util.json.json2string(me._jm.get_data('node_tree').data),
|
||||
'client_id': me.client_id,
|
||||
'client_uuid': me.client_uuid,
|
||||
'coop_mind_id': me.coop_mind_id,
|
||||
'coop_mind_log_id': me.coop_mind_log_id,
|
||||
'type': 'snapshot',
|
||||
|
||||
Reference in New Issue
Block a user