import { InMsg } from '../in/InMsg' ; export abstract class OutMsg { protected toUserName : string ; protected fromUserName : string ; protected createTime : number ; /**
     *  被动响应消息类型
     *  1：text 文本消息
     *  2：image 图片消息
     *  3：voice 语音消息
     *  4：video 视频消息
     *  5：music 音乐消息
     *  6：news 图文消息
     */ protected msgType : string ; constructor ( inMsg ) { this . toUserName = inMsg . getFromUserName ; this . fromUserName = inMsg . getToUserName ; this . createTime = this . now ( ) ; } public toXml ( ) { let xmlContent = '<xml>\n<ToUserName><![CDATA[' + this . toUserName + ']]></ToUserName>\n' ; xmlContent += '<FromUserName><![CDATA[' + this . fromUserName + ']]></FromUserName>\n' ; xmlContent += '<CreateTime>' + this . createTime + '</CreateTime>\n' ; xmlContent += '<MsgType><![CDATA[' + this . msgType + ']]></MsgType>\n' ; return xmlContent ; } public now ( ) { return new Date ( ) . getTime ( ) ; } public get getToUserName ( ) : string { return this . toUserName ; } public set setToUserName ( toUserName ) { this . toUserName = toUserName ; } public get getFromUserName ( ) : string { return this . fromUserName ; } public set setFromUserName ( fromUserName ) { this . fromUserName = fromUserName ; } public get getCreateTime ( ) : number { return this . createTime ; } public set setCreateTime ( createTime ) { this . createTime = createTime ; } public get getMsgType ( ) : string { return this . msgType ; } public set setMsgType ( msgType ) { this . msgType = msgType ; } }