def doGetPrize(self, gameId, userId, clientId): try: timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) if not status.isBindMobile: conf = neituiguang.getConf() TodoTaskHelper.sendTodoTask( gameId, userId, TodoTaskBindPhone(conf.pleaseBindPhone, '')) return count, assetList = neituiguang.getAllReward(status) if count > 0: conf = neituiguang.getConf() prizeRewardTips = strutil.replaceParams( conf.prizeRewardTips, { 'rewardContent': TYAssetUtils.buildContentsString(assetList) }) TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskGoldRain(prizeRewardTips)) mo = self.buildQueryPrizeResponse(gameId, userId, clientId) router.sendToUser(mo, userId) else: TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskShowInfo('奖励已经领取', True)) datachangenotify.sendDataChangeNotify(gameId, userId, ['free', 'promotion_loc']) except TYBizException, e: TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskShowInfo(e.message, True))
def doCancelCodeCheck(self, gameId, userId, clientId): ''' 取消code_check ''' try: timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) neituiguang.setInviter(status, 0) ftlog.hinfo('neituiguang.statics eventId=', 'CANCEL_INPUT_PRMOTE_CODE', 'userId=', userId, 'clientId=', clientId, 'result=', 'ok') mo = MsgPack() mo.setCmd('promote_info') mo.setResult('action', 'cancel_code_check') mo.setResult('code', 0) router.sendToUser(mo, userId) except Exception, e: if not isinstance(e, TYBizException): ftlog.error() ec, info = (e.errorCode, e.message) if isinstance(e, TYBizException) else (-1, '系统错误') ftlog.hinfo('neituiguang.statics eventId=', 'CANCEL_INPUT_PRMOTE_CODE', 'userId=', userId, 'clientId=', clientId, 'result=', 'failed') router.sendToUser(self.makeErrorResponse('cancel_code_check', ec, info), userId)
def doCancelCodeCheck(self, gameId, userId, clientId): ''' 取消code_check ''' try: timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) neituiguang.setInviter(status, 0) ftlog.hinfo('neituiguang.statics eventId=', 'CANCEL_INPUT_PRMOTE_CODE', 'userId=', userId, 'clientId=', clientId, 'result=', 'ok') mo = MsgPack() mo.setCmd('promote_info') mo.setResult('action', 'cancel_code_check') mo.setResult('code', 0) router.sendToUser(mo, userId) except Exception, e: if not isinstance(e, TYBizException): ftlog.error() ec, info = (e.errorCode, e.message) if isinstance( e, TYBizException) else (-1, '系统错误') ftlog.hinfo('neituiguang.statics eventId=', 'CANCEL_INPUT_PRMOTE_CODE', 'userId=', userId, 'clientId=', clientId, 'result=', 'failed') router.sendToUser( self.makeErrorResponse('cancel_code_check', ec, info), userId)
def testGetPrize(self): handler = NeiTuiGuangTcpHandler() createTime = datetime.now( ) # datetime.strptime('2015-12-22 18:20:00.0', '%Y-%m-%d %H:%M:%S.%f') userdata.setAttr(self.userId, 'createTime', createTime.strftime('%Y-%m-%d %H:%M:%S.%f')) userdata.setAttr(self.inviteeUserId, 'createTime', createTime.strftime('%Y-%m-%d %H:%M:%S.%f')) createTime -= timedelta(days=8) userdata.setAttr(self.userId, 'createTime', createTime.strftime('%Y-%m-%d %H:%M:%S.%f')) gamedata.delGameAttr(self.userId, self.gameId, 'neituiguang') gamedata.delGameAttr(self.inviteeUserId, self.gameId, 'neituiguang') handler.doQueryPrize(self.gameId, self.userId, self.clientId) timestamp = pktimestamp.getCurrentTimestamp() handler.doCheckCode(self.gameId, self.inviteeUserId, self.clientId, self.userId) neituiguang_remote.onInvitationAccepted(self.userId, self.inviteeUserId) status = neituiguang.loadStatus(self.userId, timestamp) neituiguang.onNotifyInviterOk(status) handler.doQueryPrize(self.gameId, self.userId, self.clientId) handler.doGetPrize(self.gameId, self.userId, self.clientId)
def get_invitee(userId): """ @param userId: @return: 获取userId的下线,列表,[{'uid': uid}, ...] """ timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) return status.encodeInvitee()
def get_invitee(userId): """ @param userId: @return: 获取userId的下线,列表,[{'uid': uid}, ...] """ timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) return status.encodeInvitee()
def get_inviter(userId): """ @param userId: @return: 获取userId的上线,uid,0就是没有 """ timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) inviter = status.inviter return inviter.userId if inviter else 0
def get_inviter(userId): """ @param userId: @return: 获取userId的上线,uid,0就是没有 """ timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) inviter = status.inviter return inviter.userId if inviter else 0
def doCheckCode(self, gameId, userId, clientId, promoteCode): ''' 确立推广关系,也就是领取红包 校验通过 设置推荐人 将用户加到推荐人的推广员名单里 ''' try: timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) # 检查是否能成为推荐人 # 转到promoteCode所在的UT进程中去处理 ec, info = neituiguang_remote.canBeInviter(promoteCode, userId) if ec != 0: raise NeituiguangException(ec, info) # 设置推荐人 neituiguang.setInviter(status, promoteCode) try: # 添加invitee,此处不需要处理失败的情况,前面已经检查了 ec, info = neituiguang_remote.addInvitee( promoteCode, userId, status.isBindMobile) if ec != 0: ftlog.warn('NeiTuiGuangTcpHandler.doCheckCode gameId=', gameId, 'userId=', userId, 'clientId=', clientId, 'promoteCode=', promoteCode, 'call=', 'neituiguang_remote.addInvitee', 'ec=', ec, 'info=', info) except: ftlog.error('NeiTuiGuangTcpHandler.doCheckCode gameId=', gameId, 'userId=', userId, 'clientId=', clientId, 'promoteCode=', promoteCode, 'call=', 'neituiguang_remote.addInvitee', 'ec=', ec, 'info=', info) ftlog.hinfo('neituiguang.statics eventId=', 'INPUT_PRMOTE_CODE', 'userId=', userId, 'clientId=', clientId, 'promoteCode=', promoteCode, 'result=', 'ok') mo = MsgPack() mo.setCmd('promote_info') mo.setResult('action', 'code_check') mo.setResult('code', 0) router.sendToUser(mo, userId) except Exception, e: if not isinstance(e, TYBizException): ftlog.error() ec, info = (e.errorCode, e.message) if isinstance( e, TYBizException) else (-1, '系统错误') ftlog.hinfo('neituiguang.statics eventId=', 'INPUT_PRMOTE_CODE', 'userId=', userId, 'clientId=', clientId, 'promoteCode=', promoteCode, 'result=', 'failed', 'ec=', ec, 'info=', info) router.sendToUser(self.makeErrorResponse('code_check', ec, info), userId)
def doListInvitee(self, gameId, userId, clientId): timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) invitee = status.encodeInvitee() mo = MsgPack() mo.setCmd('promote_info') mo.setResult('action', 'list_invitee') mo.setResult('invitee', invitee) router.sendToUser(mo, userId)
def canBeInviter(userId, invitee): try: if not userdata.checkUserData(userId): raise BadInviterException('口令错误') timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) neituiguang.ensureCanBeInviter(status, invitee) return 0, None except NeituiguangException, e: return e.errorCode, e.message
def canBeInviter(userId, invitee): try: if not userdata.checkUserData(userId): raise BadInviterException('口令错误') timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) neituiguang.ensureCanBeInviter(status, invitee) return 0, None except NeituiguangException, e: return e.errorCode, e.message
def doListInvitee(self, gameId, userId, clientId): timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) invitee = status.encodeInvitee() mo = MsgPack() mo.setCmd('promote_info') mo.setResult('action', 'list_invitee') mo.setResult('invitee', invitee) router.sendToUser(mo, userId)
def doQueryState(self, gameId, userId, clientId): ''' 内推广状态查询 ''' timestamp = pktimestamp.getCurrentTimestamp() mo = MsgPack() mo.setCmd('promote_info') mo.setResult('action', 'query_state') status = neituiguang.loadStatus(userId, timestamp) mo.setResult('state', self.translateState(status)) router.sendToUser(mo, userId)
def doQueryState(self, gameId, userId, clientId): ''' 内推广状态查询 ''' timestamp = pktimestamp.getCurrentTimestamp() mo = MsgPack() mo.setCmd('promote_info') mo.setResult('action', 'query_state') status = neituiguang.loadStatus(userId, timestamp) mo.setResult('state', self.translateState(status)) router.sendToUser(mo, userId)
def onInvitationAccepted(userId, invitee): try: if not userdata.checkUserData(userId): raise BadInviterException('用户不存在') timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) invitation = status.findInvitee(invitee) if invitation: neituiguang.onInvitationAccepted(status, invitation) return 0, None except NeituiguangException, e: return e.errorCode, e.message
def onInvitationAccepted(userId, invitee): try: if not userdata.checkUserData(userId): raise BadInviterException('用户不存在') timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) invitation = status.findInvitee(invitee) if invitation: neituiguang.onInvitationAccepted(status, invitation) return 0, None except NeituiguangException, e: return e.errorCode, e.message
def buildQueryPrizeResponse(cls, gameId, userId, clientId): timestamp = pktimestamp.getCurrentTimestamp() conf = neituiguang.getConf() status = neituiguang.loadStatus(userId, timestamp) totalRewardCount = cls.calcTotalInvitationByState( status, Invitation.STATE_REWARD) availableRewardCount = cls.calcTotalInvitationByState( status, Invitation.STATE_ACCEPT) mo = MsgPack() mo.setCmd('promote_info') mo.setResult('action', 'query_prize') mo.setResult('detail', conf.prizeDetail) mo.setResult('imgUrl', conf.prizeImgUrl) mo.setResult('promoteCode', userId) shareId = hallshare.getShareId('neituiguang2', userId, gameId) share = hallshare.findShare(shareId) if share: mo.setResult('shareId', shareId) mo.setResult('shareLoc', conf.shareLoc) mo.setResult('weixinInviteDoc', share.getDesc(HALL_GAMEID, userId)) mo.setResult('weixinInviteUrl', share.getUrl(HALL_GAMEID, userId)) mo.setResult('smsInviteDoc', share.getSmsDesc(HALL_GAMEID, userId)) totalRewardContent = '' if conf.prizeRewardItem: totalRewardContent = hallitem.buildContent( conf.prizeRewardItem.assetKindId, conf.prizeRewardItem.count * totalRewardCount) prizeGetedInfo = conf.prizeGotTotalRewardDesc if conf.prizeRewardItem and totalRewardCount else conf.prizeNotGotRewardDesc prizeGetedInfo = strutil.replaceParams( prizeGetedInfo, {'totalRewardContent': totalRewardContent}) mo.setResult('prizeGetedInfo', prizeGetedInfo) availableRewardContent = '' if conf.prizeRewardItem: availableRewardContent = hallitem.buildContent( conf.prizeRewardItem.assetKindId, conf.prizeRewardItem.count * availableRewardCount) prizeAvailableInfo = conf.prizeAvailableRewardDesc if conf.prizeRewardItem else conf.prizeAvailableRewardDesc prizeAvailableInfo = strutil.replaceParams( prizeAvailableInfo, {'availableRewardContent': availableRewardContent}) mo.setResult('prizeAvailableInfo', prizeAvailableInfo) prizeList = [] invitationList = sorted(status.inviteeMap.values(), key=lambda i: i.index) for invitation in invitationList: prizeList.append(cls.encodeInvitation(invitation)) mo.setResult('prizeList', prizeList) mo.setResult('state', 1 if availableRewardCount > 0 else 0) return mo
def addInvitee(userId, invitee, accepted): try: if not userdata.checkUserData(userId): raise BadInviterException('用户不存在') timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) if not status.findInvitee(invitee): if status.inviteeCount: pass neituiguang.addInvitee(status, invitee, accepted) return 0, None except NeituiguangException, e: return e.errorCode, e.message
def addInvitee(userId, invitee, accepted): try: if not userdata.checkUserData(userId): raise BadInviterException('用户不存在') timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) if not status.findInvitee(invitee): if status.inviteeCount: pass neituiguang.addInvitee(status, invitee, accepted) return 0, None except NeituiguangException, e: return e.errorCode, e.message
def _loadTaskModel(self, userTaskUnit, timestamp): ftlog.debug('NewUserTaskSystem._loadTaskModel userId=', userTaskUnit.userId, 'taskIds=', [task.kindId for task in userTaskUnit.taskList]) taskModel = NewUserTaskModel(self, userTaskUnit) if not taskModel.userTaskUnit.taskList: status = neituiguang.loadStatus(userTaskUnit.userId, timestamp) # 根据用户状态初始化任务 if status.inviter and status.isNewUser: ftlog.info('NewUserTaskSystem._loadTaskModel userId=', userTaskUnit.userId, 'inviter=', status.inviter.userId) poolIndex = 0 if status.inviter.userId == 0 else 1 init = taskModel.initTasksIfNeed(poolIndex, timestamp) if init: datachangenotify.sendDataChangeNotify(HALL_GAMEID, userTaskUnit.userId, ['free', 'promotion_loc']) return taskModel
def buildQueryPrizeResponse(cls, gameId, userId, clientId): timestamp = pktimestamp.getCurrentTimestamp() conf = neituiguang.getConf() status = neituiguang.loadStatus(userId, timestamp) totalRewardCount = cls.calcTotalInvitationByState(status, Invitation.STATE_REWARD) availableRewardCount = cls.calcTotalInvitationByState(status, Invitation.STATE_ACCEPT) mo = MsgPack() mo.setCmd('promote_info') mo.setResult('action', 'query_prize') mo.setResult('detail', conf.prizeDetail) mo.setResult('imgUrl', conf.prizeImgUrl) mo.setResult('promoteCode', userId) shareId = hallshare.getShareId('neituiguang2', userId, gameId) share = hallshare.findShare(shareId) if share: mo.setResult('shareId', shareId) mo.setResult('shareLoc', conf.shareLoc) mo.setResult('weixinInviteDoc', share.getDesc(HALL_GAMEID, userId)) mo.setResult('weixinInviteUrl', share.getUrl(HALL_GAMEID, userId)) mo.setResult('smsInviteDoc', share.getSmsDesc(HALL_GAMEID, userId)) totalRewardContent = '' if conf.prizeRewardItem: totalRewardContent = hallitem.buildContent(conf.prizeRewardItem.assetKindId, conf.prizeRewardItem.count * totalRewardCount) prizeGetedInfo = conf.prizeGotTotalRewardDesc if conf.prizeRewardItem and totalRewardCount else conf.prizeNotGotRewardDesc prizeGetedInfo = strutil.replaceParams(prizeGetedInfo, {'totalRewardContent': totalRewardContent}) mo.setResult('prizeGetedInfo', prizeGetedInfo) availableRewardContent = '' if conf.prizeRewardItem: availableRewardContent = hallitem.buildContent(conf.prizeRewardItem.assetKindId, conf.prizeRewardItem.count * availableRewardCount) prizeAvailableInfo = conf.prizeAvailableRewardDesc if conf.prizeRewardItem else conf.prizeAvailableRewardDesc prizeAvailableInfo = strutil.replaceParams(prizeAvailableInfo, {'availableRewardContent': availableRewardContent}) mo.setResult('prizeAvailableInfo', prizeAvailableInfo) prizeList = [] invitationList = sorted(status.inviteeMap.values(), key=lambda i: i.index) for invitation in invitationList: prizeList.append(cls.encodeInvitation(invitation)) mo.setResult('prizeList', prizeList) mo.setResult('state', 1 if availableRewardCount > 0 else 0) return mo
def _loadTaskModel(self, userTaskUnit, timestamp): ftlog.debug('NewUserTaskSystem._loadTaskModel userId=', userTaskUnit.userId, 'taskIds=', [task.kindId for task in userTaskUnit.taskList]) taskModel = NewUserTaskModel(self, userTaskUnit) if not taskModel.userTaskUnit.taskList: status = neituiguang.loadStatus(userTaskUnit.userId, timestamp) # 根据用户状态初始化任务 if status.inviter and status.isNewUser: ftlog.info('NewUserTaskSystem._loadTaskModel userId=', userTaskUnit.userId, 'inviter=', status.inviter.userId) poolIndex = 0 if status.inviter.userId == 0 else 1 init = taskModel.initTasksIfNeed(poolIndex, timestamp) if init: datachangenotify.sendDataChangeNotify( HALL_GAMEID, userTaskUnit.userId, ['free', 'promotion_loc']) return taskModel
def testGetPrize(self): handler = NeiTuiGuangTcpHandler() createTime = datetime.now()# datetime.strptime('2015-12-22 18:20:00.0', '%Y-%m-%d %H:%M:%S.%f') userdata.setAttr(self.userId, 'createTime', createTime.strftime('%Y-%m-%d %H:%M:%S.%f')) userdata.setAttr(self.inviteeUserId, 'createTime', createTime.strftime('%Y-%m-%d %H:%M:%S.%f')) createTime -= timedelta(days=8) userdata.setAttr(self.userId, 'createTime', createTime.strftime('%Y-%m-%d %H:%M:%S.%f')) gamedata.delGameAttr(self.userId, self.gameId, 'neituiguang') gamedata.delGameAttr(self.inviteeUserId, self.gameId, 'neituiguang') handler.doQueryPrize(self.gameId, self.userId, self.clientId) timestamp = pktimestamp.getCurrentTimestamp() handler.doCheckCode(self.gameId, self.inviteeUserId, self.clientId, self.userId) neituiguang_remote.onInvitationAccepted(self.userId, self.inviteeUserId) status = neituiguang.loadStatus(self.userId, timestamp) neituiguang.onNotifyInviterOk(status) handler.doQueryPrize(self.gameId, self.userId, self.clientId) handler.doGetPrize(self.gameId, self.userId, self.clientId)
def on_get_friend_list(cls, uid, mo): page = max(1, mo.getResult('page', 1)) # 分页请求,数据太大,超63k了 friend_requests = mo.getResult('friend_list') begin_idx = (page - 1) * 100 total = len(friend_requests) mo.setResult('friend_cnt', total) if total <= begin_idx: mo.setResult('friend_list', []) return timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(uid, timestamp) for info in friend_requests: if info.get('is_request', 0): continue # 填充密友 fid = int(info['uid']) # if status.inviter == fid or fid in status.inviteeMap else 0 info['close'] = 1 if fid in status.inviteeMap else 0 friend_requests.sort(key=cls._friend_list_order) mo.setResult('friend_list', friend_requests[begin_idx:begin_idx + 100])
def on_get_friend_list(cls, uid, mo): page = max(1, mo.getResult('page', 1)) # 分页请求,数据太大,超63k了 friend_requests = mo.getResult('friend_list') begin_idx = (page - 1) * 100 total = len(friend_requests) mo.setResult('friend_cnt', total) if total <= begin_idx: mo.setResult('friend_list', []) return timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(uid, timestamp) for info in friend_requests: if info.get('is_request', 0): continue # 填充密友 fid = int(info['uid']) # if status.inviter == fid or fid in status.inviteeMap else 0 info['close'] = 1 if fid in status.inviteeMap else 0 friend_requests.sort(key=cls._friend_list_order) mo.setResult('friend_list', friend_requests[begin_idx:begin_idx + 100])
def set_inviter(userId, inviter): """ @param userId: @param inviter: @return: 设置userId的上线为inviter """ try: timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) # 检查是否能成为推荐人 # 转到promoteCode所在的UT进程中去处理 ec, info = canBeInviter(inviter, userId) if ec != 0: raise NeituiguangException(ec, info) # 设置推荐人 neituiguang.setInviter(status, inviter) # 添加invitee,此处不需要处理失败的情况,前面已经检查了 return addInvitee(inviter, userId, status.isBindMobile) except NeituiguangException, e: return e.errorCode, e.message
def set_inviter(userId, inviter): """ @param userId: @param inviter: @return: 设置userId的上线为inviter """ try: timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) # 检查是否能成为推荐人 # 转到promoteCode所在的UT进程中去处理 ec, info = canBeInviter(inviter, userId) if ec != 0: raise NeituiguangException(ec, info) # 设置推荐人 neituiguang.setInviter(status, inviter) # 添加invitee,此处不需要处理失败的情况,前面已经检查了 return addInvitee(inviter, userId, status.isBindMobile) except NeituiguangException, e: return e.errorCode, e.message
def doGetPrize(self, gameId, userId, clientId): try: timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) if not status.isBindMobile: conf = neituiguang.getConf() TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskBindPhone(conf.pleaseBindPhone, '')) return count, assetList = neituiguang.getAllReward(status) if count > 0: conf = neituiguang.getConf() prizeRewardTips = strutil.replaceParams(conf.prizeRewardTips, {'rewardContent': TYAssetUtils.buildContentsString(assetList)}) TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskGoldRain(prizeRewardTips)) mo = self.buildQueryPrizeResponse(gameId, userId, clientId) router.sendToUser(mo, userId) else: TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskShowInfo('奖励已经领取', True)) datachangenotify.sendDataChangeNotify(gameId, userId, ['free', 'promotion_loc']) except TYBizException, e: TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskShowInfo(e.message, True))
def doCheckCode(self, gameId, userId, clientId, promoteCode): ''' 确立推广关系,也就是领取红包 校验通过 设置推荐人 将用户加到推荐人的推广员名单里 ''' try: timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) # 检查是否能成为推荐人 # 转到promoteCode所在的UT进程中去处理 ec, info = neituiguang_remote.canBeInviter(promoteCode, userId) if ec != 0: raise NeituiguangException(ec, info) # 设置推荐人 neituiguang.setInviter(status, promoteCode) try: # 添加invitee,此处不需要处理失败的情况,前面已经检查了 ec, info = neituiguang_remote.addInvitee(promoteCode, userId, status.isBindMobile) if ec != 0: ftlog.warn('NeiTuiGuangTcpHandler.doCheckCode gameId=', gameId, 'userId=', userId, 'clientId=', clientId, 'promoteCode=', promoteCode, 'call=', 'neituiguang_remote.addInvitee', 'ec=', ec, 'info=', info) except: ftlog.error('NeiTuiGuangTcpHandler.doCheckCode gameId=', gameId, 'userId=', userId, 'clientId=', clientId, 'promoteCode=', promoteCode, 'call=', 'neituiguang_remote.addInvitee', 'ec=', ec, 'info=', info) ftlog.hinfo('neituiguang.statics eventId=', 'INPUT_PRMOTE_CODE', 'userId=', userId, 'clientId=', clientId, 'promoteCode=', promoteCode, 'result=', 'ok') mo = MsgPack() mo.setCmd('promote_info') mo.setResult('action', 'code_check') mo.setResult('code', 0) router.sendToUser(mo, userId) except Exception, e: if not isinstance(e, TYBizException): ftlog.error() ec, info = (e.errorCode, e.message) if isinstance(e, TYBizException) else (-1, '系统错误') ftlog.hinfo('neituiguang.statics eventId=', 'INPUT_PRMOTE_CODE', 'userId=', userId, 'clientId=', clientId, 'promoteCode=', promoteCode, 'result=', 'failed', 'ec=', ec, 'info=', info) router.sendToUser(self.makeErrorResponse('code_check', ec, info), userId)
def neituiguang_get_invitee(self, userId): timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) return status.encodeInvitee()
def neituiguang_get_invitee(self, userId): timestamp = pktimestamp.getCurrentTimestamp() status = neituiguang.loadStatus(userId, timestamp) return status.encodeInvitee()