本文整理汇总了Python中hall.entity.todotask.TodoTaskHelper.makeTodoTaskMsg方法的典型用法代码示例。如果您正苦于以下问题:Python TodoTaskHelper.makeTodoTaskMsg方法的具体用法?Python TodoTaskHelper.makeTodoTaskMsg怎么用?Python TodoTaskHelper.makeTodoTaskMsg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hall.entity.todotask.TodoTaskHelper
的用法示例。
在下文中一共展示了TodoTaskHelper.makeTodoTaskMsg方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sendFriendInviteTodotask
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import makeTodoTaskMsg [as 别名]
def sendFriendInviteTodotask(userId, invite_uid, gameId, play_mode, roomId, tableId, info_str, purl):
""" 推送牌桌好友邀请的todotask
* 版本 3.732 之后,改为麻将自己的todotask
"""
todotask = TodoTaskQuickStart(gameId, roomId, tableId)
todotask.setParam('play_mode', play_mode)
client_ver = sessiondata.getClientIdVer(userId)
if client_ver < 3.732:
show_info_ = TodoTaskShowInfo(info_str, True)
show_info_.setSubCmd(todotask)
msg = TodoTaskHelper.makeTodoTaskMsg(gameId, userId, show_info_)
router.sendToUser(msg, userId)
else:
task = {
'action': 'pop_wnd_invite',
'params': {
'tasks': [todotask.toDict()],
'invite_uid': invite_uid,
'purl': purl,
'info_str': info_str
}
}
mo = MsgPack()
mo.setCmd('majiang_todotasks')
mo.setResult('gameId', gameId)
mo.setResult('userId', userId)
mo.setResult('tasks', [task])
router.sendToUser(mo, userId)
示例2: doPutMessage
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import makeTodoTaskMsg [as 别名]
def doPutMessage(self, gameId, fromUid, toUid, mtype, msg, ismgr, scope, clientIds):
button = runhttp.getParamStr('button', None)
button = strutil.loads(button, ignoreException=True)
data = None
mo = MsgPack()
if mtype == 0 and len(msg) > 0 and toUid > 0 and gameId >= 0:
# 发送私人消息
# 必须参数
# 1)msg - 消息
# 2)toUid - 接收消息的userId
# 3)gameId
data = pkmessage.sendPrivate(gameId, toUid, fromUid, msg, button)
elif mtype == 1 and len(msg) > 0 and gameId >= 0:
# 发送站内消息到全体用户
# 必选参数
# msg - 消息
# gameId
data = pkmessage.sendGlobal(gameId, msg, button)
elif mtype == 2 and gameId > 0 and len(msg) > 0:
# 发送LED
# TODO 当前Game服务为4,5,6号 , 每个服务都发送
mo.setCmd('send_led')
mo.setParam('msg', msg)
mo.setParam('gameId', gameId)
mo.setParam('ismgr', 1)
router.sendToAll(mo, gdata.SRV_TYPE_UTIL)
data = True
elif mtype == 3 and gameId > 0 and toUid > 0 and len(msg) > 0:
# 封装popwnd
# 必选参数
# gameId
# toUid 接收弹窗的userId
# msg 弹窗消息内容
task = TodoTaskShowInfo(msg, True)
mo = TodoTaskHelper.makeTodoTaskMsg(gameId, toUid, task)
# 将消息发送给此人
router.sendToUser(mo, toUid)
data = True
elif mtype == 4 and gameId > 0 and len(msg) > 0 and len(scope) > 0:
mo.setCmd('send_led')
mo.setParam('msg', msg)
ftlog.info('send_led new msg=', msg)
mo.setParam('gameId', gameId)
ftlog.info('send_led new gameId=', gameId)
mo.setParam('ismgr', ismgr)
ftlog.info('send_led new ismgr=', ismgr)
mo.setParam('scope', scope)
ftlog.info('send_led new scope=', scope)
mo.setParam('clientIds', clientIds)
ftlog.info('send_led new clientIds=', clientIds)
router.sendToAll(mo, gdata.SRV_TYPE_UTIL)
data = True
if data == None:
mo.setError(1, 'params error')
else:
mo.setResult('ok', 'true')
return mo
示例3: sendTableInviteShareTodoTask
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import makeTodoTaskMsg [as 别名]
def sendTableInviteShareTodoTask(userId, gameId, tableNo, playMode, cardCount, contentStr):
'''牌桌上邀请处理
'''
shareId = hallshare.getShareId('mj_invite_play_share', userId, gameId)
if shareId:
share = hallshare.findShare(shareId)
if not share:
return
retDesc = ''
play_mode_dict = majiang_conf.get_room_other_config(gameId).get('playmode_desc_map', {})
if gameId == 715:
retDesc = contentStr;
else:
retDesc += play_mode_dict.get(playMode,'') if playMode else ''
retDesc += contentStr
ftlog.debug('sendTableInviteShareTodoTask last retDesc:', retDesc)
share.setDesc(retDesc)
if gameId == 715:
title = play_mode_dict.get(playMode,'') if playMode else ''
title += ' - 房号:' + tableNo
else:
title = share.title.getValue(userId, gameId)
title = '房间号:' + tableNo + ',' + title
share.setTitle(title)
ftlog.debug('sendTableInviteShareTodoTask newTitle:', title)
url = share.url.getValue(userId, gameId)
url += "?ftId=" + tableNo
url += "?from=magicWindow"
eParams = {}
eParams['action'] = 'hall_enter_friend_table_direct'
fParam = {}
fParam['ftId'] = tableNo
eParams['params'] = fParam
paramStr = json.dumps(eParams)
base64Str = base64.b64encode(paramStr)
from urllib import quote
url += "&enterParams=" + quote(base64Str)
share.setUrl(url)
ftlog.debug('sendTableInviteShareTodoTask newUrl:', url
, ' ftId:', tableNo
, ' paramStr:', paramStr
, ' base64Str:', base64Str)
todotask = share.buildTodotask(gameId, userId, 'mj_invite_play_share')
mo = TodoTaskHelper.makeTodoTaskMsg(gameId, userId, todotask)
router.sendToUser(mo, userId)
示例4: sendFriendInviteEnterGameTodotask
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import makeTodoTaskMsg [as 别名]
def sendFriendInviteEnterGameTodotask(userId, gameId, play_mode, roomId, tableId, info_str):
""" 构造从大厅主界面进桌子的todotask
"""
enter_param = {
'type': 'quickstart',
'pluginParams': {
'play_mode': play_mode,
'roomId': roomId,
'tableId': tableId,
'gameType': 9 # TODO: 写死了9,因为目前只有贵宾桌使用到了这个功能
}
}
todotask = TodoTaskEnterGameNew(gameId, enter_param)
show_info_ = TodoTaskShowInfo(info_str, True)
show_info_.setSubCmd(todotask)
msg = TodoTaskHelper.makeTodoTaskMsg(gameId, userId, show_info_)
router.sendToUser(msg, userId)
示例5: sendTableInviteShareTodoTask
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import makeTodoTaskMsg [as 别名]
def sendTableInviteShareTodoTask(userId, gameId, tableNo, playMode, cardCount, contentStr):
'''牌桌上邀请处理
'''
shareId = hallshare.getShareId('mj_invite_play_share', userId, gameId)
if shareId:
share = hallshare.findShare(shareId)
if not share:
return
retDesc = ''
play_mode_dict = majiang_conf.get_room_other_config(gameId).get('playmode_desc_map', {})
retDesc += play_mode_dict.get(playMode, '') if playMode else ''
retDesc += contentStr
ftlog.debug('sendTableInviteShareTodoTask last retDesc:', retDesc)
share.setDesc(retDesc)
title = share.title.getValue(userId, gameId)
title = '房间号:' + tableNo + ',' + title
share.setTitle(title)
todotask = share.buildTodotask(gameId, userId, 'mj_invite_play_share')
mo = TodoTaskHelper.makeTodoTaskMsg(gameId, userId, todotask)
router.sendToUser(mo, userId)
示例6: sendPopTipMsg
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import makeTodoTaskMsg [as 别名]
def sendPopTipMsg(userId, msg):
task = TodoTaskPopTip(msg)
task.setParam('duration', 3)
mo = TodoTaskHelper.makeTodoTaskMsg(HALL_GAMEID, userId, task)
router.sendToUser(mo, userId)
示例7: sendTodoTask
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import makeTodoTaskMsg [as 别名]
def sendTodoTask(self, gameId, userId, info):
task = TodoTaskShowInfo(info, True)
mo = TodoTaskHelper.makeTodoTaskMsg(gameId, userId, task)
router.sendToUser(mo, userId)