send.js
787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
* 消息发送
* @author <qi.li@yoho.cn>
* @date 2017/03/13
*/
var uuid = require('uuid');
var chat = require('./chat');
var sockConf = require('./config');
var recTypes = sockConf.recType;
var conMSG = sockConf.conversationMessage;
/**
* 发送
* @param {msg} 消息体
*/
function _send(msg) {
chat.send(msg);
}
/**
* 图片发送
*/
exports.image = function(path) {
var IMG_TYPE = 2; // 图片消息
conMSG.type = recTypes.CU_SEND;
conMSG.chatMessage.content = path;
conMSG.chatMessage.type = IMG_TYPE;
conMSG.uuid = uuid.v4();
_send(conMSG);
};
/**
* 评价完成
*/
exports.completeEval = function() {
if (chat.isOpen()) {
conMSG.type = recTypes.EVAL_NOTICE;
conMSG.uuid = uuid.v4();
_send(conMSG);
}
};