# Userbase.update(get_experience=0).where(Userbase.uid == '1522').execute() # User.update_nick_name('22693' # # ,'运维的锅')ㅤㅤㅤㅤㅤㅤㅤ # User.set_badge(5257,48) # u = User() # uid = u.reg('noble') # # print(uid) # # u.bd_sj(uid) # MoneyClass.set_money(uid, 150000) # # Bag.add_bag(uid,bag=90001) # User.create_noble(35418, level=4, month=1,cid=2) User.set_noble_expire(35418, 33) # # driver = webdriver.Chrome() # driver.implicitly_wait(10) # driver.get('http://lxy.new.huomaotv.com.cn/1') # driver.maximize_window() # CookieLogin(uid,driver) # driver.get('http://lxy.new.huomaotv.com.cn/memberpay/noblePay') # 非贵族 # 房主 t_n3247(26311) 1225388 粉丝0-1 徽章 0-3 # # 贵族 # 房主 1
def test(self, *args): logger_test_api.info(args) # 开通参数 self.data['month'] = args[-1] self.data['level'] = args[-2] self.old_level = args[1] self.old_month = args[2] # 创建购买用户 self.user = self.create_user() # 是否赠送,创建用户贵族 if args[3]: self.data['to_uid'] = self.create_user() self.data['type'] = 2 if args[0] != 'first': # 是首次开通,不用预先开通用户贵族 User.create_noble(self.data['to_uid'], level=self.old_level, month=self.old_month) if args[0] == 'expired_protect': User.set_noble_expire(self.data['to_uid']) elif args[0] == 'expired': User.set_noble_expire(self.data['to_uid'], 50) else: if args[0] != 'first': User.create_noble(self.user, level=self.old_level, month=self.old_month) if args[0] == 'expired_protect': User.set_noble_expire(self.user) elif args[0] == 'expired': User.set_noble_expire(self.user, 50) # 通用8折皇帝,国王不打折,指定打折卡,添加打折卡 self.discount = args[-3] if isinstance(self.discount, dict): # 添加打折卡 use_level = self.discount['level'] discount = self.discount['discount'] open_month = self.discount['month'] if discount < 10: self.data['card'] = User.add_noble_card(self.user, use_level, discount, open_month) else: Bag.add_bag(self.user, self.discount['card']) self.data['card'] = self.discount['card'] elif self.discount > 0 and self.data['level'] <= 5: Bag.add_bag(self.user, bag=90001) else: self.discount = 10 # 验证 if isinstance(args[4], dict) and args[4].get('card'): if self.old_level == self.data['level'] and args[0] == 'unexpired': self.exp_res = {'code': 201, 'data': ''} else: self.ver = self.validate('renew') elif args[0] == 'expired_protect': self.ver = self.validate('protect_create') elif args[0] == 'expired': self.ver = self.validate('create') elif args[0] == 'unexpired': # 验证 if self.old_level == self.data['level']: self.ver = self.validate('renew') elif self.old_level < self.data['level']: self.ver = self.validate('upgrade') else: self.exp_res = {'code': 201, 'data': ''} else: self.ver = self.validate()