def group_train_info(context): """获取社团训练所面板数据 1.当前已使用加速次数 2.被动加速次数 3.被加速日志 4.成员列表 """ ki_user = context.user group_id = ki_user.group.group_id if not judge_open_train(ki_user.sid, group_id): context.result['mc'] = MsgCode['UserModuleNotOpen'] return data = {} data["times"] = ki_user.daily_info.group_train_express_times data["times1"] = GroupService.get_train_pos_times(ki_user.sid, group_id, ki_user.uid) data["logs"] = GroupService.get_train_logs(ki_user.sid, group_id, ki_user.uid) data["members"] = GroupService.train_members(ki_user.sid, group_id, ki_user.uid) context.result["data"] = data
def help(context): """帮助其它社员加速 """ ki_user = context.user uid = context.get_parameter("uid") hero_id = context.get_parameter("hero_id") if not judge_open_train(ki_user.sid, ki_user.group.group_id): context.result['mc'] = MsgCode['UserModuleNotOpen'] return # 不能给自己加速啊!!! if ki_user.uid == uid: context.result['mc'] = MsgCode['ParamIllegal'] return if ki_user.daily_info.group_train_express_times >= GROUP_TRAIN_HELP_TIMES: context.result['mc'] = MsgCode['GroupTrainTimesMax'] return group_id = ki_user.group.group_id member_data = GroupService.get_member_info_by_uid(ki_user.sid, group_id, uid) # 检测目标是否在公会 if not member_data: context.result['mc'] = MsgCode['GroupMemberNotExist'] return user = User.get(uid) if not isinstance(user, User): context.result['mc'] = MsgCode['UserNotExist'] return else: helped_times = int( GroupService.get_train_pos_times(ki_user.sid, group_id, uid)) if helped_times >= GROUP_TRAIN_HELP_TIMES1: context.result['mc'] = MsgCode['GroupTrainHisTimesMax'] return if hero_id not in user.group.train_list: context.result['mc'] = MsgCode['GroupTrainHeroNotOn'] return GroupService.update_train_express_times(ki_user.sid, group_id, uid, hero_id, ki_user.name) user_logic.add_game_values(ki_user, {1: GROUP_TRAIN_HELP_GOLD}) ki_user.daily_info.group_train_express_times += 1 ki_user.daily_info.put() context.result['mc'] = MsgCode['GroupTrainHelpOtherSucc']
def help(context): """帮助其它社员加速 """ ki_user = context.user uid = context.get_parameter("uid") hero_id = context.get_parameter("hero_id") if not judge_open_train(ki_user.sid, ki_user.group.group_id): context.result['mc'] = MsgCode['UserModuleNotOpen'] return # 不能给自己加速啊!!! if ki_user.uid == uid: context.result['mc'] = MsgCode['ParamIllegal'] return if ki_user.daily_info.group_train_express_times >= GROUP_TRAIN_HELP_TIMES: context.result['mc'] = MsgCode['GroupTrainTimesMax'] return group_id = ki_user.group.group_id member_data = GroupService.get_member_info_by_uid(ki_user.sid, group_id, uid) # 检测目标是否在公会 if not member_data: context.result['mc'] = MsgCode['GroupMemberNotExist'] return user = User.get(uid) if not isinstance(user, User): context.result['mc'] = MsgCode['UserNotExist'] return else: helped_times = int(GroupService.get_train_pos_times(ki_user.sid, group_id, uid)) if helped_times >= GROUP_TRAIN_HELP_TIMES1: context.result['mc'] = MsgCode['GroupTrainHisTimesMax'] return if hero_id not in user.group.train_list: context.result['mc'] = MsgCode['GroupTrainHeroNotOn'] return GroupService.update_train_express_times(ki_user.sid, group_id, uid, hero_id, ki_user.name) user_logic.add_game_values(ki_user, {1: GROUP_TRAIN_HELP_GOLD}) ki_user.daily_info.group_train_express_times += 1 ki_user.daily_info.put() context.result['mc'] = MsgCode['GroupTrainHelpOtherSucc']