优化
This commit is contained in:
@@ -109,10 +109,70 @@ function messageRead(goeasy, userid) {
|
||||
});
|
||||
});
|
||||
}
|
||||
function sendCustomMessage(goeasy, type, userid, order, avatar, nickname) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var im = goeasy.im;
|
||||
var customMessage = im.createCustomMessage({
|
||||
type,
|
||||
//字符串,可以任意自定义类型
|
||||
payload: order,
|
||||
to: {
|
||||
type: common_vendor.jo.IM_SCENE.PRIVATE,
|
||||
//私聊还是群聊,群聊为GoEasy.IM_SCENE.GROUP
|
||||
id: userid,
|
||||
//接收方用户id
|
||||
data: { "avatar": avatar, "nickname": nickname }
|
||||
//好友扩展数据, 任意格式的字符串或者对象,用于更新会话列表conversation.data
|
||||
}
|
||||
});
|
||||
im.sendMessage({
|
||||
message: customMessage,
|
||||
onSuccess: function() {
|
||||
resolve(customMessage);
|
||||
},
|
||||
onFailed: function(error) {
|
||||
common_vendor.index.__f__("log", "at components/goEasyTool/tool.js:137", "Failed to send message,code:" + error.code + ",error" + error.content);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function conversationTop(goeasy, conversation, top) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var im = goeasy.im;
|
||||
im.topConversation({
|
||||
conversation,
|
||||
top,
|
||||
//或者 false
|
||||
onSuccess: function() {
|
||||
resolve("成功");
|
||||
},
|
||||
onFailed: function(error) {
|
||||
common_vendor.index.__f__("log", "at components/goEasyTool/tool.js:154", "失败:", error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function conversationDelete(goeasy, conversation) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var im = goeasy.im;
|
||||
im.removeConversation({
|
||||
conversation,
|
||||
onSuccess: function() {
|
||||
resolve("删除会话成功");
|
||||
},
|
||||
onFailed: function(error) {
|
||||
common_vendor.index.__f__("log", "at components/goEasyTool/tool.js:169", error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.conversationDelete = conversationDelete;
|
||||
exports.conversationTop = conversationTop;
|
||||
exports.getConversationList = getConversationList;
|
||||
exports.getConversationMessages = getConversationMessages;
|
||||
exports.goEasylogin = goEasylogin;
|
||||
exports.goEasylogout = goEasylogout;
|
||||
exports.messageRead = messageRead;
|
||||
exports.sendCustomMessage = sendCustomMessage;
|
||||
exports.sendMessage = sendMessage;
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/goEasyTool/tool.js.map
|
||||
|
||||
Reference in New Issue
Block a user