|
|
@@ -79,13 +79,13 @@ class SzyxPushClient { |
|
|
|
this.mapCall.delete(callId) |
|
|
|
} |
|
|
|
|
|
|
|
sendTextMsg(userId, text) { |
|
|
|
sendTextMsg(userId, text, describe) { |
|
|
|
return this.sendMessage({ |
|
|
|
toClientId: userId, messageType: MsgType.file, message: `{"text":"${text}"}` |
|
|
|
}) |
|
|
|
}, describe) |
|
|
|
} |
|
|
|
|
|
|
|
sendMessage(msg) { |
|
|
|
sendMessage(msg, describe) { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
let messageId = this.guid() |
|
|
|
let message = { |
|
|
@@ -96,6 +96,8 @@ class SzyxPushClient { |
|
|
|
timestamp: Date.now(), |
|
|
|
packetType: "SEND", ...msg |
|
|
|
} |
|
|
|
if (describe) |
|
|
|
message.describe = describe |
|
|
|
this._mapMsg.set(messageId, {call: resolve, message: message}) |
|
|
|
this._client.send(`/topic/server`, {}, JSON.stringify(message)) |
|
|
|
setTimeout(() => { |
|
|
@@ -223,8 +225,8 @@ const _connect = (res, resolve, reject) => { |
|
|
|
|
|
|
|
_imUser._account = '56465456' |
|
|
|
|
|
|
|
_imUser._userName = 'xuqm' |
|
|
|
_imUser._password = 'xuqm' |
|
|
|
_imUser._userName = _imUser._userId |
|
|
|
_imUser._password = _imUser._userId |
|
|
|
|
|
|
|
_imClient.connect(_imUser).then(() => resolve()).catch(error => reject(error)) |
|
|
|
|
|
|
@@ -232,11 +234,13 @@ const _connect = (res, resolve, reject) => { |
|
|
|
|
|
|
|
const SzyxPush = { |
|
|
|
_baseUrl: 'http://192.168.115.137:8888', setBaseUrl: function (url) { |
|
|
|
this._baseUrl = url |
|
|
|
if (url && url.startsWith('http')) |
|
|
|
this._baseUrl = url |
|
|
|
}, install: function (app, tenantNo, osType, url) { |
|
|
|
return this.init(tenantNo, osType, url) |
|
|
|
}, init: function (tenantNo, osType, url) { |
|
|
|
this._baseUrl = url |
|
|
|
if (url && url.startsWith('http')) |
|
|
|
this._baseUrl = url |
|
|
|
console.log(`${tenantNo}::${osType}`) |
|
|
|
_imUser._tenantNo = tenantNo |
|
|
|
_imClient.setDeviceType(osType) |
|
|
@@ -277,8 +281,8 @@ const SzyxPush = { |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, sendTextMsg: function (userId, text) { |
|
|
|
return _imClient.sendTextMsg(userId, text) |
|
|
|
}, sendTextMsg: function (userId, text, describe) { |
|
|
|
return _imClient.sendTextMsg(userId, text, describe) |
|
|
|
} |
|
|
|
}; |
|
|
|
export default SzyxPush |