Authored by 李奇

消息预处理添加

/**
* 消息发送
* @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.text = 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);
};
... ...