|
@@ -24,62 +24,54 @@ class SpiderPromoterHeader:
|
|
|
|
|
|
@staticmethod
|
|
@staticmethod
|
|
def GetPromoterInfo(promoter_id):
|
|
def GetPromoterInfo(promoter_id):
|
|
- r = redis.Redis(host='192.168.0.99', password='', port=6379, db=0)
|
|
|
|
|
|
+ # r = redis.Redis(host='192.168.0.99', password='', port=6379, db=0)
|
|
listItem = []
|
|
listItem = []
|
|
url = 'https://cps.kwaixiaodian.com/distribute/pc/seller/promoter/info?promoterId={promoterId}&type=1'.format(
|
|
url = 'https://cps.kwaixiaodian.com/distribute/pc/seller/promoter/info?promoterId={promoterId}&type=1'.format(
|
|
promoterId=promoter_id)
|
|
promoterId=promoter_id)
|
|
|
|
|
|
- if r.zcard('kuaishou_shop_click_token') == 0:
|
|
|
|
- cookie_update.get_click_coookie_to_redis()
|
|
|
|
- else:
|
|
|
|
- random_member = r.zrange('kuaishou_shop_click_token', 0, -1, withscores=True)
|
|
|
|
- random_item = random.choice(random_member)
|
|
|
|
- # cookie = random_item[0].decode('utf-8')
|
|
|
|
- cookie = cookie_update.get_cookie_handler()[0]
|
|
|
|
- phone_num = int(random_item[1])
|
|
|
|
|
|
+ cookie = cookie_update.get_cookie_handler()[0]
|
|
|
|
+ headers = {'User-Agent': 'Mozilla/5.0',
|
|
|
|
+ 'Cookie': cookie}
|
|
|
|
|
|
- headers = {'User-Agent': 'Mozilla/5.0',
|
|
|
|
- 'Cookie': cookie}
|
|
|
|
-
|
|
|
|
- try:
|
|
|
|
- rep = requests.get(url=url, headers=headers)
|
|
|
|
- print(rep.text, '-----rep.txt---------')
|
|
|
|
- # if json.loads(rep.text)["result"] != 1 and json.loads(rep.text)["result"] != 100110000:
|
|
|
|
- # cookie_update.update_temporary_cookie_handler(phone_num)
|
|
|
|
- # retry_cookie = cookie_update.get_cookie_handler()[0]
|
|
|
|
- # headers = {'User-Agent': 'Mozilla/5.0',
|
|
|
|
- # 'Cookie': retry_cookie}
|
|
|
|
- # rep = requests.get(url=url, headers=headers)
|
|
|
|
- # data = json.loads(rep.text)["data"]
|
|
|
|
- # item = {"fans": data["fanNum"], "handurl": data["promoterHeadImgUrl"],
|
|
|
|
- # "promoter_name": data["promoterNickName"],
|
|
|
|
- # "promoter_id": promoter_id}
|
|
|
|
- # listItem.append(item)
|
|
|
|
- # return listItem
|
|
|
|
- # elif json.loads(rep.text)["result"] == 100110000:
|
|
|
|
- # cookie_update.update_cookie_handler(phone_num)
|
|
|
|
- # return
|
|
|
|
- if json.loads(rep.text)["result"] == 1:
|
|
|
|
- data = json.loads(rep.text)["data"]
|
|
|
|
- print(data)
|
|
|
|
- item = {"fans": data["fanNum"], "handurl": data["promoterHeadImgUrl"],
|
|
|
|
- "promoter_name": data["promoterNickName"],
|
|
|
|
- "promoter_id": promoter_id}
|
|
|
|
- listItem.append(item)
|
|
|
|
- return listItem
|
|
|
|
- else:
|
|
|
|
- return
|
|
|
|
- except Exception as e:
|
|
|
|
- SendFeiShuMsg.send_robot_msg(
|
|
|
|
- 'GetPromoterInfo {promoterId}请求错误请检查cookie{e}'.format(promoterId=promoter_id, e=e))
|
|
|
|
|
|
+ try:
|
|
|
|
+ rep = requests.get(url=url, headers=headers)
|
|
|
|
+ print(rep.text, '-----rep.txt---------')
|
|
|
|
+ # if json.loads(rep.text)["result"] != 1 and json.loads(rep.text)["result"] != 100110000:
|
|
|
|
+ # cookie_update.update_temporary_cookie_handler(phone_num)
|
|
|
|
+ # retry_cookie = cookie_update.get_cookie_handler()[0]
|
|
|
|
+ # headers = {'User-Agent': 'Mozilla/5.0',
|
|
|
|
+ # 'Cookie': retry_cookie}
|
|
|
|
+ # rep = requests.get(url=url, headers=headers)
|
|
|
|
+ # data = json.loads(rep.text)["data"]
|
|
|
|
+ # item = {"fans": data["fanNum"], "handurl": data["promoterHeadImgUrl"],
|
|
|
|
+ # "promoter_name": data["promoterNickName"],
|
|
|
|
+ # "promoter_id": promoter_id}
|
|
|
|
+ # listItem.append(item)
|
|
|
|
+ # return listItem
|
|
|
|
+ # elif json.loads(rep.text)["result"] == 100110000:
|
|
|
|
+ # cookie_update.update_cookie_handler(phone_num)
|
|
|
|
+ # return
|
|
|
|
+ if json.loads(rep.text)["result"] == 1:
|
|
|
|
+ data = json.loads(rep.text)["data"]
|
|
|
|
+ print(data)
|
|
|
|
+ item = {"fans": data["fanNum"], "handurl": data["promoterHeadImgUrl"],
|
|
|
|
+ "promoter_name": data["promoterNickName"],
|
|
|
|
+ "promoter_id": promoter_id}
|
|
|
|
+ listItem.append(item)
|
|
|
|
+ return listItem
|
|
|
|
+ else:
|
|
|
|
+ return
|
|
|
|
+ except Exception as e:
|
|
|
|
+ SendFeiShuMsg.send_robot_msg(
|
|
|
|
+ 'GetPromoterInfo {promoterId}请求错误请检查cookie{e}'.format(promoterId=promoter_id, e=e))
|
|
|
|
|
|
def GetPromoterID(self):
|
|
def GetPromoterID(self):
|
|
try:
|
|
try:
|
|
sql = """select a.promoter_id from miaogousi.promoter_oerder_amount a
|
|
sql = """select a.promoter_id from miaogousi.promoter_oerder_amount a
|
|
- left join miaogousi.promoter_info b
|
|
|
|
- on a.promoter_id=b.promoter_id
|
|
|
|
- where b.promoter_id is null and a.`30day_gmv` is not null
|
|
|
|
- group by a.promoter_id"""
|
|
|
|
|
|
+ left join miaogousi.promoter_info b
|
|
|
|
+ on a.promoter_id=b.promoter_id
|
|
|
|
+ where b.promoter_id is null and a.`30day_gmv` is not null
|
|
|
|
+ group by a.promoter_id"""
|
|
promoterIdList = self.conn.QueryAll(sql)
|
|
promoterIdList = self.conn.QueryAll(sql)
|
|
return promoterIdList
|
|
return promoterIdList
|
|
except Exception as e:
|
|
except Exception as e:
|