Esempio n. 1
0
 def comTask(self, apikey, header, login_res, dqid):
     """"
     进入申请任务页
     
     """
     jrhqy_url = "v2/new-year20/actindex"
     jrhqy_data = {
         "access_token": login_res["access_token"],
         "periodId": dqid,
         "timestamp": str(int(time.time())),
         "sign": ""
     }
     jrhqy_data["sign"] = GetDataSign().sign_body(jrhqy_url, jrhqy_data,
                                                  apikey)
     jrhqy_respons = PublicRequest(self).requestMethod(
         jrhqy_url, jrhqy_data, header)
     jrhqyres = json.loads(jrhqy_respons.text)
     if 'status' in jrhqyres and jrhqyres[
             "status"] == 200 or 'status' in jrhqyres and jrhqyres[
                 "status"] == "200":
         time.sleep(random.randint(1, 3))
         jrhqy_respons.success()
         return jrhqyres
     else:
         print("报错url==={} ,参数==={} ,报错原因==={}".format(
             jrhqy_url, jrhqy_data, jrhqyres))
         jrhqy_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
             jrhqy_url, jrhqy_data, jrhqyres))
Esempio n. 2
0
 def queryPaymentPassword(self, apikey, header, login_res):
     """"
     查询用户是否设置了支付密码
     
     """
     cxzfmm_url = "v2/wallet/trade-wallet"
     cxzfmm_data = {
         "access_token": login_res["access_token"],
         "paypwd": "e10adc3949ba59abbe56e057f20f883e",
         "timestamp": str(int(time.time())),
         "sign": ""
     }
     # print("设置密码data====={}")
     sign = GetDataSign().sign_body(cxzfmm_url, cxzfmm_data, apikey)
     cxzfmm_data["sign"] = sign
     # print("sigin ======= {}".format(setzfmm_data["sign"]))
     #设置交易密码
     cxzfmm_respons = PublicRequest(self).requestMethod(
         cxzfmm_url, cxzfmm_data, header)
     cxzfmmres = json.loads(cxzfmm_respons.text)
     # print("查询交易密码结果====={}".format(cxzfmmres))
     if 'status' in cxzfmmres and cxzfmmres[
             "status"] == 200 or 'status' in cxzfmmres and cxzfmmres[
                 "status"] == "200":
         time.sleep(random.randint(1, 3))
         cxzfmm_respons.success()
         return cxzfmmres["data"]["userWallet"]
     else:
         print("报错url==={} ,参数==={} ,报错原因==={}".format(
             cxzfmm_url, cxzfmm_data, cxzfmmres))
         cxzfmm_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
             cxzfmm_url, cxzfmm_data, cxzfmmres))
Esempio n. 3
0
 def setMiBao(self, apikey, header, login_res, is_safe):
     # 设置密保
     print("is_safe[data]==={}".format(is_safe))
     if is_safe["data"]["is_safe"] == "0":
         mibao_url = "v2/safe/set-safe-issue"
         mibao_data = {
             "access_token": login_res["access_token"],
             "answer":
             "W3siYW5zd2VyIjoi5YyX5LqsIiwiaXNfc3lzIjoiMCIsImlzc3VlIjoiMSJ9LHsiYW5zd2VyIjoi5YyX5LqsIiwiaXNfc3lzIjoiMCIsImlzc3VlIjoiMyJ9LHsiYW5zd2VyIjoi5YyX5LqsIiwiaXNfc3lzIjoiMSIsImlzc3VlIjoi5YyX5LqsIn1d",
             "timestamp": str(int(time.time())),
             "sign": ""
         }
         # 提交设置的密保
         mibao_data["sign"] = GetDataSign().sign_body(
             mibao_url, mibao_data, apikey)
         mibao_respons = PublicRequest(self).requestMethod(
             mibao_url, mibao_data, header)
         mibaores = json.loads(mibao_respons.text)
         if 'status' in mibaores and mibaores[
                 "status"] == 200 or 'status' in mibaores and mibaores[
                     "status"] == "200":
             time.sleep(random.randint(1, 3))
             mibao_respons.success()
             return mibaores
         else:
             print("报错url==={} ,参数==={} ,报错原因==={}".format(
                 mibao_url, mibao_data, mibaores))
             mibao_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
                 mibao_url, mibao_data, mibaores))
Esempio n. 4
0
 def getDangQiId(self, apikey, header, login_res):
     """"
     获取当期id
     """
     dq_url = "v2/new-year20/online-period"
     dq_data = {
         "access_token": login_res["access_token"],
         "timestamp": str(int(time.time())),
         "sign": ""
     }
     dq_data["sign"] = GetDataSign().sign_body(dq_url, dq_data, apikey)
     jrhqy_respons = PublicRequest(self).requestMethod(
         dq_url, dq_data, header)
     dqres = json.loads(jrhqy_respons.text)
     if 'status' in dqres and dqres[
             "status"] == 200 or 'status' in dqres and dqres[
                 "status"] == "200":
         time.sleep(random.randint(1, 3))
         jrhqy_respons.success()
         return dqres["data"]
     else:
         print("报错url==={} ,参数==={} ,报错原因==={}".format(
             dq_url, dq_data, dqres))
         jrhqy_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
             dq_url, dq_data, dqres))
Esempio n. 5
0
 def index(self, apikey, header, login_res):
     # 获取首页的参数
     print("进入首页")
     if login_res:
         index_url = "v2/my/index"
         index_data = {
             "access_token": login_res["access_token"],
             "sign": "",
             "timestamp": str(int(time.time()))
         }
         # 获取首页
         index_data["sign"] = GetDataSign().sign_body(
             index_url, index_data, apikey)
         sy_respons = PublicRequest(self).requestMethod(
             index_url, index_data, header)
         syres = json.loads(sy_respons.text)
         if 'status' in syres and syres[
                 "status"] == 200 or 'status' in syres and syres[
                     "status"] == "200":
             time.sleep(random.randint(1, 3))
             sy_respons.success()
             return syres
         else:
             print("报错url==={} ,参数==={} ,报错原因==={}".format(
                 index_url, index_data, syres))
             sy_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
                 index_url, index_data, syres))
Esempio n. 6
0
 def setPaymentPassword(self, apikey, header, login_res):
     """"
     设置支付密码
     
     """
     setzfmm_url = "v2/wallet/set-paypwd"
     setzfmm_data = {
         "access_token": login_res["access_token"],
         "password": "******",
         "timestamp": str(int(time.time())),
         "sign": ""
     }
     sign = GetDataSign().sign_body(setzfmm_url, setzfmm_data, apikey)
     setzfmm_data["sign"] = sign
     #设置交易密码
     setzfmm_respons = PublicRequest(self).requestMethod(
         setzfmm_url, setzfmm_data, header)
     print("设置密码===={}".format(setzfmm_respons.elapsed.total_seconds()))
     setzfmmres = json.loads(setzfmm_respons.text)
     print("设置交易密码结果====={}".format(setzfmmres))
     if 'status' in setzfmmres and setzfmmres[
             "status"] == 200 or 'status' in setzfmmres and setzfmmres[
                 "status"] == "200":
         time.sleep(random.randint(1, 3))
         setzfmm_respons.success()
         return setzfmmres
     else:
         print("报错url==={} ,参数==={} ,报错原因==={}".format(
             setzfmm_url, setzfmm_data, setzfmmres))
         setzfmm_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
             setzfmm_url, setzfmm_data, setzfmmres))
Esempio n. 7
0
    def miBaoWenTi(self, apikey, header):
        """
        # 登录设备发生改变,回答密保问题
        """
        print("回答密保后登录")
        daan_url = "v2/safe/answer"
        daan_data = {
            "password": self.login_data["password"],
            "question": "1",
            "answer": "北京",
            "latitude": self.login_data["latitude"],
            "mobile": self.login_data["mobile"],
            "long": self.login_data["long"],
            "device_tokens": str(int(time.time() * 1000)),
            "timestamp": str(int(time.time())),
            "sign": ""
        }

        # 获取首页
        daan_data["sign"] = GetDataSign().sign_body(daan_url, daan_data,
                                                    apikey)
        daan_respons = PublicRequest(self).requestMethod(
            daan_url, daan_data, header)
        daanres = json.loads(daan_respons.text)
        if 'status' in daanres and daanres["status"] == 200:
            time.sleep(random.randint(1, 3))
            daan_respons.success()
            return daanres["data"]
        else:
            print("报错url==={} ,参数==={} ,报错原因==={}".format(
                daan_url, daan_data, daanres))
            daan_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
                daan_url, daan_data, daanres))
Esempio n. 8
0
 def userLogout(self, apikey, header, login_res):
     logout_url = "v2/login/logout"
     logout_urlName = "用户退出"
     logout_data = {
         "access_token": login_res["access_token"],
         "timestamp": str(int(time.time())),
         "sign": ""
     }
     sign = GetDataSign().sign_body(logout_url, logout_data, apikey)
     logout_data["sign"] = sign
     return PublicRequest(self).publicRequest(logout_url, logout_urlName,
                                              logout_data, header)
Esempio n. 9
0
    def getUserType(self, apikey, header, login_res):
        """"
        获取实名认证的状态
        
        """
        rw_url = "v2/user/card-status"
        renwu_data = {
            "access_token": login_res["access_token"],
            "timestamp": str(int(time.time())),
            "sign": ""
        }
        sign = GetDataSign().sign_body(rw_url, renwu_data, apikey)
        renwu_data["sign"] = sign
        #进入获取任务页面请求
        sfzpath = "E:/myTestFile/TestObject/zhongfuan/yunzhangben/yzb_performance/static/shenfenzheng.txt"
        renwu_respons = PublicRequest(self).requestMethod(
            rw_url, renwu_data, header)
        zfrwres = json.loads(renwu_respons.text)
        if 'status' in zfrwres and zfrwres["status"] == 200 or zfrwres[
                "status"] == "200":
            time.sleep(random.randint(1, 3))
            renwu_respons.success()
            taskdata = zfrwres["data"]["type"]
            if taskdata == 5:
                # print("{}用户状态==={}===已实名通过".format(login_res["mobile"],taskdata))
                return taskdata
            elif taskdata == 3:
                print("{}用户状态==={}===待审核".format(login_res["mobile"],
                                                 taskdata))
            elif taskdata == 1:
                print("{}用户状态==={}===未实名,现在去提交审核资料".format(
                    login_res["mobile"], taskdata))
                self.shiMing(apikey, header, login_res, sfzpath)  #实名认证
                print("{}用户提交了审核资料:{}".format(login_res["mobile"], taskdata))
            elif taskdata == 2:
                print("{}用户状态=={}==未实名,现在去提交审核资料".format(
                    login_res["mobile"], taskdata))
                self.shiMing(apikey, header, login_res, sfzpath)  #实名认证
            else:
                print("{}用户状态=={}".format(login_res["mobile"], taskdata))

        elif 'status' in zfrwres and zfrwres["status"] == 401 or zfrwres[
                "status"] == "401":
            print("未登录或已退出")
            # self.interrupt(reschedule=True)
        else:
            print("报错url==={} ,参数==={} ,报错原因==={}".format(
                rw_url, renwu_data, zfrwres))
            renwu_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
                rw_url, renwu_data, zfrwres))
Esempio n. 10
0
    def exchangeGoldShares(self, apikey, header, login_res, num):
        """"
        兑换金股
        
        """
        dhjg_url = "v2/thigh/exchange-more"
        dhjg_data = {
            "access_token": login_res["access_token"],
            "num": str(num),  #兑换金股的数量
            "paypwd": "e10adc3949ba59abbe56e057f20f883e",
            "timestamp": str(int(time.time())),
            "sign": ""
        }
        sign = GetDataSign().sign_body(dhjg_url, dhjg_data, apikey)
        dhjg_data["sign"] = sign
        #先查询用户是否有交易密码

        #兑换金股
        dh_respons = PublicRequest(self).requestMethod(dhjg_url, dhjg_data,
                                                       header)
        print("兑换金股===={}".format(dh_respons.elapsed.total_seconds()))
        dhres = json.loads(dh_respons.text)
        if 'status' in dhres and dhres[
                "status"] == 200 or 'status' in dhres and dhres[
                    "status"] == "200":
            time.sleep(random.randint(1, 3))
            dh_respons.success()
            return "200"
        elif 'status' in dhres and dhres[
                "status"] == 402 or 'status' in dhres and dhres[
                    "status"] == "402":
            dh_respons.success()
            print("未设置密码")
            return "402"
            # if self.setPaymentPassword():
            #     print("已设置密码")
            #     dh_respons = PublicRequest(self).requestMethod(dhjg_url,dhjg_data,header)
            #     dhres = json.loads(dh_respons.text)
            #     if 'status' in dhres and dhres["status"] == 200 or 'status' in dhres and dhres["status"] == "200":
            #         time.sleep(random.randint(1,3))
            #         print("兑换金股成功")
            #         dh_respons.success()
            #         return dhres
        else:
            print("报错url==={} ,参数==={} ,报错原因==={}".format(
                dhjg_url, dhjg_data, dhres))
            dh_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
                dhjg_url, dhjg_data, dhres))
Esempio n. 11
0
    def getGassport(self,loginUser,apikey,header):  #goToLingShuiDi

        qlgx_url = "v2/activity/aic-tree-entrance"
        qlgx_urlName = "去领股息--获取passport"
        qlgx_data = {
            "access_token":loginUser["access_token"],
            "timestamp":str(int(time.time() * 100000)),
            "sign":"" 
        }
        sign = GetDataSign().sign_body(qlgx_url, qlgx_data, apikey)
        qlgx_data["sign"] = sign
        qlgx_respons = PublicRequest(self).publicRequest(qlgx_url,qlgx_urlName,qlgx_data,header)
        if qlgx_respons and qlgx_respons.get("status") and qlgx_respons.get("status") == 200:
            url = qlgx_respons["data"]["url"]
            passport = re.search("passport=(.*)", str(url)).group(1)
            return passport
Esempio n. 12
0
 def main_entrance(self):
     """"
     进入获取任务页
     
     """
     url = "v2/new-year20/online-period"
     canshu_data = {
         "access_token":self.user_dict["access_token"],
         "timestamp":str(int(time.time())),
         "sign":	""
     }
     # print("userDict======={}".format(canshu_data),)
     sign = GetDataSign().sign_body(url,canshu_data, self.apikey)
     canshu_data["sign"] = sign
     #进入获取任务页面
     hqrw_res = PublicRequest(self).requestMethod(url,canshu_data,self.header)
     return hqrw_res
Esempio n. 13
0
 def huoQuTask(self):
     """"
     获取任务
     
     """
     rw_url = "v2/user/card-status"
     renwu_data = {
         "access_token":self.user_dict["access_token"],
         "timestamp":str(int(time.time())),
         "sign":	""
     }
     sign = GetDataSign().sign_body(rw_url,renwu_data, self.apikey)
     renwu_data["sign"] = sign
     #进入获取任务页面
     renwu_res = PublicRequest(self).requestMethod(rw_url,renwu_data,self.header)
     if not renwu_res:
         print("XXXXXXXXXXXXXX获取任务失败,您未实名或实名信息在审核中XXXXXXXXXXXXX{}".format(renwu_res))
     return renwu_res
Esempio n. 14
0
 def paymentTaskMoney(self, apikey, header, login_res):
     """"
     支付任务押金
     
     """
     # if self.selectGoldShares():
     zfrw_url = "v2/new-year20/receive"
     zfrw_data = {
         "access_token": login_res["access_token"],
         "payPwd": "e10adc3949ba59abbe56e057f20f883e",  #123456
         "timestamp": str(int(time.time())),
         "sign": ""
     }
     sign = GetDataSign().sign_body(zfrw_url, zfrw_data, apikey)
     zfrw_data["sign"] = sign
     #支付任务押金
     zfrw_respons = PublicRequest(self).requestMethod(
         zfrw_url, zfrw_data, header)
     print("支付任务响应时间===={}".format(zfrw_respons.elapsed.total_seconds()))
     zfrwres = json.loads(zfrw_respons.text)
     if 'status' in zfrwres and zfrwres["status"] == 200:
         time.sleep(random.randint(1, 3))
         zfrw_respons.success()
         return "200"
     elif 'status' in zfrwres and zfrwres["status"] == 425:
         print("金股小于7枚,无法参与活动")
     elif 'status' in zfrwres and zfrwres["status"] == 441:
         # 还没有设置支付密码
         return "441"
     elif 'status' in zfrwres and zfrwres["status"] == 440:
         print("当日任务已达到上限")
         # self.interrupt(reschedule=True)
         #当日任务已达到上限
         return "440"
     else:
         print("报错url==={} ,参数==={} ,报错原因==={}".format(
             zfrw_url, zfrw_data, zfrwres))
         zfrw_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
             zfrw_url, zfrw_data, zfrwres))
Esempio n. 15
0
    def zhuceUser(self, apikey, header):
        try:
            mobile = self.user.queueData.get()  #获取队列里的数据
        except queue.Empty:  #队列取空后,直接退出
            print('no data exist')
            exit(0)
        devicetokens = int(
            round(time.time() *
                  1000))  #"AkWsVNSPMcwhC6nAXITHbPyrv0YgG5nt1T0B8n79-lrN"
        zc_data = {
            # "password":"******", #123456ab
            "password": "******",  #ren123456
            "latitude": "39.905662",
            "mobile": str(mobile),
            "long": "116.64063",
            "device_tokens": str(devicetokens),
            "timestamp": str(int(time.time())),
            "sign": ""
        }

        zc_url = "v2/login/signup"
        sign = GetDataSign().sign_body(zc_url, zc_data, apikey)
        zc_data["sign"] = sign
        zc_respons = PublicRequest(self).requestMethod(zc_url, zc_data, header)
        zcres = json.loads(zc_respons.text)
        if 'status' in zcres and zcres["status"] == 200 or zcres[
                "status"] == "200":
            zc_respons.success()
            print("注册用户成功===={}".format(mobile))
            return zcres["data"]
        elif 'status' in zcres and zcres["status"] == 422 or zcres[
                "status"] == "422":
            print("此手机号已注册==={}".format(str(mobile)))
        else:
            print("报错url==={} ,参数==={} ,报错原因==={}".format(
                zc_url, zc_data, zcres))
            zc_respons.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
                zc_url, zc_data, zcres))
Esempio n. 16
0
 def selectGoldShares(self, apikey, header, login_res):
     """"
     查询金股余额
     
     """
     xzc_url = "v2/wallet/new-assets"
     xzc_data = {
         "access_token": login_res["access_token"],
         "timestamp": str(int(time.time())),
         "sign": ""
     }
     sign = GetDataSign().sign_body(xzc_url, xzc_data, apikey)
     xzc_data["sign"] = sign
     #获取资产
     xzc_respons = PublicRequest(self).requestMethod(
         xzc_url, xzc_data, header)
     xzsres = json.loads(xzc_respons.text)
     if 'status' in xzsres and xzsres["status"] == 200 or xzsres[
             "status"] == "200":
         time.sleep(random.randint(1, 3))
         xzc_respons.success()
         goldShares = xzsres["data"]
         thighs_int = int(goldShares["thighs"])  #金股数量
         usdt_int = int(goldShares["usdt"])  #aic数量
         print("金股数量===={},aic数量======{}".format(thighs_int, usdt_int))
         if thighs_int > 7:
             print("11111")
             return True
         xcsl = 7 - thighs_int
         if int(usdt_int / 1000) > xcsl:
             print("2222")
             # 把aic兑换成金股
             self.exchangeGoldShares(apikey, header, login_res, xcsl + 1)
             return True
         else:
             print("====金股余额不足,并且aic余额也不足===={}".format(login_res))
Esempio n. 17
0
    def login(self, apikey, header):
        """"
        登录》获取首页》判断密保(未设置密保先设置密保)》判断是否实名(未实名则先实名)
        
        """
        print("进入登录")
        try:
            mobile = self.user.queueData.get()  #获取队列里的数据
        except queue.Empty:  #队列取空后,直接退出
            print('no data exist')
            exit(0)
        password = "******"  #
        device_tokens = int(
            time.time() *
            1000)  #"AkWsVNSPMcwhC6nAXITHbPyrv0YgG5nt1T0B8n79-lrN"
        self.login_data = {
            "password": password,
            "latitude": "39.905662",
            "mobile": str(mobile),
            "long": "116.64063",
            "device_tokens": str(device_tokens),
            "timestamp": str(int(time.time())),
            "sign": ""
        }
        print("666login_data===", self.login_data)
        login_url = "v2/login/login2"
        sign = GetDataSign().sign_body(login_url, self.login_data, apikey)
        print("sign====", sign)
        self.login_data["sign"] = sign

        #登录
        loginres = PublicRequest(self).requestMethod(login_url,
                                                     self.login_data, header)
        print("登录===={}".format(loginres.elapsed.total_seconds()))
        loginresult = json.loads(loginres.text)
        if 'status' in loginresult and loginresult[
                "status"] == 200 or 'status' in loginresult and loginresult[
                    "status"] == "200":
            time.sleep(random.randint(1, 3))
            login_res = loginresult["data"]
            loginres.success()
            return login_res
        elif 'status' in loginresult and loginresult[
                "status"] == 421:  #登录设备发生改变
            # loginres.success()
            time.sleep(random.randint(1, 3))
            login_res = self.miBaoWenTi(apikey, header)
            return login_res
        elif 'status' in loginresult and loginresult["status"] == 412:
            print("请打开应用权限")
            loginres.failure("XXX手机号:{}---XXX====密码:{}".format(
                str(mobile), password))
        elif 'status' in loginresult and loginresult["status"] == 1006:
            print("用户名或密码错误")
            loginres.failure("XXX手机号:{}---XXX====密码:{}".format(
                str(mobile), password))
        else:
            print("报错url==={} ,参数==={} ,报错原因==={}".format(
                login_url, self.login_data, loginresult))
            loginres.failure("报错url==={} ,参数==={} ,报错原因==={}".format(
                login_url, self.login_data, loginresult))