def statics_game_per_day(self, endPdate=1519833599000, startPdate=1517414400000, lotteryIds=2, source=2): '''单日游戏报表搜索 source: 2:H5 ''' url = "http://" + self.host + self.auth.config.api["owner"][ "statics_game_per_day"] datas = { "endPdate": endPdate, "page": 1, "rows": 15, "startPdate": startPdate, "lotteryIds": lotteryIds, "source": source, "count": 15, "sideType": 2 } resp = requests.get(url=url, headers=self.headers, params=datas) Pylog.debug("【单日游戏报表搜索-request】" + str(datas)) Pylog.info("【单日游戏报表搜索-resp】" + str(resp.text)) return str(resp.text)
def verify_1(self, data): game = config.get_config("verifygame", "game") urlfile = config.get_config("verifygame", "urlfile") Pylog.info(data) datas = {"id": data} self.httpRequest.headers = { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "Authorization": "MAuth-870fc3d727723a7410d2c0fa15154072cdb9300e9a54f89e09b9a27d32f852a44fd07348ae46208298303f281bcdc9a9079fa0b79310115038b4071b44edbe42-MAuth", "X-APP-ID": "20" } url = "http://" + config.get_config("normal", "url") + "/v1/config/kd/game/start" self.reps = self.httpRequest.post(url=url, data=datas) Pylog.debug("Request Body:" + str(self.reps.request.body)) Pylog.debug("Response:" + self.reps.text) csvfile = open(urlfile + '/' + game + '.csv', 'a', encoding='utf8', newline='') writer = csv.writer(csvfile) #正则表达式 gameurl = re.findall("action='(.*)'> </form>", self.reps.text, re.S) writer.writerow([data, gameurl[0]]) csvfile.close()
def r_com_stat_list(self, agentName='default', pcode=81): '''代理退佣统计搜索''' url = "http://" + self.host + self.auth.config.api["owner"][ "r_com_stat_list"] datas = {"agentName": agentName, "page": 1, "pcode": pcode, "rows": 15} resp = requests.get(url=url, headers=self.headers, params=datas) Pylog.debug("【代理退佣统计搜索-request】" + str(datas)) Pylog.info("【代理退佣统计搜索-resp】" + str(resp.text)) return str(resp.text)
def verify_2(self, data): Pylog.info(list(data.keys())[0]) game_id = list(data.keys())[0] game_url = data[game_id] self.httpRequest.headers = { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "Authorization": "MAuth-870fc3d727723a7410d2c0fa15154072cdb9300e9a54f89e09b9a27d32f852a44fd07348ae46208298303f281bcdc9a9079fa0b79310115038b4071b44edbe42-MAuth", "X-APP-ID": "20" } self.reps = self.httpRequest.get(url=game_url) Pylog.debug("Request Body:" + str(self.reps.request.body))
def normal(self, jsondata): Pylog.info("".join(jsondata.keys()) + ": 开始测试") for k, v in jsondata.items(): url = "http://" + config.get_config("normal", "url") + v["url"] method = v["method"] data = v["data"] self.reps = self.httpRequest.post( url=url, data=data) if method == "POST" else self.httpRequest.get( url=url, data=data) Pylog.debug("Request Body:" + str(self.reps.request.body)) Pylog.debug("Response:" + self.reps.text)
def backwater_stats(self, endTime=1519833599000, startTime=1517414400000): '''会员返水统计搜索''' url = "http://" + self.host + self.auth.config.api["owner"][ "backwater_stats"] datas = { "page": 1, "rows": 15, "endTime": endTime, "startTime": startTime } resp = requests.get(url=url, headers=self.headers, params=datas) Pylog.debug("【会员返水统计搜索-request】" + str(datas)) Pylog.info("【会员返水统计搜索-resp】" + str(resp.text)) return str(resp.text)
def gainlost_details(self, pCode=20180201002, pDate=20180201, lotteryId=2): '''玩法盈亏明细''' url = "http://" + self.host + self.auth.config.api["owner"][ "gainlost_details"] datas = { "page": 1, "rows": 15, "lotteryId": lotteryId, "pCode": pCode, "pDate": pDate } resp = requests.get(url=url, headers=self.headers, params=datas) Pylog.debug("【玩法盈亏明细-request】" + str(datas)) Pylog.info("【玩法盈亏明细-resp】" + str(resp.text)) return str(resp.text)
def statics_member(self, endTime=1519833599000, startTime=1517414400000, agentId=None): '''会员统计报表搜索''' url = "http://" + self.host + self.auth.config.api["owner"][ "statics_member"] datas = { "endTime": endTime, "page": 1, "rows": 15, "startTime": startTime, "agentId": agentId } resp = requests.get(url=url, headers=self.headers, params=datas) Pylog.debug("【会员统计报表搜索-request】" + str(datas)) Pylog.info("【会员统计报表搜索-resp】" + str(resp.text)) return str(resp.text)
def search_member(self, endTime=1519833599000, startTime=1517414400000, account=None): '''会员快速查询''' url = "http://" + self.host + self.auth.config.api["owner"][ "search_member"] datas = { "end": endTime, "page": 1, "rows": 15, "start": startTime, "sideType": 2, "account": account } resp = requests.get(url=url, headers=self.headers, params=datas) Pylog.debug("【会员快速查询-request】" + str(datas)) Pylog.info("【会员快速查询-resp】" + str(resp.text)) return str(resp.text)
def statics_agent(self, endTime=1519833599000, startTime=1517414400000, agent='default'): '''代理统计报表搜索''' url = "http://" + self.host + self.auth.config.api["owner"][ "statics_agent"] datas = { "endTime": endTime, "page": 1, "rows": 15, "startTime": startTime, "agent": agent, "sideType": 2 } resp = requests.get(url=url, headers=self.headers, params=datas) Pylog.debug("【代理统计报表搜索-request】" + str(datas)) Pylog.info("【代理统计报表搜索-resp】" + str(resp.text)) return str(resp.text)
def game_details(self, endTime=1519833599000, startTime=1517414400000, lotteryId=2, playId=21101): '''游戏玩法明细查看''' url = "http://" + self.host + self.auth.config.api["owner"][ "game_details"] datas = { "end": endTime, "page": 1, "rows": 15, "start": startTime, "lotteryId": lotteryId, "playId": playId } resp = requests.get(url=url, headers=self.headers, params=datas) Pylog.debug("【游戏玩法明细查看-request】" + str(datas)) Pylog.info("【游戏玩法明细查看-resp】" + str(resp.text)) return str(resp.text)
def upload(self, filename=None): Pylog.info(filename + ": 开始上载") try: src = config.get_config("upload", "src") savefile = config.get_config("upload", "savefile") savename = re.findall('E:/OtherFile/(.*)', src, re.S)[0] idfile = savefile + savename + '.csv' url = "http://img.will888.cn/photo/upload" files = {'pic': open(filename, 'rb')} self.reps = self.httpRequest.upload(url=url, files=files) Pylog.debug("Response:" + self.reps.text) pic = json.loads(self.reps.content) #CSV写入 csvfile = open(idfile, 'a', encoding='utf8', newline='') writer = csv.writer(csvfile) picId = pic["picid"] picname = re.findall(src + '/(.*)', filename, re.S) writer.writerow([picname[0], picId]) csvfile.close() except Exception as e: Pylog.error(e)
def search_game(self, endTime=1519833599000, startTime=1517414400000, lotteryIds=2): '''游戏快速查询 lotteryIds: 2:重庆时时彩双面彩 ''' url = "http://" + self.host + self.auth.config.api["owner"][ "search_game"] datas = { "end": endTime, "page": 1, "rows": 15, "start": startTime, "lotteryIds": lotteryIds } resp = requests.get(url=url, headers=self.headers, params=datas) Pylog.debug("【游戏快速查询-request】" + str(datas)) Pylog.info("【游戏快速查询-resp】" + str(resp.text)) return str(resp.text)
def mem_cash_back_statistics_mem(self, endTime=1519833599000, startTime=1517414400000, agentId=None, memberAccount=None, memberId=None): '''会员返水详情查看''' url = "http://" + self.host + self.auth.config.api["owner"][ "mem_cash_back_statistics_mem"] datas = { "agentId": agentId, "cashAgentAccount2": 'default', "endTime": endTime, "memberAccount": memberAccount, "memberId": memberId, "page": 1, "rows": 15, "startTime": startTime } resp = requests.get(url=url, headers=self.headers, params=datas) Pylog.debug("【会员返水详情查看-request】" + str(datas)) Pylog.info("【会员返水详情查看-resp】" + str(resp.text)) return str(resp.text)