def pcPreLogin(self, request, *args, **kwargs): try: wbUobj = WeiboUser.objects.get(id=request.data['id']) except WeiboUser.DoesNotExist: raise PubErrorCustom("无此账号信息!") if wbUobj.type != '0': raise PubErrorCustom("只有发送红包的账号可以验证码登录!") weiboSysRun().getvercode(username=wbUobj.username)
def vercodeLoginForWeibo(self, request, *args, **kwargs): if not request.data.get("vercode", None): raise PubErrorCustom("验证码不能为空!") try: wbUobj = WeiboUser.objects.get(id=request.data['id']) except WeiboUser.DoesNotExist: raise PubErrorCustom("无此账号信息!") if wbUobj.type != '0': raise PubErrorCustom("只有发送红包的账号可以验证码登录!") weiboSysRun(isQueryTask=False).phonelogin(username=wbUobj.username, vercode=request.data.get( "vercode", None))
def addGroup(self, request, *args, **kwargs): uid = request.data['uid'] userid = request.data['userid'] print("uid:{} userid:{}".format(uid, userid)) wParams = WeiboParams.objects.get(id=1) name = wParams.nameid wbUobj = WeiboUser.objects.filter(userid=userid, status='0', type='1') if not wbUobj.exists(): raise PubErrorCustom("无合法的抢红包账号!") uids = "" for item in wbUobj: uids += "{},".format(item.uid) uids = uids[:-1] print(uids) wbClass = weiboSysRun() wbClass.groupjoin(uid=uid, uids=uids, name=name, userid=userid) wParams.nameid += 1 wParams.save()
def run(self): print("抢红包开始!") while True: weiboSysRun().rob()
def run(self): print("发送红包开始!") while True: weiboSysRun().send()
def run(self): print("获取红包列表开始!") while True: weiboSysRun().gethb()
def loginForPc(self, request, *args, **kwargs): return { "data": weiboSysRun(isQueryTask=False).pclogin(datas=request.data['datas']) }