Пример #1
0
 def build_msg(self, msg):
     text = msg['content']
     user = msg['frm']
     sendu = msg['send']
     ttuser = msg['frm1']
     touser = msg['to']
     room = msg['room']
     msgs = Message(text)
     if msg["type"] == "ren":
         msgs.frm = wechatPerson(sendu, touser)
     else:
         msgs.frm = wechatRoomOccupant(userid=sendu, roomid=room)
     #self.usrname=ttuser
     if ttuser.startswith('@@'):
         #msgs.to=wechatPerson(userid=ttuser)
         msgs.to = WechatRoom(name=room)
         msgs.id = "group"
         log.info(msgs.to.name)
     else:
         msgs.to = wechatPerson(userid=ttuser)
         msgs.id = "user"
     msgs.send = sendu
     log.info('---------------- %s---------%s' % (msgs.to, msgs.frm))
     log.info('ssssssssssssssss %s' % msgs)
     log.info('ssssssssssssssss %s' % msgs.is_group)
     self.callback_message(msgs)