def trig(self): ac_record = ActivityConditionRecord(self.char_id, self.CONDITION_ID, self.activity_time) if ac_record.in_send(): return value = self.get_current_value(self.char_id) if value < self.CONDITION_VALUE: return p = BasePurchaseAction(self.char_id) p.send_reward_yueka(purchase_notify=False) m = Mail(self.char_id) m.add("获得月卡", "您的累积充值已经达到了300元宝,获得了活动月卡奖励,300元宝的额外奖励已经放入您的帐号之中,请注意查收。从明天开始,接下来的30天,您将会每天获得100元宝。") ac_record.add_send()
def set_yueka(signum): logger = Logger('set_yueka.log') logger.write("Start") records = MongoPurchaseRecord.objects.filter(yueka_remained_days__gt=0) for record in records: if record.yueka_remained_days > 0: # 发送奖励,并且days-1 send_yueka_reward(record.id, record.yueka_sycee, record.yueka_remained_days-1) pa = BasePurchaseAction(record.id) try: pa.set_yueka_remained_days(-1) except YuekaLockTimeOut: logger.error(traceback.format_exc()) logger.write("Done") logger.close()
def trig(self, *args): ac_record = ActivityConditionRecord(self.char_id, self.CONDITION_ID, self.activity_time) send_times = ac_record.send_times() value = self.get_current_value(self.char_id) times, _ = divmod(value, self.CONDITION_VALUE) if times <= send_times: return for i in range(times - send_times): p = BasePurchaseAction(self.char_id) p.send_reward_yueka(purchase_notify=False, as_vip_exp=False) m = Mail(self.char_id) m.add( "获得月卡", "您的累积充值已经达到了300元宝,获得了活动月卡奖励,300元宝的额外奖励已经放入您的帐号之中,请注意查收。从明天开始,接下来的30天,您将会每天获得100元宝。" ) ac_record.add_send(times=times-send_times)
def set_yueka(signum): logger = Logger('set_yueka.log') logger.write("Start") records = MongoPurchaseRecord.objects.filter(yueka_remained_days__gt=0) for record in records: if record.yueka_remained_days > 0: # 发送奖励,并且days-1 send_yueka_reward(record.id, record.yueka_sycee, record.yueka_remained_days - 1) pa = BasePurchaseAction(record.id) try: pa.set_yueka_remained_days(-1) except YuekaLockTimeOut: logger.error(traceback.format_exc()) logger.write("Done") logger.close()
def purchase_self(request): # 自身充值 try: char_id = int(request.POST['char_id']) goods_id = int(request.POST['goods_id']) amount = int(request.POST['amount']) except: return {'ret': 1} for i in range(amount): p = BasePurchaseAction(char_id) p.send_reward(goods_id) # 额外赠送30% addition_sycee = PURCHASE[goods_id].sycee * amount * 0.3 p = BasePurchaseAction(char_id) p.send_addition_sycee_via_mail(int(addition_sycee)) return {'ret': 0}
def login_notify(char_id): message_clean(char_id) function_open = FunctionOpen(char_id) function_open.send_notify() hero_objs = char_heros_obj(char_id) Char(char_id).send_notify() VIP(char_id).send_notify() hero_notify(char_id, hero_objs) Item(char_id).send_notify() f = Formation(char_id) f.send_socket_notify() f.send_formation_notify() Plunder(char_id).send_notify() p = Prison(char_id) p.send_prisoners_notify() a = Arena(char_id) a.send_notify() a.login_process() f = Friend(char_id) f.send_friends_notify() f.send_friends_amount_notify() CheckIn(char_id).send_notify() stage = Stage(char_id) stage.send_already_stage_notify() stage.send_new_stage_notify() stage_elite = EliteStage(char_id) stage_elite.send_notify() stage_elite.send_times_notify() stage_activity = ActivityStage(char_id) stage_activity.check(send_notify=False) stage_activity.send_notify() stage_activity.send_remained_times_notify() HeroPanel(char_id).send_notify() Task(char_id).send_notify() Achievement(char_id).send_notify() HeroSoul(char_id).send_notify() Levy(char_id).send_notify() Attachment(char_id).send_notify() BasePurchaseAction(char_id).send_notify() SystemBroadcast(char_id).send_global_broadcast() ChatMessagePublish(char_id).send_notify() affairs = Affairs(char_id) affairs.send_city_notify() affairs.send_hang_notify() HorseFreeTimesManager(char_id).send_notify() Horse(char_id).send_notify() union.send_notify(char_id) ae = ActivityEntry(char_id, 50006) if ae and ae.is_valid(): ae.enable(ae.get_current_value(char_id)) ActivityStatic(char_id).send_notify() # mail notify 要放在最后,因为 其他功能初始化时可能会产生登录邮件 Mail(char_id).send_notify()