| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 | 
							- # Author renyupeng
 
- # coding=utf-8
 
- # @Time    : 2023/2/27 2:16 下午
 
- # @Site    : 
 
- # @File    : cookie_update.py
 
- # @Software: PyCharm
 
- # @contact: renyupeng@c-top.com.cn
 
- # @Tel 1501435553
 
- from utils.mysql_utils import MysqlUtils
 
- import redis
 
- import random
 
- class cookie_update:
 
-     r = redis.Redis(host='192.168.0.99', password='', port=6379, db=0)
 
-     @staticmethod
 
-     def get_cookie_handler():
 
-         sql = "select cookie ,phone_num from kwai_promoter.kuaishou_supply_chain_cookie where status =0"
 
-         result = MysqlUtils().QueryOne(sql)
 
-         print(result)
 
-         return result
 
-     @staticmethod
 
-     def update_cookie_handler(phone_num):
 
-         sql = "update kwai_promoter.kuaishou_supply_chain_cookie set status=1 where phone_num={phone_num}".format(
 
-             phone_num=phone_num)
 
-         MysqlUtils().Operate(sql=sql, params=None, DML=True)
 
-     @staticmethod
 
-     def update_temporary_cookie_handler(phone_num):
 
-         sql = "update kwai_promoter.kuaishou_supply_chain_cookie set status=2 where phone_num={phone_num}".format(
 
-             phone_num=phone_num)
 
-         MysqlUtils().Operate(sql=sql, params=None, DML=True)
 
-     @staticmethod
 
-     def get_coookie_to_redis():
 
-         sql = "select cookie ,phone_num from kwai_promoter.kuaishou_supply_chain_cookie where status =0"
 
-         results = MysqlUtils().QueryAll(sql)
 
-         for result in results:
 
-             cookie_update.r.zadd('kuaishou_shop_token', {result[0]: result[1]})
 
-         cookie_update.r.close()
 
-     @staticmethod
 
-     def get_click_coookie_to_redis():
 
-         sql = "select cookie ,phone_num from kwai_promoter.kuaishou_supply_chain_cookie where status =0"
 
-         results = MysqlUtils().QueryAll(sql)
 
-         for result in results:
 
-             cookie_update.r.zadd('kuaishou_shop_click_token', {result[0]: result[1]})
 
-         cookie_update.r.close()
 
 
  |