Browse Source

同步服务器最新代码

zwg 4 năm trước cách đây
mục cha
commit
7fb59f0863

+ 7 - 0
README.md

@@ -13,6 +13,13 @@ Data grabbing platform(DGP)数据采集平台
 * 确保已安装Python3
 * 安装项目依赖,执行 `pip install -r requirements.txt`
 
+#### 特性
+
+* 数据库使用`dbutils`连接池,并独立配置mysql的配置文件`db_config.ini`
+* 平台订单数据爬取采用线程池子线程爬取,大大提升爬取速度
+* 平台账号配置使用csv配置文件存储,方便修改同步,并支持直接修改后,下次获取即可生效,无需重启脚本
+
+
 
 #### 使用说明
 

+ 643 - 643
dgp/get_data_hourly.py

@@ -6,97 +6,95 @@ Created on Thu Jun  4 15:06:05 2020
 @author: chencong
 """
 
-import datetime
+import requests
 import hashlib
-import json
-import math
-import random
-import smtplib
 import time
-from email.mime.text import MIMEText
 from urllib import parse
-
+import datetime
+import json
+import math
 import pymysql
-import requests
+import random
 from apscheduler.schedulers.blocking import BlockingScheduler
-
 import account_list as al
 import token_list as tl
+import smtplib
+from email.mime.text import MIMEText
 
 
 def md5value(s):
-    md5 = hashlib.md5()
-    md5.update(s.encode("utf-8"))
-    return md5.hexdigest()
+	md5 = hashlib.md5()
+	md5.update(s.encode("utf-8"))
+	return md5.hexdigest()
 
 
 def get_yuewen_order(st, et):
-    t = ()
-    time1 = time.time()
-    url = 'https://open.yuewen.com/cpapi/wxRecharge/querychargelog'
-    version = 1
-    secert_list = al.yuewen_account_list
-    for secert in secert_list:
-        start_time = st
-        end_time = et
-        email = secert[0]
-        appsecert = secert[1]
-        for i in range((et - st) // 86400 + 1):
-            timestamp = int(time.time())
-            s = ''
-            page = 1
-            order_status = 2
-            data = {
-                'email': email,
-                'version': version,
-                'timestamp': timestamp,
-                'start_time': start_time,
-                'end_time': end_time,
-                'page': page,
-                'order_status': order_status
-            }
-            # 'last_min_id':last_min_id,
-            # 'last_max_id':last_max_id,
-            # 'total_count':total_count,
-            # 'last_page':last_page}
-            sorted_data = sorted(data.items())
-            for k, v in sorted_data:
-                s = s + str(k) + str(v)
-
-            sign = md5value(appsecert + s).upper()
-
-            data1 = {
-                'email': email,
-                'version': version,
-                'timestamp': timestamp,
-                'start_time': start_time,
-                'end_time': end_time,
-                'page': page,
-                'order_status': order_status,
-                'sign': sign
-            }
-            list1 = requests.get(url=url, params=data1)
-            total_count = list1.json()['data']['total_count']
-            last_min_id = list1.json()['data']['min_id']
-            last_max_id = list1.json()['data']['max_id']
-            last_page = list1.json()['data']['page']
-
-            if total_count > 0:
-                for x in list1.json()['data']['list']:
-                    y = {}
-                    dtime = datetime.datetime.strptime(x['order_time'], "%Y-%m-%d %H:%M:%S")
-                    y['date'] = ((int(time.mktime(dtime.timetuple())) + 8 * 3600) // 86400) * 86400 - 8 * 3600
-                    y['platform'] = '阅文'
-                    y['channel'] = x['app_name']
-                    y['from_novel'] = x['book_name']
-                    y['user_id'] = x['openid']
-                    y['stage'] = ''
-                    y['channel_id'] = 0
-                    y['order_time'] = x['order_time']
-                    y['amount'] = x['amount']
-                    y['reg_time'] = x['reg_time']
-                    y['order_id'] = x['order_id']
-                    """
+	t = ()
+	time1 = time.time()
+	url = 'https://open.yuewen.com/cpapi/wxRecharge/querychargelog'
+	version = 1
+	secert_list = al.yuewen_account_list
+	for secert in secert_list:
+		start_time = st
+		end_time = et
+		email = secert[0]
+		appsecert = secert[1]
+		for i in range((et - st) // 86400 + 1):
+			timestamp = int(time.time())
+			s = ''
+			page = 1
+			order_status = 2
+			data = {
+				'email': email,
+				'version': version,
+				'timestamp': timestamp,
+				'start_time': start_time,
+				'end_time': end_time,
+				'page': page,
+				'order_status': order_status
+			}
+			# 'last_min_id':last_min_id,
+			# 'last_max_id':last_max_id,
+			# 'total_count':total_count,
+			# 'last_page':last_page}
+			sorted_data = sorted(data.items())
+			for k, v in sorted_data:
+				s = s + str(k) + str(v)
+
+			sign = md5value(appsecert + s).upper()
+
+			data1 = {
+				'email': email,
+				'version': version,
+				'timestamp': timestamp,
+				'start_time': start_time,
+				'end_time': end_time,
+				'page': page,
+				'order_status': order_status,
+				'sign': sign
+			}
+			list1 = requests.get(url=url, params=data1)
+			total_count = list1.json()['data']['total_count']
+			last_min_id = list1.json()['data']['min_id']
+			last_max_id = list1.json()['data']['max_id']
+			last_page = list1.json()['data']['page']
+
+			if total_count > 0:
+				for x in list1.json()['data']['list']:
+					y = {}
+					dtime = datetime.datetime.strptime(x['order_time'], "%Y-%m-%d %H:%M:%S")
+					y['date'] = ((int(time.mktime(dtime.timetuple())) + 8 * 3600) // 86400) * 86400 - 8 * 3600
+					y['platform'] = '阅文'
+					y['channel'] = x['app_name']
+					y['from_novel'] = x['book_name']
+					y['user_id'] = x['openid']
+					y['stage'] = ''
+					y['channel_id'] = 0
+					y['order_time'] = x['order_time']
+					y['amount'] = x['amount']
+					y['reg_time'] = x['reg_time']
+					y['order_id'] = x['order_id']
+					"""
                     del x['app_name']
                     del x['order_status']
                     del x['order_type']
@@ -109,61 +107,61 @@ def get_yuewen_order(st, et):
                     del x['report_status']
                     if y['order_time'] != time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(et)):
                     """
-                    y = sorted(y.items(), key=lambda item: item[0])
-                    y = dict(y)
-                    y = tuple(y.values())
-                    t = t + ((y),)
-
-            if total_count > 100:
-                for page in range(2, math.ceil(total_count / 100) + 1):
-                    data = {
-                        'email': email,
-                        'version': version,
-                        'timestamp': timestamp,
-                        'start_time': start_time,
-                        'end_time': end_time,
-                        'page': page,
-                        'last_min_id': last_min_id,
-                        'last_max_id': last_max_id,
-                        'total_count': total_count,
-                        'last_page': last_page,
-                        'order_status': order_status
-                    }
-                    sorted_data = sorted(data.items())
-                    s1 = ''
-                    for k, v in sorted_data:
-                        s1 = s1 + str(k) + str(v)
-                        sign = md5value(appsecert + s1).upper()
-                        data2 = {
-                            'email': email,
-                            'version': version,
-                            'timestamp': timestamp,
-                            'start_time': start_time,
-                            'end_time': end_time,
-                            'page': page,
-                            'last_min_id': last_min_id,
-                            'last_max_id': last_max_id,
-                            'total_count': total_count,
-                            'last_page': last_page,
-                            'order_status': order_status,
-                            'sign': sign
-                        }
-                    list2 = requests.get(url=url, params=data2)
-                    for x in list2.json()['data']['list']:
-                        y = {}
-                        dtime = datetime.datetime.strptime(x['order_time'], "%Y-%m-%d %H:%M:%S")
-                        y['date'] = ((int(time.mktime(dtime.timetuple())) + 8 * 3600) // 86400) * 86400 - 8 * 3600
-                        y['platform'] = '阅文'
-                        y['channel'] = x['app_name']
-                        y['from_novel'] = x['book_name']
-                        y['user_id'] = x['openid']
-                        y['stage'] = ''
-                        y['channel_id'] = 0
-                        y['order_time'] = x['order_time']
-                        y['amount'] = x['amount']
-                        y['reg_time'] = x['reg_time']
-                        y['order_id'] = x['order_id']
-                        """
+					y = sorted(y.items(), key=lambda item: item[0])
+					y = dict(y)
+					y = tuple(y.values())
+					t = t + ((y),)
+
+			if total_count > 100:
+				for page in range(2, math.ceil(total_count / 100) + 1):
+					data = {
+						'email': email,
+						'version': version,
+						'timestamp': timestamp,
+						'start_time': start_time,
+						'end_time': end_time,
+						'page': page,
+						'last_min_id': last_min_id,
+						'last_max_id': last_max_id,
+						'total_count': total_count,
+						'last_page': last_page,
+						'order_status': order_status
+					}
+					sorted_data = sorted(data.items())
+					s1 = ''
+					for k, v in sorted_data:
+						s1 = s1 + str(k) + str(v)
+						sign = md5value(appsecert + s1).upper()
+						data2 = {
+							'email': email,
+							'version': version,
+							'timestamp': timestamp,
+							'start_time': start_time,
+							'end_time': end_time,
+							'page': page,
+							'last_min_id': last_min_id,
+							'last_max_id': last_max_id,
+							'total_count': total_count,
+							'last_page': last_page,
+							'order_status': order_status,
+							'sign': sign
+						}
+					list2 = requests.get(url=url, params=data2)
+					for x in list2.json()['data']['list']:
+						y = {}
+						dtime = datetime.datetime.strptime(x['order_time'], "%Y-%m-%d %H:%M:%S")
+						y['date'] = ((int(time.mktime(dtime.timetuple())) + 8 * 3600) // 86400) * 86400 - 8 * 3600
+						y['platform'] = '阅文'
+						y['channel'] = x['app_name']
+						y['from_novel'] = x['book_name']
+						y['user_id'] = x['openid']
+						y['stage'] = ''
+						y['channel_id'] = 0
+						y['order_time'] = x['order_time']
+						y['amount'] = x['amount']
+						y['reg_time'] = x['reg_time']
+						y['order_id'] = x['order_id']
+						"""
                         del x['report_status']
                         del x['app_name']
                         del x['order_status']
@@ -176,72 +174,72 @@ def get_yuewen_order(st, et):
                         del x['book_name']
                         if y['order_time'] != time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(et)):
                         """
-                        y = sorted(y.items(), key=lambda item: item[0])
-                        y = dict(y)
-                        y = tuple(y.values())
-                        t = t + ((y),)
+						y = sorted(y.items(), key=lambda item: item[0])
+						y = dict(y)
+						y = tuple(y.values())
+						t = t + ((y),)
 
-                    total_count = list2.json()['data']['total_count']
-                    last_min_id = list2.json()['data']['min_id']
-                    last_max_id = list2.json()['data']['max_id']
-                    last_page = list2.json()['data']['page']
+					total_count = list2.json()['data']['total_count']
+					last_min_id = list2.json()['data']['min_id']
+					last_max_id = list2.json()['data']['max_id']
+					last_page = list2.json()['data']['page']
 
-    cost_time = round((time.time() - time1) / 60, 1)
-    print('get_yuewen_order:', len(t), 'cost_minutes:', cost_time)
-    return t
+	cost_time = round((time.time() - time1) / 60, 1)
+	print('get_yuewen_order:', len(t), 'cost_minutes:', cost_time)
+	return t
 
 
 def get_zhangdu_order(st, et):
-    time1 = time.time()
-    secert_list = al.zhangdu_account_list
-    t = ()
-    url = 'https://api.zhangdu520.com/channel/getorder'
-
-    for item in secert_list:  # 分渠道
-        uid = item[0]
-        appsecert = item[1]
-        channel = item[2]
-        timestamp = int(time.time())
-        sign = md5value(str(uid) + '&' + appsecert + '&' + str(timestamp))
-        page = 1
-        starttime = st
-        endtime = et
-        for x in range((et - st) // 86400 + 1):  # 分时段
-            Params = {'uid': uid,
-                      'timestamp': timestamp,
-                      'sign': sign,
-                      'starttime': starttime,
-                      'endtime': endtime
-                      }
-            list1 = requests.get(url=url, params=Params)
-            pageCount = list1.json()['data']['pageCount']
-            if pageCount > 0:
-                for a in range(1, pageCount + 1):  # 分页
-                    page = a
-                    Params = {
-                        'uid': uid,
-                        'timestamp': timestamp,
-                        'sign': sign,
-                        'starttime': starttime,
-                        'endtime': endtime,
-                        'page': page
-                    }
-                    list2 = requests.get(url=url, params=Params).json()['data']['list']
-                    for b in list2:
-                        c = {}
-                        c['channel_id'] = uid
-                        c['order_id'] = str(b['orderno'])
-                        c['order_time'] = b['ctime']
-                        c['user_id'] = b['openid']
-                        c['platform'] = '掌读'
-                        c['channel'] = channel
-                        c['stage'] = ''
-                        c['from_novel'] = ''
-                        c['reg_time'] = b['regtime']
-                        c['date'] = ((int(b['ctime']) + 8 * 3600) // 86400) * 86400 - 8 * 3600
-                        c['amount'] = b['amount']
-
-                        """
+	time1 = time.time()
+	secert_list = al.zhangdu_account_list
+	t = ()
+	url = 'https://api.zhangdu520.com/channel/getorder'
+
+	for item in secert_list:  # 分渠道
+		uid = item[0]
+		appsecert = item[1]
+		channel = item[2]
+		timestamp = int(time.time())
+		sign = md5value(str(uid) + '&' + appsecert + '&' + str(timestamp))
+		page = 1
+		starttime = st
+		endtime = et
+		for x in range((et - st) // 86400 + 1):  # 分时段
+			Params = {'uid': uid,
+					  'timestamp': timestamp,
+					  'sign': sign,
+					  'starttime': starttime,
+					  'endtime': endtime
+					  }
+			list1 = requests.get(url=url, params=Params)
+			pageCount = list1.json()['data']['pageCount']
+			if pageCount > 0:
+				for a in range(1, pageCount + 1):  # 分页
+					page = a
+					Params = {
+						'uid': uid,
+						'timestamp': timestamp,
+						'sign': sign,
+						'starttime': starttime,
+						'endtime': endtime,
+						'page': page
+					}
+					list2 = requests.get(url=url, params=Params).json()['data']['list']
+					for b in list2:
+						c = {}
+						c['channel_id'] = uid
+						c['order_id'] = str(b['orderno'])
+						c['order_time'] = b['ctime']
+						c['user_id'] = b['openid']
+						c['platform'] = '掌读'
+						c['channel'] = channel
+						c['stage'] = ''
+						c['from_novel'] = ''
+						c['reg_time'] = b['regtime']
+						c['date'] = ((int(b['ctime']) + 8 * 3600) // 86400) * 86400 - 8 * 3600
+						c['amount'] = b['amount']
+
+						"""
                         del b['openid']
                         del b['regtime']
                         del b['ip']
@@ -253,89 +251,89 @@ def get_zhangdu_order(st, et):
                         del b['source']
                         del b['sourceid']
                         """
-                        if b['status'] == '1' and int(c['order_time']) < et:
-                            del b['status']
-                            x = sorted(c.items(), key=lambda item: item[0])
-                            x = dict(x)
-                            x = tuple(x.values())
-                            t = t + ((x),)
-    cost_time = round((time.time() - time1) / 60, 1)
-    print('get_zhangdu_order:', len(t), 'cost_minutes:', cost_time)
-    return t
+						if b['status'] == '1' and int(c['order_time']) < et:
+							del b['status']
+							x = sorted(c.items(), key=lambda item: item[0])
+							x = dict(x)
+							x = tuple(x.values())
+							t = t + ((x),)
+	cost_time = round((time.time() - time1) / 60, 1)
+	print('get_zhangdu_order:', len(t), 'cost_minutes:', cost_time)
+	return t
 
 
 def get_huasheng_order(st, et):
-    time1 = time.time()
-    apikey_list = al.huasheng_account_list
-    url = 'https://vip.rlcps.cn/api/getMerchants'
-    t = ()
-    for key in apikey_list:  # 获取每个vip账号下的channel_id
-        apiKEY = key[0]
-        apiSecurity = key[1]
-        stage = key[2]
-        timestamp = str(int(time.time()))
-        sign = md5value(apiKEY + timestamp + apiSecurity).upper()
-        data = {'apiKey': apiKEY,
-                'apiSecurity': apiSecurity,
-                'timestamp': timestamp,
-                'sign': sign
-                }
-        list0 = requests.post(url, data).json()
-        for merchant in list0['data']:
-            merchant_id = merchant['merchant_id']
-            merchant_name = merchant['merchant_name']
-            url1 = 'https://vip.rlcps.cn/api/orderList'
-            start_time = st
-
-            for i in range((et - st) // 86400 + 1):
-                date = time.strftime("%Y-%m-%d", time.localtime(start_time))
-                sign = md5value(apiKEY + date + str(merchant_id) + timestamp + apiSecurity).upper()
-                page = 1
-                data1 = {
-                    'apiKey': apiKEY,
-                    'apiSecurity': apiSecurity,
-                    'timestamp': timestamp,
-                    'date': date,
-                    'merchant_id': merchant_id,
-                    'sign': sign,
-                    'page': page
-                }
-                list1 = requests.post(url1, data1).json()
-
-                if 'data' in list1.keys() and len(list1['data']) > 0:
-                    for i in range(int(math.ceil(list1['count'] / 500))):
-                        data2 = {
-                            'apiKey': apiKEY,
-                            'apiSecurity': apiSecurity,
-                            'timestamp': timestamp,
-                            'date': date,
-                            'merchant_id': merchant_id,
-                            'sign': sign,
-                            'page': page
-                        }
-                        list2 = requests.post(url1, data2).json()
-
-                        for x in list2['data']:
-                            if x['order_status'] == 1:
-                                t1 = time.strptime(x['pay_at'], "%Y-%m-%d %H:%M:%S")
-                                ts = int(time.mktime(t1))
-
-                                if ts >= st and ts < et:
-                                    y = {}
-                                    # dtime = datetime.datetime.strptime(x['pay_at'],"%Y-%m-%d")
-                                    # y['date']= ((int(time.mktime(dtime.timetuple()))+8*3600)//86400)*86400-8*3600
-                                    y['order_id'] = x['trans_id']
-                                    y['order_time'] = x['pay_at']
-                                    y['reg_time'] = x['join_at']
-                                    y['date'] = (start_time + 8 * 3600) // 86400 * 86400 - 8 * 3600
-                                    y['channel'] = merchant_name
-                                    y['channel_id'] = merchant_id
-                                    y['from_novel'] = x['book_name']
-                                    y['platform'] = '花生'
-                                    y['stage'] = stage
-                                    y['user_id'] = x['openid']
-                                    y['amount'] = x['amount']
-                                    """
+	time1 = time.time()
+	apikey_list = al.huasheng_account_list
+	url = 'https://vip.rlcps.cn/api/getMerchants'
+	t = ()
+	for key in apikey_list:  # 获取每个vip账号下的channel_id
+		apiKEY = key[0]
+		apiSecurity = key[1]
+		stage = key[2]
+		timestamp = str(int(time.time()))
+		sign = md5value(apiKEY + timestamp + apiSecurity).upper()
+		data = {'apiKey': apiKEY,
+				'apiSecurity': apiSecurity,
+				'timestamp': timestamp,
+				'sign': sign
+				}
+		list0 = requests.post(url, data).json()
+		for merchant in list0['data']:
+			merchant_id = merchant['merchant_id']
+			merchant_name = merchant['merchant_name']
+			url1 = 'https://vip.rlcps.cn/api/orderList'
+			start_time = st
+
+			for i in range((et - st) // 86400 + 1):
+				date = time.strftime("%Y-%m-%d", time.localtime(start_time))
+				sign = md5value(apiKEY + date + str(merchant_id) + timestamp + apiSecurity).upper()
+				page = 1
+				data1 = {
+					'apiKey': apiKEY,
+					'apiSecurity': apiSecurity,
+					'timestamp': timestamp,
+					'date': date,
+					'merchant_id': merchant_id,
+					'sign': sign,
+					'page': page
+				}
+				list1 = requests.post(url1, data1).json()
+
+				if 'data' in list1.keys() and len(list1['data']) > 0:
+					for i in range(int(math.ceil(list1['count'] / 500))):
+						data2 = {
+							'apiKey': apiKEY,
+							'apiSecurity': apiSecurity,
+							'timestamp': timestamp,
+							'date': date,
+							'merchant_id': merchant_id,
+							'sign': sign,
+							'page': page
+						}
+						list2 = requests.post(url1, data2).json()
+
+						for x in list2['data']:
+							if x['order_status'] == 1:
+								t1 = time.strptime(x['pay_at'], "%Y-%m-%d %H:%M:%S")
+								ts = int(time.mktime(t1))
+
+								if ts >= st and ts < et:
+									y = {}
+									# dtime = datetime.datetime.strptime(x['pay_at'],"%Y-%m-%d")
+									# y['date']= ((int(time.mktime(dtime.timetuple()))+8*3600)//86400)*86400-8*3600
+									y['order_id'] = x['trans_id']
+									y['order_time'] = x['pay_at']
+									y['reg_time'] = x['join_at']
+									y['date'] = (start_time + 8 * 3600) // 86400 * 86400 - 8 * 3600
+									y['channel'] = merchant_name
+									y['channel_id'] = merchant_id
+									y['from_novel'] = x['book_name']
+									y['platform'] = '花生'
+									y['stage'] = stage
+									y['user_id'] = x['openid']
+									y['amount'] = x['amount']
+									"""
                                     del x['order_num']
                                     del x['book_name']
                                     del x['trans_id']
@@ -352,90 +350,90 @@ def get_huasheng_order(st, et):
 
                                     if y['order_time'] != time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(et)):
                                     """
-                                    y = sorted(y.items(), key=lambda item: item[0])
-                                    y = dict(y)
-                                    y = tuple(y.values())
-                                    t = t + ((y),)
+									y = sorted(y.items(), key=lambda item: item[0])
+									y = dict(y)
+									y = tuple(y.values())
+									t = t + ((y),)
 
-                        page = page + 1
-    cost_time = round((time.time() - time1) / 60, 1)
-    print('get_huasheng_order:', len(t), 'cost_minutes:', cost_time)
-    return t
+						page = page + 1
+	cost_time = round((time.time() - time1) / 60, 1)
+	print('get_huasheng_order:', len(t), 'cost_minutes:', cost_time)
+	return t
 
 
 def get_zzy_order(st, et):
-    time1 = time.time()
-    API_list = al.zzy_account_list
-    r = ()
-
-    for x in API_list:
-        my_key = x[0]
-        secert = x[1]
-        stage = x[2]
-        my_sign = md5value(secert + 'key=' + my_key)
-        url = 'https://openapi.818tu.com/partners/channel/channels/list?'
-        parameter = 'key=' + my_key + '&sign=' + my_sign
-        channel_list = requests.get(url + parameter)  # 获取子渠道列表
-
-        if 'data' in channel_list.json().keys():
-            items = channel_list.json()['data']['items']
-        elif len(x) > 3:
-            my_key = x[3]
-            secert = x[4]
-            my_sign = md5value(secert + 'key=' + my_key)
-            url = 'https://openapi.818tu.com/partners/channel/channels/list?'
-            parameter = 'key=' + my_key + '&sign=' + my_sign
-            channel_list = requests.get(url + parameter)
-            items = channel_list.json()['data']['items']
-        else:
-            print(channel_list.json())
-            items = []
-
-        if items != []:
-            for item in items:  # 获取channel_id 后逐个拉取历史orders
-                channel_id = item['id']
-                channel = item['nickname']
-                status = str(1)
-                per_page = str(1000)
-                limit_time = et
-                get_time = st
-                lt = parse.urlencode({'created_at[lt]': limit_time})
-                gt = parse.urlencode({'created_at[gte]': get_time})
-                url_1 = 'https://openapi.818tu.com/partners/channel/orders/list?'
-                my_sign_1 = md5value(secert + 'channel_id=' + str(
-                    channel_id) + '&created_at[gte]=' + get_time + '&created_at[lt]=' + limit_time + '&key=' + my_key + '&per_page=' + per_page + '&status=' + status)
-                parameter_1 = 'channel_id=' + str(
-                    channel_id) + '&' + gt + '&' + lt + '&per_page=' + per_page + '&status=' + status + '&key=' + my_key + '&sign=' + my_sign_1
-                orders = requests.get(url_1 + parameter_1)
-                t = orders.json()['data']['count'] // int(per_page) + 1
-                for page in range(1, t + 1):
-                    my_sign_2 = md5value(secert + 'channel_id=' + str(
-                        channel_id) + '&created_at[gte]=' + get_time + '&created_at[lt]=' + limit_time + '&key=' + my_key + '&page=' + str(
-                        page) + '&per_page=' + per_page + '&status=' + status)
-                    parameter_2 = 'channel_id=' + str(channel_id) + '&' + gt + '&' + lt + '&page=' + str(
-                        page) + '&per_page=' + per_page + '&status=' + status + '&key=' + my_key + '&sign=' + my_sign_2
-                    orders_1 = requests.get(url_1 + parameter_2)
-                    b = orders_1.json()['data']['items']
-
-                    for a in b:
-                        c = {}
-                        c['user_id'] = str(a['member']['openid'])
-                        c['channel'] = channel
-                        c['reg_time'] = a['member']['created_at']
-                        c['channel_id'] = channel_id
-                        c['amount'] = round(a['price'] / 100, 2)
-                        c['order_id'] = str(a['id'])
-                        c['order_time'] = a['created_at']
-                        c['platform'] = '掌中云'
-                        dtime = datetime.datetime.strptime(a['created_at'][0:10], "%Y-%m-%d")
-                        c['date'] = ((int(time.mktime(dtime.timetuple())) + 8 * 3600) // 86400) * 86400 - 8 * 3600
-                        c['stage'] = stage
-
-                        if str(a['from_novel_id']) != 'None':
-                            c['from_novel'] = a['from_novel']['title']
-                        else:
-                            c['from_novel'] = 'None'
-                        """
+	time1 = time.time()
+	API_list = al.zzy_account_list
+	r = ()
+
+	for x in API_list:
+		my_key = x[0]
+		secert = x[1]
+		stage = x[2]
+		my_sign = md5value(secert + 'key=' + my_key)
+		url = 'https://openapi.818tu.com/partners/channel/channels/list?'
+		parameter = 'key=' + my_key + '&sign=' + my_sign
+		channel_list = requests.get(url + parameter)  # 获取子渠道列表
+
+		if 'data' in channel_list.json().keys():
+			items = channel_list.json()['data']['items']
+		elif len(x) > 3:
+			my_key = x[3]
+			secert = x[4]
+			my_sign = md5value(secert + 'key=' + my_key)
+			url = 'https://openapi.818tu.com/partners/channel/channels/list?'
+			parameter = 'key=' + my_key + '&sign=' + my_sign
+			channel_list = requests.get(url + parameter)
+			items = channel_list.json()['data']['items']
+		else:
+			print(channel_list.json())
+			items = []
+
+		if items != []:
+			for item in items:  # 获取channel_id 后逐个拉取历史orders
+				channel_id = item['id']
+				channel = item['nickname']
+				status = str(1)
+				per_page = str(1000)
+				limit_time = et
+				get_time = st
+				lt = parse.urlencode({'created_at[lt]': limit_time})
+				gt = parse.urlencode({'created_at[gte]': get_time})
+				url_1 = 'https://openapi.818tu.com/partners/channel/orders/list?'
+				my_sign_1 = md5value(secert + 'channel_id=' + str(
+					channel_id) + '&created_at[gte]=' + get_time + '&created_at[lt]=' + limit_time + '&key=' + my_key + '&per_page=' + per_page + '&status=' + status)
+				parameter_1 = 'channel_id=' + str(
+					channel_id) + '&' + gt + '&' + lt + '&per_page=' + per_page + '&status=' + status + '&key=' + my_key + '&sign=' + my_sign_1
+				orders = requests.get(url_1 + parameter_1)
+				t = orders.json()['data']['count'] // int(per_page) + 1
+				for page in range(1, t + 1):
+					my_sign_2 = md5value(secert + 'channel_id=' + str(
+						channel_id) + '&created_at[gte]=' + get_time + '&created_at[lt]=' + limit_time + '&key=' + my_key + '&page=' + str(
+						page) + '&per_page=' + per_page + '&status=' + status)
+					parameter_2 = 'channel_id=' + str(channel_id) + '&' + gt + '&' + lt + '&page=' + str(
+						page) + '&per_page=' + per_page + '&status=' + status + '&key=' + my_key + '&sign=' + my_sign_2
+					orders_1 = requests.get(url_1 + parameter_2)
+					b = orders_1.json()['data']['items']
+
+					for a in b:
+						c = {}
+						c['user_id'] = str(a['member']['openid'])
+						c['channel'] = channel
+						c['reg_time'] = a['member']['created_at']
+						c['channel_id'] = channel_id
+						c['amount'] = round(a['price'] / 100, 2)
+						c['order_id'] = str(a['id'])
+						c['order_time'] = a['created_at']
+						c['platform'] = '掌中云'
+						dtime = datetime.datetime.strptime(a['created_at'][0:10], "%Y-%m-%d")
+						c['date'] = ((int(time.mktime(dtime.timetuple())) + 8 * 3600) // 86400) * 86400 - 8 * 3600
+						c['stage'] = stage
+
+						if str(a['from_novel_id']) != 'None':
+							c['from_novel'] = a['from_novel']['title']
+						else:
+							c['from_novel'] = 'None'
+						"""
                         del[a['member']]
                         del[a['referral_link_id']]
                         del[a['id']]
@@ -447,337 +445,339 @@ def get_zzy_order(st, et):
                         del a['price']
                         del a['agent_uid']
                         """
-                        x = sorted(c.items(), key=lambda item: item[0])
-                        x = dict(x)
-                        x = tuple(x.values())
-                        r = r + ((x),)
-    cost_time = round((time.time() - time1) / 60, 1)
-    print('get_zzy_order:', len(r), 'cost_minutes:', cost_time)
-    return r
+						x = sorted(c.items(), key=lambda item: item[0])
+						x = dict(x)
+						x = tuple(x.values())
+						r = r + ((x),)
+	cost_time = round((time.time() - time1) / 60, 1)
+	print('get_zzy_order:', len(r), 'cost_minutes:', cost_time)
+	return r
 
 
 def get_ysg_order(st, et):
-    time1 = time.time()
-    key_list = al.ysg_account_list
-    url = 'https://novel.youshuge.com/v2/open/orders'
-    o = ()
-    for key in key_list:
-        host_name = key[0]
-        channel_id = key[1]
-        secert_key = key[2]
-        channel = key[3]
-        stage = key[4]
-        timestamp = int(time.time())
-        start_date = time.strftime("%Y-%m-%d", time.localtime(st))
-        end_date = time.strftime("%Y-%m-%d", time.localtime(et + 86400))
-        page = 1
-        str1 = 'channel_id=' + str(channel_id) + '&end_date=' + end_date + '&host_name=' + host_name + '&page=' + str(
-            page) + '&pay_status=1' + '&start_date=' + start_date + '&time=' + str(timestamp) + '&key=' + secert_key
-        sign = md5value(str1).upper()
-        data = {
-            'sign': sign,
-            'host_name': host_name,
-            'time': timestamp,
-            'channel_id': channel_id,
-            'page': page,
-            'pay_status': 1,
-            'start_date': start_date,
-            'end_date': end_date
-        }
-        r = requests.post(url, data).json()
-
-        if 'data' in r.keys():
-            if len(r['data']) > 0:
-                for i in range((r['data'][0]['count'] - 1) // 100 + 1):
-                    timestamp = int(time.time())
-                    str1 = 'channel_id=' + str(
-                        channel_id) + '&end_date=' + end_date + '&host_name=' + host_name + '&page=' + str(
-                        page) + '&pay_status=1' + '&start_date=' + start_date + '&time=' + str(
-                        timestamp) + '&key=' + secert_key
-                    sign = md5value(str1).upper()
-                    data2 = {
-                        'sign': sign,
-                        'host_name': host_name,
-                        'time': timestamp,
-                        'channel_id': channel_id,
-                        'page': page,
-                        'pay_status': 1,
-                        'start_date': start_date,
-                        'end_date': end_date
-                    }
-                    r2 = requests.post(url, data2).json()
-
-                    if 'data' in r2.keys():
-                        if len(r2['data']) > 0:
-                            for x in r2['data']:
-                                t1 = time.strptime(x['create_time'], "%Y-%m-%d %H:%M:%S")
-                                ts = int(time.mktime(t1))
-                                if ts >= st and ts < et:
-                                    y = {}
-                                    y['order_id'] = x['order_num']
-                                    y['amount'] = round(int(x['price']) / 100, 2)
-                                    y['order_time'] = x['create_time']
-                                    y['channel'] = channel
-                                    y['from_novel'] = x['book_name']
-                                    y['stage'] = stage
-                                    y['user_id'] = x['openid']
-                                    y['channel_id'] = channel_id
-                                    dtime = datetime.datetime.strptime(x['create_time'][0:10], "%Y-%m-%d")
-                                    y['date'] = ((int(
-                                        time.mktime(dtime.timetuple())) + 8 * 3600) // 86400) * 86400 - 8 * 3600
-                                    y['platform'] = '悠书阁'
-                                    y['reg_time'] = x['reg_time']
-
-                                    y = sorted(y.items(), key=lambda item: item[0])
-                                    y = dict(y)
-                                    y = tuple(y.values())
-                                    o = o + ((y),)
-                    page = page + 1
-    cost_time = round((time.time() - time1) / 60, 1)
-    print('get_ysg_order:', len(o), 'cost_minutes:', cost_time)
-    return o
+	time1 = time.time()
+	key_list = al.ysg_account_list
+	url = 'https://novel.youshuge.com/v2/open/orders'
+	o = ()
+	for key in key_list:
+		host_name = key[0]
+		channel_id = key[1]
+		secert_key = key[2]
+		channel = key[3]
+		stage = key[4]
+		timestamp = int(time.time())
+		start_date = time.strftime("%Y-%m-%d", time.localtime(st))
+		end_date = time.strftime("%Y-%m-%d", time.localtime(et + 86400))
+		page = 1
+		str1 = 'channel_id=' + str(channel_id) + '&end_date=' + end_date + '&host_name=' + host_name + '&page=' + str(
+			page) + '&pay_status=1' + '&start_date=' + start_date + '&time=' + str(timestamp) + '&key=' + secert_key
+		sign = md5value(str1).upper()
+		data = {
+			'sign': sign,
+			'host_name': host_name,
+			'time': timestamp,
+			'channel_id': channel_id,
+			'page': page,
+			'pay_status': 1,
+			'start_date': start_date,
+			'end_date': end_date
+		}
+		r = requests.post(url, data).json()
+
+		if 'data' in r.keys():
+			if len(r['data']) > 0:
+				for i in range((r['data'][0]['count'] - 1) // 100 + 1):
+					timestamp = int(time.time())
+					str1 = 'channel_id=' + str(
+						channel_id) + '&end_date=' + end_date + '&host_name=' + host_name + '&page=' + str(
+						page) + '&pay_status=1' + '&start_date=' + start_date + '&time=' + str(
+						timestamp) + '&key=' + secert_key
+					sign = md5value(str1).upper()
+					data2 = {
+						'sign': sign,
+						'host_name': host_name,
+						'time': timestamp,
+						'channel_id': channel_id,
+						'page': page,
+						'pay_status': 1,
+						'start_date': start_date,
+						'end_date': end_date
+					}
+					r2 = requests.post(url, data2).json()
+
+					if 'data' in r2.keys():
+						if len(r2['data']) > 0:
+							for x in r2['data']:
+								t1 = time.strptime(x['create_time'], "%Y-%m-%d %H:%M:%S")
+								ts = int(time.mktime(t1))
+								if ts >= st and ts < et:
+									y = {}
+									y['order_id'] = x['order_num']
+									y['amount'] = round(int(x['price']) / 100, 2)
+									y['order_time'] = x['create_time']
+									y['channel'] = channel
+									y['from_novel'] = x['book_name']
+									y['stage'] = stage
+									y['user_id'] = x['openid']
+									y['channel_id'] = channel_id
+									dtime = datetime.datetime.strptime(x['create_time'][0:10], "%Y-%m-%d")
+									y['date'] = ((int(
+										time.mktime(dtime.timetuple())) + 8 * 3600) // 86400) * 86400 - 8 * 3600
+									y['platform'] = '悠书阁'
+									y['reg_time'] = x['reg_time']
+
+									y = sorted(y.items(), key=lambda item: item[0])
+									y = dict(y)
+									y = tuple(y.values())
+									o = o + ((y),)
+					page = page + 1
+	cost_time = round((time.time() - time1) / 60, 1)
+	print('get_ysg_order:', len(o), 'cost_minutes:', cost_time)
+	return o
 
 
 def daily_reports_get(access_token, account_id, level, fields):
-    interface = 'daily_reports/get'
-    url = 'https://api.e.qq.com/v1.1/' + interface
+	interface = 'daily_reports/get'
+	url = 'https://api.e.qq.com/v1.1/' + interface
 
-    common_parameters = {
-        'access_token': access_token,
-        'timestamp': int(time.time()),
-        'nonce': str(time.time()) + str(random.randint(0, 999999)),
-    }
+	common_parameters = {
+		'access_token': access_token,
+		'timestamp': int(time.time()),
+		'nonce': str(time.time()) + str(random.randint(0, 999999)),
+	}
 
-    parameters = {
-        "account_id": account_id,
-        "level": level,
-        "date_range":
-            {
-                "start_date": time.strftime("%Y-%m-%d", time.localtime()),
-                "end_date": time.strftime("%Y-%m-%d", time.localtime())
-            },
-        "page": 1,
-        "page_size": 1000,
-        "fields": fields
-    }
+	parameters = {
+		"account_id": account_id,
+		"level": level,
+		"date_range":
+			{
+				"start_date": time.strftime("%Y-%m-%d", time.localtime()),
+				"end_date": time.strftime("%Y-%m-%d", time.localtime())
+			},
+		"page": 1,
+		"page_size": 1000,
+		"fields": fields
+	}
 
-    parameters.update(common_parameters)
+	parameters.update(common_parameters)
 
-    for k in parameters:
-        if type(parameters[k]) is not str:
-            parameters[k] = json.dumps(parameters[k])
+	for k in parameters:
+		if type(parameters[k]) is not str:
+			parameters[k] = json.dumps(parameters[k])
 
-    r = requests.get(url, params=parameters)
+	r = requests.get(url, params=parameters)
 
-    return r.json()
+	return r.json()
 
 
 def get_daily_vx():
-    token_list_v = tl.token_list_vx
-    t = ()
-    time1 = time.time()
-
-    for y in token_list_v:
-        c = daily_reports_get(y[2], y[0], "REPORT_LEVEL_ADVERTISER_WECHAT", (
-            'date', 'cost', 'view_count', 'valid_click_count', 'ctr', 'official_account_follow_rate', 'order_amount',
-            'order_roi', 'order_count', 'order_rate', 'order_unit_price', 'web_order_cost', 'first_day_order_amount',
-            'first_day_order_count'))
-        if 'data' in c.keys():
-            for d in c['data']['list']:
-                d['account_id'] = y[0]
-                x = tuple(d.values())
-                t = t + ((x),)
-    cost_time = round((time.time() - time1) / 60, 1)
-    print('get_daily_vx:', len(t), 'cost_minutes:', cost_time)
-
-    return t
+	token_list_v = tl.token_list_vx
+	t = ()
+	time1 = time.time()
+
+	for y in token_list_v:
+		c = daily_reports_get(y[2], y[0], "REPORT_LEVEL_ADVERTISER_WECHAT", (
+		'date', 'cost', 'view_count', 'valid_click_count', 'ctr', 'official_account_follow_rate', 'order_amount',
+		'order_roi', 'order_count', 'order_rate', 'order_unit_price', 'web_order_cost', 'first_day_order_amount',
+		'first_day_order_count'))
+		if 'data' in c.keys():
+			for d in c['data']['list']:
+				d['account_id'] = y[0]
+				x = tuple(d.values())
+				t = t + ((x),)
+	cost_time = round((time.time() - time1) / 60, 1)
+	print('get_daily_vx:', len(t), 'cost_minutes:', cost_time)
+
+	return t
 
 
 def get_daily_qq():
-    token_list_q = tl.token_list_qq
-    t = ()
-    time1 = time.time()
+	token_list_q = tl.token_list_qq
+	t = ()
+	time1 = time.time()
 
-    for x in token_list_q:
-        a = daily_reports_get(x[2], x[0], "REPORT_LEVEL_ADVERTISER", (
-            'date', 'view_count', 'valid_click_count', 'ctr', 'cpc', 'cost', 'web_order_count', 'web_order_rate',
-            'web_order_cost', 'follow_count', 'order_amount', 'order_roi', 'platform_page_view_count',
-            'web_commodity_page_view_count', 'from_follow_uv'))
-        for b in a['data']['list']:
-            b['account_id'] = x[0]
-            y = tuple(b.values())
-            t = t + ((y),)
-    cost_time = round((time.time() - time1) / 60, 1)
-    print('get_qq_order:', len(t), 'cost_minutes:', cost_time)
+	for x in token_list_q:
+		a = daily_reports_get(x[2], x[0], "REPORT_LEVEL_ADVERTISER", (
+		'date', 'view_count', 'valid_click_count', 'ctr', 'cpc', 'cost', 'web_order_count', 'web_order_rate',
+		'web_order_cost', 'follow_count', 'order_amount', 'order_roi', 'platform_page_view_count',
+		'web_commodity_page_view_count', 'from_follow_uv'))
+		for b in a['data']['list']:
+			b['account_id'] = x[0]
+			y = tuple(b.values())
+			t = t + ((y),)
+	cost_time = round((time.time() - time1) / 60, 1)
+	print('get_qq_order:', len(t), 'cost_minutes:', cost_time)
 
-    return t
+	return t
 
 
 def mysql_insert_order(data):
-    db = pymysql.connect('rm-bp1c9cj79872tx3aaro.mysql.rds.aliyuncs.com', 'superc', 'Cc719199895', 'quchen_text')
-    cursor = db.cursor()
-    time1 = time.time()
-    # sql = 'insert ignore into quchen_text.order (amount,channel,channel_id,date,from_novel,order_id,order_time,platform,reg_time,stage,user_id) values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);'
-    sql = 'replace into quchen_text.order(amount,channel,channel_id,date,from_novel,order_id,order_time,platform,reg_time,stage,user_id) values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);'
-    try:
-        cursor.executemany(sql, data)
-        db.commit()
-        cost_time = round((time.time() - time1) / 60, 1)
-        print('insert_order access', len(data), 'cost_minutes:', cost_time)
-    except:
-        db.rollback()
-        print('insert_order defeat')
+	db = pymysql.connect('rm-bp1c9cj79872tx3aaro.mysql.rds.aliyuncs.com', 'superc', 'Cc719199895', 'quchen_text')
+	cursor = db.cursor()
+	time1 = time.time()
+	# sql = 'insert ignore into quchen_text.order (amount,channel,channel_id,date,from_novel,order_id,order_time,platform,reg_time,stage,user_id) values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);'
+	sql = 'replace into quchen_text.order(amount,channel,channel_id,date,from_novel,order_id,order_time,platform,reg_time,stage,user_id) values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);'
+	try:
+		cursor.executemany(sql, data)
+		db.commit()
+		cost_time = round((time.time() - time1) / 60, 1)
+		print('insert_order access', len(data), 'cost_minutes:', cost_time)
+	except:
+		db.rollback()
+		print('insert_order defeat')
 
 
 def mysql_insert_daily_vx(data):
-    db = pymysql.connect('rm-bp1c9cj79872tx3aaro.mysql.rds.aliyuncs.com', 'superc', 'Cc719199895', 'quchen_text')
-    cursor = db.cursor()
-    time1 = time.time()
-    sql1 = 'delete from daily_vx where date = %s'
-    sql2 = 'insert ignore into daily_vx (date,cost,view_count,valid_click_count,ctr,official_account_follow_rate,order_amount,order_roi,order_count,order_rate,order_unit_price,web_order_cost,first_day_order_amount,first_day_order_count,account_id) values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);'
-    try:
-        cursor.execute(sql1, str(time.strftime("%Y-%m-%d", time.localtime())))
-        db.commit()
-        print('clear_daily_vx access')
-    except:
-        print('clear_daily_vx defeat')
-    try:
-        cursor.executemany(sql2, data)
-        db.commit()
-        cost_time = round((time.time() - time1) / 60, 1)
-        print('insert_daily_vx access', len(data), 'cost_minutes:', cost_time)
-    except:
-        db.rollback()
-        print('insert_daily_vx defeat')
+	db = pymysql.connect('rm-bp1c9cj79872tx3aaro.mysql.rds.aliyuncs.com', 'superc', 'Cc719199895', 'quchen_text')
+	cursor = db.cursor()
+	time1 = time.time()
+	sql1 = 'delete from daily_vx where date = %s'
+	sql2 = 'insert ignore into daily_vx (date,cost,view_count,valid_click_count,ctr,official_account_follow_rate,order_amount,order_roi,order_count,order_rate,order_unit_price,web_order_cost,first_day_order_amount,first_day_order_count,account_id) values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);'
+	try:
+		cursor.execute(sql1, str(time.strftime("%Y-%m-%d", time.localtime())))
+		db.commit()
+		print('clear_daily_vx access')
+	except:
+		print('clear_daily_vx defeat')
+	try:
+		cursor.executemany(sql2, data)
+		db.commit()
+		cost_time = round((time.time() - time1) / 60, 1)
+		print('insert_daily_vx access', len(data), 'cost_minutes:', cost_time)
+	except:
+		db.rollback()
+		print('insert_daily_vx defeat')
 
 
 def mysql_insert_daily_qq(data):
-    db = pymysql.connect('rm-bp1c9cj79872tx3aaro.mysql.rds.aliyuncs.com', 'superc', 'Cc719199895', 'quchen_text')
-    cursor = db.cursor()
-    time1 = time.time()
-    sql1 = 'delete from daily_qq where date = %s'
-    sql2 = 'insert ignore into daily_qq (date,view_count,valid_click_count,ctr,cpc,cost,web_order_count,web_order_rate,web_order_cost,follow_count,order_amount,order_roi,platform_page_view_count,web_commodity_page_view_count,from_follow_uv,account_id) values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);'
-    try:
-        cursor.execute(sql1, str(time.strftime("%Y-%m-%d", time.localtime())))
-        db.commit()
-        print('clear_daily_qq access')
-    except:
-        print('clear_daily_qq defeat')
-    try:
-        cursor.executemany(sql2, data)
-        db.commit()
-        cost_time = round((time.time() - time1) / 60, 1)
-        print('insert_daily_qq access', len(data), 'cost_minutes:', cost_time)
-    except:
-        db.rollback()
-        print('insert_daily_qq defeat')
+	db = pymysql.connect('rm-bp1c9cj79872tx3aaro.mysql.rds.aliyuncs.com', 'superc', 'Cc719199895', 'quchen_text')
+	cursor = db.cursor()
+	time1 = time.time()
+	sql1 = 'delete from daily_qq where date = %s'
+	sql2 = 'insert ignore into daily_qq (date,view_count,valid_click_count,ctr,cpc,cost,web_order_count,web_order_rate,web_order_cost,follow_count,order_amount,order_roi,platform_page_view_count,web_commodity_page_view_count,from_follow_uv,account_id) values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);'
+	try:
+		cursor.execute(sql1, str(time.strftime("%Y-%m-%d", time.localtime())))
+		db.commit()
+		print('clear_daily_qq access')
+	except:
+		print('clear_daily_qq defeat')
+	try:
+		cursor.executemany(sql2, data)
+		db.commit()
+		cost_time = round((time.time() - time1) / 60, 1)
+		print('insert_daily_qq access', len(data), 'cost_minutes:', cost_time)
+	except:
+		db.rollback()
+		print('insert_daily_qq defeat')
 
 
 def send_waring_email():
-    msg_Sender = '2091961210@qq.cm'  # 发送方邮箱
-    msg_code = 'ylltzynbshmufdeh'  # 发送方邮箱的授权码
-    msg_Receiver = '2091961210@qq.cm'  # 收件人邮箱
-
-    subject = "数据库未按时更新"  # 主题
-    content = "数据库未按时更新"  # 正文
-    msg = MIMEText(content, _charset="utf-8")
-    msg['Subject'] = subject
-    msg['From'] = msg_Sender
-    msg['To'] = msg_Receiver
-    try:
-        s = smtplib.SMTP_SSL("smtp.qq.com", 465)  # 邮件服务器及端口号
-        s.login(msg_Sender, msg_code)
-        s.sendmail(msg_Sender, msg_Receiver, msg.as_string())
-        print("发送成功")
-    except Exception as e:
-        print("发送失败", e)
-    finally:
-        s.quit()
+	msg_Sender = '2091961210@qq.cm'  # 发送方邮箱
+	msg_code = 'ylltzynbshmufdeh'  # 发送方邮箱的授权码
+	msg_Receiver = '2091961210@qq.cm'  # 收件人邮箱
+
+	subject = "数据库未按时更新"  # 主题
+	content = "数据库未按时更新"  # 正文
+	msg = MIMEText(content, _charset="utf-8")
+	msg['Subject'] = subject
+	msg['From'] = msg_Sender
+	msg['To'] = msg_Receiver
+	try:
+		s = smtplib.SMTP_SSL("smtp.qq.com", 465)  # 邮件服务器及端口号
+		s.login(msg_Sender, msg_code)
+		s.sendmail(msg_Sender, msg_Receiver, msg.as_string())
+		print("发送成功")
+	except Exception as e:
+		print("发送失败", e)
+	finally:
+		s.quit()
 
 
 def update_check():
-    st_unix = int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600 - 3600)
-    et_unix = int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600)
-    # et_unix = et_unix - 1
-
-    st_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(st_unix)) + '+08:00'
-    et_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(et_unix)) + '+08:00'
-
-    db = pymysql.connect('rm-bp1c9cj79872tx3aaro.mysql.rds.aliyuncs.com', 'superc', 'Cc719199895', 'quchen_text')
-    cursor = db.cursor()
-    sql4 = "select platform,round(max(if(platform='掌读',order_time,unix_timestamp(order_time))),0) from quchen_text.order where date=%s and platform not in ('阳光','悠书阁')  group by platform "
-    data = (int((time.time() + 8 * 3600) // 86400 * 86400 - 8 * 3600))
-    try:
-        cursor.execute(sql4, data)
-        db.commit()
-        x = cursor.fetchall()
-        print('access', x)
-    except:
-        db.rollback()
-        print('defeat', x)
-    zzy = x[0][1] // 3600 * 3600
-    zhangdu = x[1][1] // 3600 * 3600
-    huasheng = x[2][1] // 3600 * 3600
-    yuewen = x[3][1] // 3600 * 3600
-    if zzy < int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600 - 3600):
-        mysql_insert_order(get_zzy_order(st_dt, et_dt))
-    if zhangdu < int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600 - 3600):
-        mysql_insert_order(get_zhangdu_order(st_unix, et_unix))
-    if huasheng < int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600 - 3600):
-        mysql_insert_order(get_huasheng_order(st_unix, et_unix))
-    if yuewen < int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600 - 3600):
-        mysql_insert_order(get_yuewen_order(st_unix, et_unix - 1))
-
-    try:
-        cursor.execute(sql4, data)
-        db.commit()
-        z = cursor.fetchall()
-        print('access', z)
-    except:
-        db.rollback()
-        print('defeat', z)
-    a = []
-    for k in x:
-        a.append(k[1])
-    y = min(a) // 3600 * 3600
-
-    if y < int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600 - 3600):
-        send_waring_email()
+	st_unix = int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600 - 3600)
+	et_unix = int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600)
+	# et_unix = et_unix - 1
+
+	st_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(st_unix)) + '+08:00'
+	et_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(et_unix)) + '+08:00'
+
+	db = pymysql.connect('rm-bp1c9cj79872tx3aaro.mysql.rds.aliyuncs.com', 'superc', 'Cc719199895', 'quchen_text')
+	cursor = db.cursor()
+	sql4 = "select platform,round(max(if(platform='掌读',order_time,unix_timestamp(order_time))),0) from quchen_text.order where date=%s and platform not in ('阳光','悠书阁')  group by platform "
+	data = (int((time.time() + 8 * 3600) // 86400 * 86400 - 8 * 3600))
+	try:
+		cursor.execute(sql4, data)
+		db.commit()
+		x = cursor.fetchall()
+		print('access', x)
+	except:
+		db.rollback()
+		print('defeat', x)
+	zzy = x[0][1] // 3600 * 3600
+	zhangdu = x[1][1] // 3600 * 3600
+	huasheng = x[2][1] // 3600 * 3600
+	yuewen = x[3][1] // 3600 * 3600
+	if zzy < int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600 - 3600):
+		mysql_insert_order(get_zzy_order(st_dt, et_dt))
+	if zhangdu < int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600 - 3600):
+		mysql_insert_order(get_zhangdu_order(st_unix, et_unix))
+	if huasheng < int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600 - 3600):
+		mysql_insert_order(get_huasheng_order(st_unix, et_unix))
+	if yuewen < int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600 - 3600):
+		mysql_insert_order(get_yuewen_order(st_unix, et_unix - 1))
+
+	try:
+		cursor.execute(sql4, data)
+		db.commit()
+		z = cursor.fetchall()
+		print('access', z)
+	except:
+		db.rollback()
+		print('defeat', z)
+	a = []
+	for k in x:
+		a.append(k[1])
+	y = min(a) // 3600 * 3600
+
+	if y < int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600 - 3600):
+		send_waring_email()
 
 
 def start_order_job():
-    st_unix_time = time.time()
-    st_unix = int((st_unix_time + 8 * 3600) // 3600 * 3600 - 8 * 3600 - 3600)
-    et_unix = int((st_unix_time + 8 * 3600) // 3600 * 3600 - 8 * 3600)
-    # et_unix = et_unix - 1
-    st_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(st_unix)) + '+08:00'
-    et_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(et_unix)) + '+08:00'
-    print(st_dt, et_dt)
-    mysql_insert_order(get_yuewen_order(st_unix, et_unix))
-    mysql_insert_order(get_zhangdu_order(st_unix, et_unix))
-    mysql_insert_order(get_ysg_order(st_unix, et_unix))
-    mysql_insert_order(get_zzy_order(st_dt, et_dt))
-    mysql_insert_order(get_huasheng_order(st_unix, et_unix))
-    update_check()
+	st_unix_time = time.time()
+	st_unix = int((st_unix_time + 8 * 3600) // 3600 * 3600 - 8 * 3600 - 3600)
+	et_unix = int((st_unix_time + 8 * 3600) // 3600 * 3600 - 8 * 3600)
+	# et_unix = et_unix - 1
+	st_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(st_unix)) + '+08:00'
+	et_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(et_unix)) + '+08:00'
+	print(st_dt, et_dt)
+	mysql_insert_order(get_yuewen_order(st_unix, et_unix))
+	mysql_insert_order(get_zhangdu_order(st_unix, et_unix))
+	mysql_insert_order(get_ysg_order(st_unix, et_unix))
+	mysql_insert_order(get_huasheng_order(st_unix, et_unix))
+	mysql_insert_order(get_zzy_order(st_dt, et_dt))
+	update_check()
 
 
 def start_cost_job():
-    st_unix_time = time.time()
-    st_unix = int((st_unix_time + 8 * 3600) // 3600 * 3600 - 8 * 3600 - 3600)
-    et_unix = int((st_unix_time + 8 * 3600) // 3600 * 3600 - 8 * 3600)
-    # et_unix = et_unix - 1
-    st_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(st_unix)) + '+08:00'
-    et_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(et_unix)) + '+08:00'
-    print(st_dt, et_dt)
-    mysql_insert_daily_vx(get_daily_vx())
-    mysql_insert_daily_qq(get_daily_qq())
+	st_unix_time = time.time()
+	st_unix = int((st_unix_time + 8 * 3600) // 3600 * 3600 - 8 * 3600 - 3600)
+	et_unix = int((st_unix_time + 8 * 3600) // 3600 * 3600 - 8 * 3600)
+	# et_unix = et_unix - 1
+	st_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(st_unix)) + '+08:00'
+	et_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(et_unix)) + '+08:00'
+	print(st_dt, et_dt)
+	mysql_insert_daily_vx(get_daily_vx())
+	mysql_insert_daily_qq(get_daily_qq())
 
 
-start_order_time = '2020-09-28 18:10:00'
-start_cost_time = '2020-09-28 18:35:00'
+start_order_time = '2020-09-29 14:10:00'
+start_cost_time = '2020-09-29 14:35:00'
 
 if __name__ == '__main__':
-    scheduler = BlockingScheduler()
-    scheduler.add_job(start_order_job, 'interval', max_instances=10, hours=1, start_date=start_order_time)
-    scheduler.add_job(start_cost_job, 'interval', max_instances=10, hours=1, start_date=start_cost_time)
-    scheduler.start()
+	scheduler = BlockingScheduler()
+	scheduler.add_job(start_order_job, 'interval', max_instances=10, hours=1, start_date=start_order_time)
+	scheduler.add_job(start_cost_job, 'interval', max_instances=10, hours=1, start_date=start_cost_time)
+	scheduler.start()
+
+

+ 7 - 2
dgp/get_order_daily.py

@@ -397,7 +397,11 @@ def get_zzy_order(st,et):
             parameter = 'key='+my_key+'&sign='+my_sign
             #url = 'https://openapi.818tu.com/partners/channel/channels/list?'
             channel_list = requests.get(url+parameter)
-            items = channel_list.json()['data']['items']
+            if 'data' in channel_list.json().keys():
+                items = channel_list.json()['data']['items']
+            else:
+                print(channel_list.json())
+                items = []   
         else:
             print(channel_list.json())
             items = []       
@@ -581,7 +585,7 @@ def start_all_job():
 
 
 
-start_job_time = '2020-09-28 03:25:00'
+start_job_time = '2020-09-30 00:20:00'
 
 
 if __name__ == '__main__':
@@ -589,3 +593,4 @@ if __name__ == '__main__':
     scheduler.add_job(start_all_job, 'interval',days=1,start_date=start_job_time)
     scheduler.start()
 
+

+ 1 - 1
dgp/huasheng_text.py

@@ -120,7 +120,7 @@ def start_huasheng_job():
     # et_unix = et_unix-1
     get_huasheng_order(st_unix,et_unix)
     
-start_order_time = '2020-09-15 03:30:00'
+start_order_time = '2020-09-30 03:30:00'
 
 if __name__ == '__main__':
     scheduler = BlockingScheduler()

+ 8 - 8
dgp/repair_order_daily.py

@@ -72,9 +72,9 @@ def mysql_insert_order_daily(data):
 
 
 def repair_order():
-
-    st_unix = int((time.time()+8*3600)//86400*86400-8*3600-86400)
-    et_unix = int((time.time()+8*3600)//86400*86400-8*3600)
+    repair_unix_time = time.time()
+    st_unix = int((repair_unix_time+8*3600)//86400*86400-8*3600-86400)
+    et_unix = int((repair_unix_time+8*3600)//86400*86400-8*3600)
     #et_unix = et_unix - 1
     st_dt = time.strftime("%Y-%m-%dT%H:%M:%S",time.localtime(st_unix))+'+08:00'
     et_dt = time.strftime("%Y-%m-%dT%H:%M:%S",time.localtime(et_unix))+'+08:00'
@@ -84,19 +84,19 @@ def repair_order():
         get_data_hourly.mysql_insert_order(get_data_hourly.get_zhangdu_order(st_unix,et_unix))
         get_data_hourly.mysql_insert_order(get_data_hourly.get_ysg_order(st_unix,et_unix))
         get_data_hourly.mysql_insert_order(get_data_hourly.get_zzy_order(st_dt,et_dt))
-        get_data_hourly.mysql_insert_order(get_data_hourly.get_yuewen_order(st_unix,et_unix-1))
-        ##get_data_hourly.mysql_insert_order(get_data_hourly.get_yuewen_order(st_unix,et_unix))
+        get_data_hourly.mysql_insert_order(get_data_hourly.get_yuewen_order(st_unix,et_unix))
+        ##get_data_hourly.mysql_insert_order(get_data_hourly.get_yuewen_order(st_unix,et_unix-1))
         get_data_hourly.mysql_insert_order(get_data_hourly.get_huasheng_order(st_unix,et_unix))
     if b==1 :
         mysql_insert_order_daily(get_data_hourly.get_zhangdu_order(st_unix,et_unix))
         mysql_insert_order_daily(get_data_hourly.get_ysg_order(st_unix,et_unix))
         mysql_insert_order_daily(get_data_hourly.get_zzy_order(st_dt,et_dt))
-        mysql_insert_order_daily(get_data_hourly.get_yuewen_order(st_unix,et_unix-1))
-        #mysql_insert_order_daily(get_data_hourly.get_yuewen_order(st_unix,et_unix))
+        mysql_insert_order_daily(get_data_hourly.get_yuewen_order(st_unix,et_unix))
+        #mysql_insert_order_daily(get_data_hourly.get_yuewen_order(st_unix,et_unix-1))
         mysql_insert_order_daily(get_data_hourly.get_huasheng_order(st_unix,et_unix))
 
 
-start_job_time = '2020-09-23 01:40:00'
+start_job_time = '2020-09-30 03:40:00'
 
 
 if __name__ == '__main__':

+ 1 - 0
dgp/tests/MySQLConnection.py

@@ -31,6 +31,7 @@ import os
 import pymysql
 from DBUtils.PooledDB import PooledDB
 
+
 class MySQLConnection():
     """
     数据库连接池代理对象

+ 240 - 253
dgp/tests/account_list_zwg.py

@@ -6,265 +6,252 @@ Created on Thu Jul 23 17:39:51 2020
 @author: chencong
 """
 
-yuewen_account_list=[['mqud82950@163.com','74ca754515fa253c8ab790603cebc2ee'],['guangzhouliuqi2@sina.com','10ce1dd6ccb330a82b73701d1e78f518']]
+yuewen_account_list = [['mqud82950@163.com', '74ca754515fa253c8ab790603cebc2ee'],
+                       ['guangzhouliuqi2@sina.com', '10ce1dd6ccb330a82b73701d1e78f518']]
 
-zhangdu_account_list =[[10015,'0125f434-7999-a4bb-77ab-28fb0a6a68ec','丹墨悦读'],
-[7406,'834a31ad-5533-d0d0-cb48-6f81f83919b0','九五月读'],
-[10497,'2e4a0bd0-e222-286b-73dc-1e6a6c8a6f28','书剑文阁'],
-[10507,'59babb99-9434-b1b1-7159-17afcb825cba','争锋文豪'],
-[9868,'320b477e-59c6-cb9f-9fb1-b0a304c3d82b','侠客书楼'],
-[10020,'9a914f89-f640-2ae8-34a7-c24b1f397d77','修焰文阅'],
-[9873,'14978692-cdae-9b8e-84cf-21d3202dd521','傲龙书社'],
-[10069,'ee9d7deb-8c3f-6862-31dc-779bec1cdc46','兰庭文鼎'],
-[9668,'88f5d175-de02-24ed-575c-0fcf6c847e02','冥影文库'],
-[10063,'016e69af-ce65-e5c0-34dc-47222cfb996a','冥影文海'],
-[10119,'a2d7196f-164b-8b58-cb6d-6d49d91fb106','冥真文轩'],
-[9754,'da893644-f673-42c7-65fd-f6a7ac30347a','冷锋看吧'],
-[7863,'ad3b06c6-c0b4-8f5f-8270-f493864f5a83','凤情书阁'],
-[10769,'ae1cb5cf-716c-f880-dcf2-ab041c2f849a','剑旭文海'],
-[7405,'862a9c69-801e-23ce-5fbd-bfcb0c1de5b0','南三月读'],
-[10472,'00d765f5-dd77-2b37-f0b0-bd5ac8d24a3e','南菲悦读'],
-[7872,'0e0915c5-ca02-3d62-b0ca-a80f41d722db','名媛书屋'],
-[10729,'08d04293-c004-7116-d260-53a340471306','坌腾文海'],
-[7865,'9ae4df81-a9c1-e7d3-50e5-62e40332dbef','夜情书房'],
-[9684,'db078cb4-fb45-7830-af84-736ef24912b6','大河中文网'],
-[9874,'4248df4a-d573-cf02-97cb-2d185d3cfb69','天降读物'],
-[10040,'116ef9c2-62e8-83ae-1c41-0f14d898dad8','奇汇看吧'],
-[9860,'bd90fa50-51f7-fce1-1523-591a041a8719','如阅墨香'],   
-[7873,'456af16a-fc75-420c-a6ce-234cba07eb92','媚咪文馆'],
-[10543,'8304c660-a0a1-acfd-7ba7-3531383c9209','宸赫书楼'],
-[9872,'80cec896-ef46-6f77-a80e-6737954dfbaa','寻界文坊'],
-[9870,'f2d73b83-60e3-215c-f283-4e48a64e19e0','尊圣中文网'],
-[10545,'def2f148-82c2-b42c-634c-f2b557a529ce','尚凌文轩'],
-[9865,'41e1a151-397d-a08e-f582-f0394a59c748','巨龍悦读'],
-[10730,'f337c426-58fc-3865-4794-d5cb2c9ceec2','彭湃阅读'],
-[9685,'cb03d959-9311-f0d3-a6fb-188d79d92412','忠武文学城'],
-[10234,'b5e9eaea-483f-f246-5816-23ffa9309c05','悦苒看吧'],
-[9995,'d654d3ec-ec34-e243-6cab-5ba030fb1c8a','惊鸿文海'],
-[9633,'e943f5cf-8726-e7a8-6b76-d0a2d8f0a67c','慕云文库'],
-[10459,'781e425b-b14a-7d39-88fa-588d11d18b93','承泽文轩'],
-[10009,'a72aefcf-2fde-3187-90aa-09a30273cdc6','攀登文库'],
-[10003,'3c0bb2fa-e835-6f96-ffd2-185fd9dfd2af','新阅文轩'],
-[9663,'e0b49bb4-0365-ec52-e8d2-a71bf9eeb2a2','无涯文海'],
-[7864,'4c3ce52f-9e48-9f5a-c64f-1634dcb37d1d','日月书房'],
-[10030,'8674d904-c496-bacb-35ab-7a23a21b4725','旷世文海'],
-[10629,'a57edda1-766c-ae25-fb95-d57aaf144e7c','星烛书海'],
-[9847,'0ffd2d6f-aa77-67a0-fda1-510eab3ce006','昱墨文海'],
-[10011,'88ad507a-050a-8271-4ba4-adfd381cdaff','晨曦墨轩'],
-[9846,'be33e937-c791-48fb-8137-58f0d38a70b4','月落文阁'],
-[9689,'b6a4daa1-e9ce-0dd6-5714-21e089f327ab','林溪文苑'],
-[10008,'06301041-96ca-b3a1-9892-e02526a3f53e','枫林文选'],
-[10013,'1bfa8861-c20d-f994-b649-03bdcf40a403','桔橙文轩'],
-[10441,'fb13c84a-01b1-1a84-4c84-ffbc38241477','洛书文海'],
-[10235,'239c2e93-1c3c-05a9-ba69-4fb8c2d1553e','渲染悦轩'],
-[10628,'78348bef-cef1-969a-a0cf-990dab656bb5','炫轩文库'],
-[7890,'a1417aa5-2041-9b56-d419-4606f035d12d','烛影书屋'],
-[10669,'1b3a227c-c811-d1bf-9564-6cd5c22a1fb5','猛虎阅吧'],
-[10461,'755ef603-e734-bddf-e5b8-700e941c8c18','瑞祥文轩'],
-[9686,'d5964a79-2b2a-5e41-f54a-5d0304cd088b','知隐书香'],
-[9998,'a8d73912-364b-57aa-76e6-b38a2bb9fb7b','碧炎文海'],
-[10041,'4cd2ede8-8b02-2ef1-c29f-081ac5b926e0','祁苑文阅'],
-[10442,'62d5296b-9370-ecbf-e1b2-8e15158e3ed5','神龍悦读'],
-[10544,'a22e664b-0fa2-f08a-c60a-1b97d180d4a8','禹诺文阁'],
-[9915,'f8fe300b-eea6-9443-5a83-1b7d75ae88ad','秀丽文轩'],
-[9911,'7de672c4-e526-71a2-aa08-fd6012929a43','秋霞书社'],
-[10471,'b92c8ea0-f40c-b959-9c54-bdd42948fec4','空亭文苑'],
-[7887,'7271c2b9-5092-aa65-fa86-786cf3ecd528','竹枝书院'],
-[10460,'644d48ea-8ee3-3271-43e4-aa1e4d1eb86e','繁星书海'],
-[10499,'d5c5c552-34cd-55c3-e41f-44fe443cbe56','红炎文轩'],
-[9882,'3b4f7cca-ffea-086a-9444-5dfcd6c79794','绘色阅读'],
-[9876,'68e66280-c3d7-e84a-8fe1-94b1f526f5b6','若汐文海'],
-[10771,'982bde3b-5eb5-431e-a3f6-bac99735b759','莫宇文库'],
-[10067,'9bcd9dae-7718-91da-ea16-ea224e22164c','莹悦看吧'],
-[10473,'7864d9a8-df4b-d105-4f2e-e30179c2974a','蓝翼文海'],
-[10024,'1b5c7edc-038e-54ad-dad5-f30216dd8c0a','虎啸文选'],
-[10095,'ced46ef2-5759-6169-7e40-5624215f1f91','蛟龙书楼'],
-[9883,'0d525b30-997b-c727-9f03-1dea301f7ec0','西洲书舍'],
-[10668,'9839e7a4-5fc2-c05b-faaf-0ed5f2cdce81','豪天文轩'],
-[9866,'04cad8fd-c599-12e8-4d66-80cab639b050','豪金书社'],
-[7889,'bf0fd628-c244-52c5-ae94-d5fa0ec91f4d','踏莎小说阅读'],
-[10044,'6e87b452-dcb3-9c10-de65-c5919fa3d73d','追光悦读'],
-[10200,'81c06b81-1da5-53c4-3b4e-5f63a83f1579','锦墨书楼'],
-[9916,'58e354ee-5f24-f02f-ee90-5f6f0e5d97c8','锦溪书楼'],
-[9688,'e0a5f28c-6009-560a-6dc6-975e5e53cc74','阅欣文学'],
-[9910,'5e3f1ef2-b497-8560-810e-ee92882f0726','阅胜文选'],
-[10498,'89266631-e8fa-ea77-075e-d38d37a654c1','阳俊文海'],
-[10770,'e389c082-d1ca-cb2a-6d0b-915db869363a','雁风文轩'],
-[9900,'874d0ec8-1e85-f061-e095-d9997597bd8e','雅阁文社'],
-[7866,'dfb7dcdc-a6b1-e03e-2f57-9bfcb80a32c4','雨尘书阁'],
-[10474,'611bdc19-946c-945d-bcf8-2a64ca2919c0','雪松文库'],
-[9875,'b1fea7ac-4e0b-4546-e41a-9181af98515d','霄雄文学'],
-[10419,'8e4c73f2-50e4-dd33-3e06-63c3d8f38c04','霜华文库'],
-[9938,'fc61e6fd-bf13-44ea-73e9-609971b83456','青云文轩'],
-[10007,'8bc52ea8-64ec-32cf-3ef6-463abe469eed','青峰悦读'],
-[8939,'b016dcab-c002-ae71-f8ad-d5ffd35d3bbc','青葱看吧'],
-[10014,'4d5441a4-da30-15e4-0186-aa2aea21b286','青霞文苑'],
-[10418,'e3a32b05-ac1c-f518-af33-3c0d3883307b','飞鸿文海'],
-[9971,'5c625d14-8452-847e-09bd-33d30126ed31','魅力书楼'],
-[9922,'d1e77bc9-3875-ad44-2253-4201f70e0bb4','鹿鸣文库'],
-[10012,'90e4a5fc-4625-9710-6ab1-561ce0de0270','麒麟墨选'],
-[10199,'16abc367-31e0-f0aa-4cd4-9cc64e891d8a','鼎月文苑'],
-[10475,'f50879de-036f-7ec7-39dc-44ecda037dea','鼎盛文海'],
-[10901,'8135ee68-4255-8da3-9b35-cef2b942f6a2','孤风书楼'],
-[10899,'a8425c20-ee9a-b6ad-b8da-e6b74621be5c','冷雁文海'],
-[10896,'b24bca0d-3d31-0127-04e0-b2254ebb27e9','南烟书楼'],
-[10840,'e69ab01b-3725-4e70-670b-408b82860fe3','鹤鸣看吧'],
-[10841,'dc577efd-aa90-4dd6-f8ab-c42b38f84faa','深洋书楼'],
-[10842,'4cc12af5-2c86-2217-e5e1-ce1b28fa4758','航远文阁'],
-[10843,'ca5920b0-59cb-a55e-9fd9-e5095a29c04f','神武文轩'],
-[10845,'cfc93bd7-723e-0341-c6ef-c25253a8caa6','茗垣文轩'],
-[10995,'2e537d2a-6b5c-a862-2cf0-30aa46bcad6e','耀杰书海'],
-[10997,'d458def2-35c0-c577-d5a3-259225b9b76b','锦凌文选'],
-[10996,'b1bde6ca-c518-ea3c-cf5f-5d30286b34b4','清涛文海'],
-[10998,'b2b056ee-26a6-5868-874b-ab36f372900c','墨景文轩'],
-[10999,'630fda00-13ff-f625-05aa-8d1862d385da','炫熙书馆'],
-[11021,'90a1e372-8ce8-cd8f-e8c5-e9f603f0f9ba','狂涛文轩'],
-[11020,'73445fa0-6145-149f-58eb-772eb7c78481','展宸书楼'],
-[11011,'6fd7df66-8dc0-8939-759e-8e34d759e34a','阳曜文海'],
-[11009,'f1d96f4a-2a3c-b24b-1f36-2398cebc19ad','高韵书楼'],
-[11008,'d0a3a898-9e87-6adf-00ed-86b68040ecb0','成弘书楼'],
-[10963,'3cf33177-fd73-68a5-6095-0d8b36083a9c','旋锋文轩'],
-[10962,'c3f38863-6a7e-33aa-a44e-04b901ee1f04','赤虹文海'],
-[10961,'11306f81-cfea-ab8f-f0a0-2da8f0acdea5','飘霜书海'],
-[10942,'1235a146-7a1d-3a68-9f79-ede48cb8442c','月瑶看书'],
-[10941,'3fd1d09f-c66c-bee7-021d-41510a673339','婉婉阅读'],
-[10908,'2994b1bb-b51b-acd3-cad5-0055cf28104c','君浩文阅'],
-[10906,'a419c6fd-9e10-c9d9-ed9a-02814014fdc3','星汉文海'],
-[10879,'617a71dc-9ae0-3d5e-d373-ee833edc25df','华晖文轩'],
-[10878,'d76b661f-75d5-60e7-f596-26d61054348e','承载书楼'],
-[10877,'fe3c50c4-5fe7-36a1-6dc5-40ca27b3f671','鸿振书馆'],
-[11076,'9a9bfeaf-2abc-495b-83f5-5f00d36cc54b','正德书楼'],
-[11075,'1ab64fb6-aab3-f13a-d2f9-e079fb17d66e','泽宇文海'],
-[11074,'c45b1a56-44e3-384e-25cf-63b987d6a297','吉本书海'],
-[11073,'e0bf65b9-f592-1a1a-aac0-fbf710e40847','高岑文轩'],
-[11044,'0cdea0ed-7a09-36f0-750e-61b75652bc87','烈风文海'],
-[11043,'b605a351-81b8-910d-b0a8-66c9dc59374d','霸皇书楼'],
-[11042,'35902525-03d5-e99b-ea69-d5ed1c716da1','辰宇书馆'],
-[11039,'5abdd0ec-408e-ded3-d725-ac08e93eae90','吹雪文库'],
-[11038,'d364471e-963b-e8a7-e89b-06568c831500','飞羽书楼'],
-[10900,'e9136409-133f-37e1-7585-3f4f1675d20f','琦玉文库'],
-[10998,'b2b056ee-26a6-5868-874b-ab36f372900c','墨景文轩'],
-[10996,'b1bde6ca-c518-ea3c-cf5f-5d30286b34b4','清涛文海']
-]
-
-huasheng_account_list=[['259900','72b49bebb7fc8df83feac8c4ed5c541b','趣程16期'],
-                   ['269900','65e6d003b58ee73b5406e6cc472ebf3e','趣程14期'],
-                   ['249900','f4f1475f604c4185a3e031e961dee637','趣程17期'],
-                   ['4040635','c8bf5346e35f51c7ce228cff4d4a3678','趣程19期'],
-                   ['2828976','20c0fb1d20964c2c42a725c72cac8863','清勇6月'],
-                   ['4747764','f350d7edd89bb7f6170b970f071ecb36','趣程20期'],
-                   ['3737140','e786e59b87ebf239fdb43bf267ef4ee2','趣程13期'],
-                   ['4848597','fab68fe238a8df12073295373f9e0ff7','趣程22期'],
-                   ['5353590','50fefc21c7dd90cf9b584fe571f1bb64','趣程21期'],
-                   ['4545355','968ba35e79d8219c47ca356d19192c6f','趣程9期'],
-                   ['5858936','508c03b7f22059f1fa811c1774dbff89','阳光1期'],
-                   ['6464295','20ebdb167b8ed58fc406f05cd2b78802','趣程15期'],
-                   ['6666592','998aa35d1ed17635484eae5486e750db','趣程23期'],
-                   ['8282535','d61b2231e589571cf2328a7855df335e','陈冲1期'],
-                   ['104104493','957ad78e53a7fc2e751d36e6ec5329d5','广州10期'],
-                   ['102102605','50126233532d2e4e1796a16e1247d7dc','趣程24期'],
-['127127862','b0af6b9ba284bd6b10b932cdeae96b74','趣程25期']
-                   ]
+zhangdu_account_list = [[10015, '0125f434-7999-a4bb-77ab-28fb0a6a68ec', '丹墨悦读'],
+                        [7406, '834a31ad-5533-d0d0-cb48-6f81f83919b0', '九五月读'],
+                        [10497, '2e4a0bd0-e222-286b-73dc-1e6a6c8a6f28', '书剑文阁'],
+                        [10507, '59babb99-9434-b1b1-7159-17afcb825cba', '争锋文豪'],
+                        [9868, '320b477e-59c6-cb9f-9fb1-b0a304c3d82b', '侠客书楼'],
+                        [10020, '9a914f89-f640-2ae8-34a7-c24b1f397d77', '修焰文阅'],
+                        [9873, '14978692-cdae-9b8e-84cf-21d3202dd521', '傲龙书社'],
+                        [10069, 'ee9d7deb-8c3f-6862-31dc-779bec1cdc46', '兰庭文鼎'],
+                        [9668, '88f5d175-de02-24ed-575c-0fcf6c847e02', '冥影文库'],
+                        [10063, '016e69af-ce65-e5c0-34dc-47222cfb996a', '冥影文海'],
+                        [10119, 'a2d7196f-164b-8b58-cb6d-6d49d91fb106', '冥真文轩'],
+                        [9754, 'da893644-f673-42c7-65fd-f6a7ac30347a', '冷锋看吧'],
+                        [7863, 'ad3b06c6-c0b4-8f5f-8270-f493864f5a83', '凤情书阁'],
+                        [10769, 'ae1cb5cf-716c-f880-dcf2-ab041c2f849a', '剑旭文海'],
+                        [7405, '862a9c69-801e-23ce-5fbd-bfcb0c1de5b0', '南三月读'],
+                        [10472, '00d765f5-dd77-2b37-f0b0-bd5ac8d24a3e', '南菲悦读'],
+                        [7872, '0e0915c5-ca02-3d62-b0ca-a80f41d722db', '名媛书屋'],
+                        [10729, '08d04293-c004-7116-d260-53a340471306', '坌腾文海'],
+                        [7865, '9ae4df81-a9c1-e7d3-50e5-62e40332dbef', '夜情书房'],
+                        [9684, 'db078cb4-fb45-7830-af84-736ef24912b6', '大河中文网'],
+                        [9874, '4248df4a-d573-cf02-97cb-2d185d3cfb69', '天降读物'],
+                        [10040, '116ef9c2-62e8-83ae-1c41-0f14d898dad8', '奇汇看吧'],
+                        [9860, 'bd90fa50-51f7-fce1-1523-591a041a8719', '如阅墨香'],
+                        [7873, '456af16a-fc75-420c-a6ce-234cba07eb92', '媚咪文馆'],
+                        [10543, '8304c660-a0a1-acfd-7ba7-3531383c9209', '宸赫书楼'],
+                        [9872, '80cec896-ef46-6f77-a80e-6737954dfbaa', '寻界文坊'],
+                        [9870, 'f2d73b83-60e3-215c-f283-4e48a64e19e0', '尊圣中文网'],
+                        [10545, 'def2f148-82c2-b42c-634c-f2b557a529ce', '尚凌文轩'],
+                        [9865, '41e1a151-397d-a08e-f582-f0394a59c748', '巨龍悦读'],
+                        [10730, 'f337c426-58fc-3865-4794-d5cb2c9ceec2', '彭湃阅读'],
+                        [9685, 'cb03d959-9311-f0d3-a6fb-188d79d92412', '忠武文学城'],
+                        [10234, 'b5e9eaea-483f-f246-5816-23ffa9309c05', '悦苒看吧'],
+                        [9995, 'd654d3ec-ec34-e243-6cab-5ba030fb1c8a', '惊鸿文海'],
+                        [9633, 'e943f5cf-8726-e7a8-6b76-d0a2d8f0a67c', '慕云文库'],
+                        [10459, '781e425b-b14a-7d39-88fa-588d11d18b93', '承泽文轩'],
+                        [10009, 'a72aefcf-2fde-3187-90aa-09a30273cdc6', '攀登文库'],
+                        [10003, '3c0bb2fa-e835-6f96-ffd2-185fd9dfd2af', '新阅文轩'],
+                        [9663, 'e0b49bb4-0365-ec52-e8d2-a71bf9eeb2a2', '无涯文海'],
+                        [7864, '4c3ce52f-9e48-9f5a-c64f-1634dcb37d1d', '日月书房'],
+                        [10030, '8674d904-c496-bacb-35ab-7a23a21b4725', '旷世文海'],
+                        [10629, 'a57edda1-766c-ae25-fb95-d57aaf144e7c', '星烛书海'],
+                        [9847, '0ffd2d6f-aa77-67a0-fda1-510eab3ce006', '昱墨文海'],
+                        [10011, '88ad507a-050a-8271-4ba4-adfd381cdaff', '晨曦墨轩'],
+                        [9846, 'be33e937-c791-48fb-8137-58f0d38a70b4', '月落文阁'],
+                        [9689, 'b6a4daa1-e9ce-0dd6-5714-21e089f327ab', '林溪文苑'],
+                        [10008, '06301041-96ca-b3a1-9892-e02526a3f53e', '枫林文选'],
+                        [10013, '1bfa8861-c20d-f994-b649-03bdcf40a403', '桔橙文轩'],
+                        [10441, 'fb13c84a-01b1-1a84-4c84-ffbc38241477', '洛书文海'],
+                        [10235, '239c2e93-1c3c-05a9-ba69-4fb8c2d1553e', '渲染悦轩'],
+                        [10628, '78348bef-cef1-969a-a0cf-990dab656bb5', '炫轩文库'],
+                        [7890, 'a1417aa5-2041-9b56-d419-4606f035d12d', '烛影书屋'],
+                        [10669, '1b3a227c-c811-d1bf-9564-6cd5c22a1fb5', '猛虎阅吧'],
+                        [10461, '755ef603-e734-bddf-e5b8-700e941c8c18', '瑞祥文轩'],
+                        [9686, 'd5964a79-2b2a-5e41-f54a-5d0304cd088b', '知隐书香'],
+                        [9998, 'a8d73912-364b-57aa-76e6-b38a2bb9fb7b', '碧炎文海'],
+                        [10041, '4cd2ede8-8b02-2ef1-c29f-081ac5b926e0', '祁苑文阅'],
+                        [10442, '62d5296b-9370-ecbf-e1b2-8e15158e3ed5', '神龍悦读'],
+                        [10544, 'a22e664b-0fa2-f08a-c60a-1b97d180d4a8', '禹诺文阁'],
+                        [9915, 'f8fe300b-eea6-9443-5a83-1b7d75ae88ad', '秀丽文轩'],
+                        [9911, '7de672c4-e526-71a2-aa08-fd6012929a43', '秋霞书社'],
+                        [10471, 'b92c8ea0-f40c-b959-9c54-bdd42948fec4', '空亭文苑'],
+                        [7887, '7271c2b9-5092-aa65-fa86-786cf3ecd528', '竹枝书院'],
+                        [10460, '644d48ea-8ee3-3271-43e4-aa1e4d1eb86e', '繁星书海'],
+                        [10499, 'd5c5c552-34cd-55c3-e41f-44fe443cbe56', '红炎文轩'],
+                        [9882, '3b4f7cca-ffea-086a-9444-5dfcd6c79794', '绘色阅读'],
+                        [9876, '68e66280-c3d7-e84a-8fe1-94b1f526f5b6', '若汐文海'],
+                        [10771, '982bde3b-5eb5-431e-a3f6-bac99735b759', '莫宇文库'],
+                        [10067, '9bcd9dae-7718-91da-ea16-ea224e22164c', '莹悦看吧'],
+                        [10473, '7864d9a8-df4b-d105-4f2e-e30179c2974a', '蓝翼文海'],
+                        [10024, '1b5c7edc-038e-54ad-dad5-f30216dd8c0a', '虎啸文选'],
+                        [10095, 'ced46ef2-5759-6169-7e40-5624215f1f91', '蛟龙书楼'],
+                        [9883, '0d525b30-997b-c727-9f03-1dea301f7ec0', '西洲书舍'],
+                        [10668, '9839e7a4-5fc2-c05b-faaf-0ed5f2cdce81', '豪天文轩'],
+                        [9866, '04cad8fd-c599-12e8-4d66-80cab639b050', '豪金书社'],
+                        [7889, 'bf0fd628-c244-52c5-ae94-d5fa0ec91f4d', '踏莎小说阅读'],
+                        [10044, '6e87b452-dcb3-9c10-de65-c5919fa3d73d', '追光悦读'],
+                        [10200, '81c06b81-1da5-53c4-3b4e-5f63a83f1579', '锦墨书楼'],
+                        [9916, '58e354ee-5f24-f02f-ee90-5f6f0e5d97c8', '锦溪书楼'],
+                        [9688, 'e0a5f28c-6009-560a-6dc6-975e5e53cc74', '阅欣文学'],
+                        [9910, '5e3f1ef2-b497-8560-810e-ee92882f0726', '阅胜文选'],
+                        [10498, '89266631-e8fa-ea77-075e-d38d37a654c1', '阳俊文海'],
+                        [10770, 'e389c082-d1ca-cb2a-6d0b-915db869363a', '雁风文轩'],
+                        [9900, '874d0ec8-1e85-f061-e095-d9997597bd8e', '雅阁文社'],
+                        [7866, 'dfb7dcdc-a6b1-e03e-2f57-9bfcb80a32c4', '雨尘书阁'],
+                        [10474, '611bdc19-946c-945d-bcf8-2a64ca2919c0', '雪松文库'],
+                        [9875, 'b1fea7ac-4e0b-4546-e41a-9181af98515d', '霄雄文学'],
+                        [10419, '8e4c73f2-50e4-dd33-3e06-63c3d8f38c04', '霜华文库'],
+                        [9938, 'fc61e6fd-bf13-44ea-73e9-609971b83456', '青云文轩'],
+                        [10007, '8bc52ea8-64ec-32cf-3ef6-463abe469eed', '青峰悦读'],
+                        [8939, 'b016dcab-c002-ae71-f8ad-d5ffd35d3bbc', '青葱看吧'],
+                        [10014, '4d5441a4-da30-15e4-0186-aa2aea21b286', '青霞文苑'],
+                        [10418, 'e3a32b05-ac1c-f518-af33-3c0d3883307b', '飞鸿文海'],
+                        [9971, '5c625d14-8452-847e-09bd-33d30126ed31', '魅力书楼'],
+                        [9922, 'd1e77bc9-3875-ad44-2253-4201f70e0bb4', '鹿鸣文库'],
+                        [10012, '90e4a5fc-4625-9710-6ab1-561ce0de0270', '麒麟墨选'],
+                        [10199, '16abc367-31e0-f0aa-4cd4-9cc64e891d8a', '鼎月文苑'],
+                        [10475, 'f50879de-036f-7ec7-39dc-44ecda037dea', '鼎盛文海'],
+                        [10901, '8135ee68-4255-8da3-9b35-cef2b942f6a2', '孤风书楼'],
+                        [10899, 'a8425c20-ee9a-b6ad-b8da-e6b74621be5c', '冷雁文海'],
+                        [10896, 'b24bca0d-3d31-0127-04e0-b2254ebb27e9', '南烟书楼'],
+                        [10840, 'e69ab01b-3725-4e70-670b-408b82860fe3', '鹤鸣看吧'],
+                        [10841, 'dc577efd-aa90-4dd6-f8ab-c42b38f84faa', '深洋书楼'],
+                        [10842, '4cc12af5-2c86-2217-e5e1-ce1b28fa4758', '航远文阁'],
+                        [10843, 'ca5920b0-59cb-a55e-9fd9-e5095a29c04f', '神武文轩'],
+                        [10845, 'cfc93bd7-723e-0341-c6ef-c25253a8caa6', '茗垣文轩'],
+                        [10995, '2e537d2a-6b5c-a862-2cf0-30aa46bcad6e', '耀杰书海'],
+                        [10997, 'd458def2-35c0-c577-d5a3-259225b9b76b', '锦凌文选'],
+                        [10996, 'b1bde6ca-c518-ea3c-cf5f-5d30286b34b4', '清涛文海'],
+                        [10998, 'b2b056ee-26a6-5868-874b-ab36f372900c', '墨景文轩'],
+                        [10999, '630fda00-13ff-f625-05aa-8d1862d385da', '炫熙书馆'],
+                        [11021, '90a1e372-8ce8-cd8f-e8c5-e9f603f0f9ba', '狂涛文轩'],
+                        [11020, '73445fa0-6145-149f-58eb-772eb7c78481', '展宸书楼'],
+                        [11011, '6fd7df66-8dc0-8939-759e-8e34d759e34a', '阳曜文海'],
+                        [11009, 'f1d96f4a-2a3c-b24b-1f36-2398cebc19ad', '高韵书楼'],
+                        [11008, 'd0a3a898-9e87-6adf-00ed-86b68040ecb0', '成弘书楼'],
+                        [10963, '3cf33177-fd73-68a5-6095-0d8b36083a9c', '旋锋文轩'],
+                        [10962, 'c3f38863-6a7e-33aa-a44e-04b901ee1f04', '赤虹文海'],
+                        [10961, '11306f81-cfea-ab8f-f0a0-2da8f0acdea5', '飘霜书海'],
+                        [10942, '1235a146-7a1d-3a68-9f79-ede48cb8442c', '月瑶看书'],
+                        [10941, '3fd1d09f-c66c-bee7-021d-41510a673339', '婉婉阅读'],
+                        [10908, '2994b1bb-b51b-acd3-cad5-0055cf28104c', '君浩文阅'],
+                        [10906, 'a419c6fd-9e10-c9d9-ed9a-02814014fdc3', '星汉文海'],
+                        [10879, '617a71dc-9ae0-3d5e-d373-ee833edc25df', '华晖文轩'],
+                        [10878, 'd76b661f-75d5-60e7-f596-26d61054348e', '承载书楼'],
+                        [10877, 'fe3c50c4-5fe7-36a1-6dc5-40ca27b3f671', '鸿振书馆'],
+                        [11076, '9a9bfeaf-2abc-495b-83f5-5f00d36cc54b', '正德书楼'],
+                        [11075, '1ab64fb6-aab3-f13a-d2f9-e079fb17d66e', '泽宇文海'],
+                        [11074, 'c45b1a56-44e3-384e-25cf-63b987d6a297', '吉本书海'],
+                        [11073, 'e0bf65b9-f592-1a1a-aac0-fbf710e40847', '高岑文轩'],
+                        [11044, '0cdea0ed-7a09-36f0-750e-61b75652bc87', '烈风文海'],
+                        [11043, 'b605a351-81b8-910d-b0a8-66c9dc59374d', '霸皇书楼'],
+                        [11042, '35902525-03d5-e99b-ea69-d5ed1c716da1', '辰宇书馆'],
+                        [11039, '5abdd0ec-408e-ded3-d725-ac08e93eae90', '吹雪文库'],
+                        [11038, 'd364471e-963b-e8a7-e89b-06568c831500', '飞羽书楼'],
+                        [10900, 'e9136409-133f-37e1-7585-3f4f1675d20f', '琦玉文库'],
+                        [10998, 'b2b056ee-26a6-5868-874b-ab36f372900c', '墨景文轩'],
+                        [10996, 'b1bde6ca-c518-ea3c-cf5f-5d30286b34b4', '清涛文海']
+                        ]
 
-zzy_account_list =[
-['vip-songyi','098f17cc73cc4a74861ff4a87e3b526c',''],
-['vip-wanger','aefabe89dfb84227bf7dae8ef0a59c89',''],
-['vip-kuangwu','de5157d0e778400d84b2730626bd5787',''],
-['vip-guangzhou500','ecce5c8566c24d63b8c829a10deb8601',''],
-['vip-zhousi','b226af5f3cb243638b4a29d1a343d10d',''],
-['vip-diwu1','7f2a1f03e53742c4acc49814b536ff59',''],
-['vip-toutiao100','10ea6f1132084d86940c9b8b56fc5dad',''],
-['vip-guangzhou3000','bac6f3c5d58244559b244c52bd1696b2',''],
-['vip-guangzhou600','71873a3750bf49cdabb7a10441742950',''],
-['vip-guangzhou3','385c7fadd05649e689a6bf272f3d59a7',''],
-['vip-guangzhou5004','b8737034f23b4e5b9fa6256166faea57',''],
-['vip-guangzhou5','5c65fd4b632a401097b6ca524eab551f',''],
-['vip-guangzhou6','0939540ca8f34401b20b36e6c5409031',''],
-['vip-guangzhoujiuqi','a7ede742affe457e8da4da181eb643d3',''],
-['vip-guangzhou5003','9fefdc098ae54fe283dd2c5a6019b769',''],
-['vip-qucheng2','e8cee00b1c3d42a6a75810a0d90e9e6a',''],
-['vip-quchengsanqi','afc1e30e72ad41bf90c21aac41cb6ee1',''],
-['vip-qucheng7qi','f8e7b801e63e43218111c1d8a5faf857',''],
-['vip-qucheng8qi','17838a8f9ea64f809a88a5cd872c7375',''],
-['vip-quchengjiuqi','80034ad8e7874ab99242ccce30ac1861',''],
-['vip-ccsq','d8100098bf0d4fdb85e62150bb15a0b9',''],
-['vip-qucheng11qi','e274b5bb5245444f806bc36b688f7a44',''],
-['vip-qucheng12qi','b9de5355acbd414cb12f97786efe0376',''],
-['vip-qucheng13qi','c8c91b7fdb8e476d81160c865f9bbf7b',''],
-['vip-qucheng14qi','c9c27f53e40b4372a2bfe83dbd8fde03',''],
-['vip-qucheng15qi','81909093d1db4374b5c545031380f3fe',''],
-['vip-zanxiang10','04a2c53fbe3546dd8feb475592f9855c',''],
-['ch-zzsw','d1a8e23df03a411a8353896e00751b23',''],
-['ch-zhixiang','d0fc32aefdfb46ad959d6a09943b0d9e',''],
-['ch-wenlan','520514c9c0cf46e19f0707ec28113a8b',''],
-['ch-qxsww','b31211c625244e1a8123adf866a74935',''],
-['ch-xixsc','25fc3c26d388410dbdb6ea5ce792fc1e',''],
-['ch-zzsw5','fd5b6b28997f4880b398d0188f0fe68a',''],
-['ch-yysf66','b194a98901ad4508aa0a984deedc35a5',''],
-['ch-chyd','370c8494fd0c480f8c0b583d5eb3bd54',''],
-['ch-xiangx5','4a196a83056d43ed82db2a9f941cd6cb',''],
-['ch-shwg','d406794893de4175ab948fd028e43468',''],
-['vip-diliu','0858b1566e0c4debb4cab808a0e207f7',''],
-['ch-haotian2','7dd4a99a49b340a2a02822d9a83f64a8',''],
-['ch-fysh6','645a6357d3ea413098f689dbf3d70c68',''],
-['vip-qucheng16qi','bca1090368d44ec8a498d26e02ba06fe',''],
-['vip-qucheng17qi','fd31bc211b4f42908163f68fdeabf869',''],
-['vip-刘勇8','e35df1ac30b844eb81bd620674dc6937','清勇6月'],
-['110456b2078','8621335fe2f61b7afa5d8697ba7669b1','趣程21期'],
-['110512df033','4768493cc3c7517f1b3fcd8bfeeb80ed','趣程22期'],
-#['1108701f1d6','0f9c0f8429d1a16a8a78c2306e7a4db3','清勇7月'],
-#['110870010d2','fb368fe82522503d06880d19c938e10c','清勇7月'],
-['110870010d2','fb368fe82522503d06880d19c938e10c','清勇7月','1108701f1d6','0f9c0f8429d1a16a8a78c2306e7a4db3'],
-['1109652c8b6','be5b9d099ccec53524e305b4bfd96edc','趣程23期'],
-['11092522a7f','bbd92f3898a2518d3456246b8b364de5','阳光1期'],
-['1109295d56c','9bb955186597882ac473e86ba4576158','趣程20期'],
-['1119168245a','67d4941065fb2ce4e601fd156220c579','趣程19期'],
-#['106672e2105','0c3f3ab6d9a82fb515fe3dd906d4d96b','清勇6月']
-['112645ad567','67861e28b58a809ffc5af81a17e7de1f','广州10期'],
-['113100128c7','adaa2b8fb53274453faaa0a70233562e','趣程25期'],
-['1132659da72','de2fd503c8f0e11dc35e54d5cd1db7b5','清勇8月'],
-['1135505cb0b','ca07e8bd0096d7e7d5d64b1783bb564e','趣程24期']]
+huasheng_account_list = [['259900', '72b49bebb7fc8df83feac8c4ed5c541b', '趣程16期'],
+                         ['269900', '65e6d003b58ee73b5406e6cc472ebf3e', '趣程14期'],
+                         ['249900', 'f4f1475f604c4185a3e031e961dee637', '趣程17期'],
+                         ['4040635', 'c8bf5346e35f51c7ce228cff4d4a3678', '趣程19期'],
+                         ['2828976', '20c0fb1d20964c2c42a725c72cac8863', '清勇6月'],
+                         ['4747764', 'f350d7edd89bb7f6170b970f071ecb36', '趣程20期'],
+                         ['3737140', 'e786e59b87ebf239fdb43bf267ef4ee2', '趣程13期'],
+                         ['4848597', 'fab68fe238a8df12073295373f9e0ff7', '趣程22期'],
+                         ['5353590', '50fefc21c7dd90cf9b584fe571f1bb64', '趣程21期'],
+                         ['4545355', '968ba35e79d8219c47ca356d19192c6f', '趣程9期'],
+                         ['5858936', '508c03b7f22059f1fa811c1774dbff89', '阳光1期'],
+                         ['6464295', '20ebdb167b8ed58fc406f05cd2b78802', '趣程15期'],
+                         ['6666592', '998aa35d1ed17635484eae5486e750db', '趣程23期'],
+                         ['8282535', 'd61b2231e589571cf2328a7855df335e', '陈冲1期'],
+                         ['104104493', '957ad78e53a7fc2e751d36e6ec5329d5', '广州10期'],
+                         ['102102605', '50126233532d2e4e1796a16e1247d7dc', '趣程24期'],
+                         ['127127862', 'b0af6b9ba284bd6b10b932cdeae96b74', '趣程25期']
+                         ]
 
-ysg_account_list =[['趣程23期',10659,'T3A3LQZVZXN80M1A7OPVYYWT6Q2XPAJX','修明书楼','趣程23期'],
-               ['趣程23期',10660,'T3A3LQZVZXN80M1A7OPVYYWT6Q2XPAJX','绍晖文海','趣程23期'],
-               ['趣程21期',10656,'KXYIOQT29FDH80NUWRV9XUUK4QIOEIAB','赤凰文阁','趣程21期'],
-               ['趣程21期',10678,'KXYIOQT29FDH80NUWRV9XUUK4QIOEIAB','千月书楼','趣程21期'],
-               ['趣程yangg1',10672,'ZR7PM1YA5DQ6JCMVTH3G5TLHI47DG1GF','舒言文海','阳光1期'],
-               ['趣程yangg1',10704,'ZR7PM1YA5DQ6JCMVTH3G5TLHI47DG1GF','向阳文海','阳光1期'],
-                ['趣程清勇6',10675,'B6FK1HFW1V9ZPD6WX0FGBX3WP73E6M5V','璃月文楼','清勇7月'],
-               ['趣程清勇6',10676,'B6FK1HFW1V9ZPD6WX0FGBX3WP73E6M5V','璃月颂书','清勇7月'],
-               ['趣程清勇6',10677,'B6FK1HFW1V9ZPD6WX0FGBX3WP73E6M5V','璃月阅读','清勇7月'],
-               ['趣程15期',10696,'8OC7SNCL46ZEI7JBACXFDM8CP5JM1FSL','盛德文苑','趣程15期'],
-               ['趣程15期',10697,'8OC7SNCL46ZEI7JBACXFDM8CP5JM1FSL','博涉文海','趣程15期'],
-               ['趣程15期',10698,'8OC7SNCL46ZEI7JBACXFDM8CP5JM1FSL','高岑文轩','趣程15期']
+zzy_account_list = [
+    ['vip-songyi', '098f17cc73cc4a74861ff4a87e3b526c', ''],
+    ['vip-wanger', 'aefabe89dfb84227bf7dae8ef0a59c89', ''],
+    ['vip-kuangwu', 'de5157d0e778400d84b2730626bd5787', ''],
+    ['vip-guangzhou500', 'ecce5c8566c24d63b8c829a10deb8601', ''],
+    ['vip-zhousi', 'b226af5f3cb243638b4a29d1a343d10d', ''],
+    ['vip-diwu1', '7f2a1f03e53742c4acc49814b536ff59', ''],
+    ['vip-toutiao100', '10ea6f1132084d86940c9b8b56fc5dad', ''],
+    ['vip-guangzhou3000', 'bac6f3c5d58244559b244c52bd1696b2', ''],
+    ['vip-guangzhou600', '71873a3750bf49cdabb7a10441742950', ''],
+    ['vip-guangzhou3', '385c7fadd05649e689a6bf272f3d59a7', ''],
+    ['vip-guangzhou5004', 'b8737034f23b4e5b9fa6256166faea57', ''],
+    ['vip-guangzhou5', '5c65fd4b632a401097b6ca524eab551f', ''],
+    ['vip-guangzhou6', '0939540ca8f34401b20b36e6c5409031', ''],
+    ['vip-guangzhoujiuqi', 'a7ede742affe457e8da4da181eb643d3', ''],
+    ['vip-guangzhou5003', '9fefdc098ae54fe283dd2c5a6019b769', ''],
+    ['vip-qucheng2', 'e8cee00b1c3d42a6a75810a0d90e9e6a', ''],
+    ['vip-quchengsanqi', 'afc1e30e72ad41bf90c21aac41cb6ee1', ''],
+    ['vip-qucheng7qi', 'f8e7b801e63e43218111c1d8a5faf857', ''],
+    ['vip-qucheng8qi', '17838a8f9ea64f809a88a5cd872c7375', ''],
+    ['vip-quchengjiuqi', '80034ad8e7874ab99242ccce30ac1861', ''],
+    ['vip-ccsq', 'd8100098bf0d4fdb85e62150bb15a0b9', ''],
+    ['vip-qucheng11qi', 'e274b5bb5245444f806bc36b688f7a44', ''],
+    ['vip-qucheng12qi', 'b9de5355acbd414cb12f97786efe0376', ''],
+    ['vip-qucheng13qi', 'c8c91b7fdb8e476d81160c865f9bbf7b', ''],
+    ['vip-qucheng14qi', 'c9c27f53e40b4372a2bfe83dbd8fde03', ''],
+    ['vip-qucheng15qi', '81909093d1db4374b5c545031380f3fe', ''],
+    ['vip-zanxiang10', '04a2c53fbe3546dd8feb475592f9855c', ''],
+    ['ch-zzsw', 'd1a8e23df03a411a8353896e00751b23', ''],
+    ['ch-zhixiang', 'd0fc32aefdfb46ad959d6a09943b0d9e', ''],
+    ['ch-wenlan', '520514c9c0cf46e19f0707ec28113a8b', ''],
+    ['ch-qxsww', 'b31211c625244e1a8123adf866a74935', ''],
+    ['ch-xixsc', '25fc3c26d388410dbdb6ea5ce792fc1e', ''],
+    ['ch-zzsw5', 'fd5b6b28997f4880b398d0188f0fe68a', ''],
+    ['ch-yysf66', 'b194a98901ad4508aa0a984deedc35a5', ''],
+    ['ch-chyd', '370c8494fd0c480f8c0b583d5eb3bd54', ''],
+    ['ch-xiangx5', '4a196a83056d43ed82db2a9f941cd6cb', ''],
+    ['ch-shwg', 'd406794893de4175ab948fd028e43468', ''],
+    ['vip-diliu', '0858b1566e0c4debb4cab808a0e207f7', ''],
+    ['ch-haotian2', '7dd4a99a49b340a2a02822d9a83f64a8', ''],
+    ['ch-fysh6', '645a6357d3ea413098f689dbf3d70c68', ''],
+    ['vip-qucheng16qi', 'bca1090368d44ec8a498d26e02ba06fe', ''],
+    ['vip-qucheng17qi', 'fd31bc211b4f42908163f68fdeabf869', ''],
+    ['vip-刘勇8', 'e35df1ac30b844eb81bd620674dc6937', '清勇6月'],
+    ['110456b2078', '8621335fe2f61b7afa5d8697ba7669b1', '趣程21期'],
+    ['110512df033', '4768493cc3c7517f1b3fcd8bfeeb80ed', '趣程22期'],
+    # ['1108701f1d6','0f9c0f8429d1a16a8a78c2306e7a4db3','清勇7月'],
+    # ['110870010d2','fb368fe82522503d06880d19c938e10c','清勇7月'],
+    ['110870010d2', 'fb368fe82522503d06880d19c938e10c', '清勇7月', '1108701f1d6', '0f9c0f8429d1a16a8a78c2306e7a4db3'],
+    ['1109652c8b6', 'be5b9d099ccec53524e305b4bfd96edc', '趣程23期'],
+    ['11092522a7f', 'bbd92f3898a2518d3456246b8b364de5', '阳光1期'],
+    ['1109295d56c', '9bb955186597882ac473e86ba4576158', '趣程20期'],
+    ['1119168245a', '67d4941065fb2ce4e601fd156220c579', '趣程19期'],
+    # ['106672e2105','0c3f3ab6d9a82fb515fe3dd906d4d96b','清勇6月']
+    ['112645ad567', '67861e28b58a809ffc5af81a17e7de1f', '广州10期'],
+    ['113100128c7', 'adaa2b8fb53274453faaa0a70233562e', '趣程25期'],
+    ['1132659da72', 'de2fd503c8f0e11dc35e54d5cd1db7b5', '清勇8月'],
+    ['1135505cb0b', 'ca07e8bd0096d7e7d5d64b1783bb564e', '趣程24期']]
 
-               ]
+ysg_account_list = [['趣程23期', 10659, 'T3A3LQZVZXN80M1A7OPVYYWT6Q2XPAJX', '修明书楼', '趣程23期'],
+                    ['趣程23期', 10660, 'T3A3LQZVZXN80M1A7OPVYYWT6Q2XPAJX', '绍晖文海', '趣程23期'],
+                    ['趣程21期', 10656, 'KXYIOQT29FDH80NUWRV9XUUK4QIOEIAB', '赤凰文阁', '趣程21期'],
+                    ['趣程21期', 10678, 'KXYIOQT29FDH80NUWRV9XUUK4QIOEIAB', '千月书楼', '趣程21期'],
+                    ['趣程yangg1', 10672, 'ZR7PM1YA5DQ6JCMVTH3G5TLHI47DG1GF', '舒言文海', '阳光1期'],
+                    ['趣程yangg1', 10704, 'ZR7PM1YA5DQ6JCMVTH3G5TLHI47DG1GF', '向阳文海', '阳光1期'],
+                    ['趣程清勇6', 10675, 'B6FK1HFW1V9ZPD6WX0FGBX3WP73E6M5V', '璃月文楼', '清勇7月'],
+                    ['趣程清勇6', 10676, 'B6FK1HFW1V9ZPD6WX0FGBX3WP73E6M5V', '璃月颂书', '清勇7月'],
+                    ['趣程清勇6', 10677, 'B6FK1HFW1V9ZPD6WX0FGBX3WP73E6M5V', '璃月阅读', '清勇7月'],
+                    ['趣程15期', 10696, '8OC7SNCL46ZEI7JBACXFDM8CP5JM1FSL', '盛德文苑', '趣程15期'],
+                    ['趣程15期', 10697, '8OC7SNCL46ZEI7JBACXFDM8CP5JM1FSL', '博涉文海', '趣程15期'],
+                    ['趣程15期', 10698, '8OC7SNCL46ZEI7JBACXFDM8CP5JM1FSL', '高岑文轩', '趣程15期']
 
+                    ]
 
 ##20200921 wending
 wd_account_list = [
-['11790115','VjVIGRX5YgJCGQjC','qucheng15qi@163.com','1023015','趣程15期'],
-['62140324','KUUxPIokqtIrtvHQ','qucheng19qi@163.com','1025010','趣程19期'],        
-['68442881','RFygHhX16LEYYe8i','qucheng20qi@163.com','1014108','趣程20期'],
-['77257999','86nPtJdYLe1k81gE','qucheng21qi@163.com','1021116','趣程21期'],
-['34655048','FepowoPTVhcAlkA7','qucheng22qi@163.com','1026011','趣程22期'],  
-['85233764','KSSwSjlGbuYzp6vn','qucheng23qi@163.com','1023010','趣程23期'],        
-['50465587','E5D1qzGtmhbx5EAS','qucheng24qi@163.com','1025020','趣程24期'],        
-['20853509','M6hPmkEoJcLLbcFL','qucheng25qi@163.com','1025011','趣程25期'],         
-['27390746','4uorQvE8T7ujqCkH','yangguang1qi@163.com','1029008','阳光1期'],
-#['12655840','mu1G69KMUkGiBua5','244541090@qq.com','1029021','清勇'],   
-['56356720','f6BT6W5lD99k1GAQ','chen01qi@163.com','1026016','陈冲1期']
+    ['11790115', 'VjVIGRX5YgJCGQjC', 'qucheng15qi@163.com', '1023015', '趣程15期'],
+    ['62140324', 'KUUxPIokqtIrtvHQ', 'qucheng19qi@163.com', '1025010', '趣程19期'],
+    ['68442881', 'RFygHhX16LEYYe8i', 'qucheng20qi@163.com', '1014108', '趣程20期'],
+    ['77257999', '86nPtJdYLe1k81gE', 'qucheng21qi@163.com', '1021116', '趣程21期'],
+    ['34655048', 'FepowoPTVhcAlkA7', 'qucheng22qi@163.com', '1026011', '趣程22期'],
+    ['85233764', 'KSSwSjlGbuYzp6vn', 'qucheng23qi@163.com', '1023010', '趣程23期'],
+    ['50465587', 'E5D1qzGtmhbx5EAS', 'qucheng24qi@163.com', '1025020', '趣程24期'],
+    ['20853509', 'M6hPmkEoJcLLbcFL', 'qucheng25qi@163.com', '1025011', '趣程25期'],
+    ['27390746', '4uorQvE8T7ujqCkH', 'yangguang1qi@163.com', '1029008', '阳光1期'],
+    # ['12655840','mu1G69KMUkGiBua5','244541090@qq.com','1029021','清勇'],
+    ['56356720', 'f6BT6W5lD99k1GAQ', 'chen01qi@163.com', '1026016', '陈冲1期']
 ]
-
-
-
-
-
-
-
-
-
-
-
-
-

+ 39 - 35
dgp/tests/check_order.py

@@ -27,14 +27,12 @@ __title__ = '每日凌晨空闲时检查本地数据库中的订单数据是否
 import datetime
 import hashlib
 import math
+import random
 import time
 from concurrent.futures import ProcessPoolExecutor
 from urllib import parse
 
 import requests
-import random
-
-from apscheduler.schedulers.blocking import BlockingScheduler
 
 import account_list_zwg as al
 from MySQLConnection import MySQLConnection
@@ -69,6 +67,7 @@ def get_yuewen_order(st, et):
     print('阅文订单数量:', len(total_order), '执行时长(秒):', date_util.getCurrentSecondTime() - start_exec_seconds)
     return total_order
 
+
 def get_yuewen_order_task(st, et, account):
     order_list = ()
     url = 'https://open.yuewen.com/cpapi/wxRecharge/querychargelog'
@@ -147,10 +146,10 @@ def get_yuewen_order_task(st, et, account):
                 order_list = order_list + ((y),)
 
         if total_count > 100:
-            page_while_count  = math.ceil(total_count / 100) + 1
+            page_while_count = math.ceil(total_count / 100) + 1
             if page_while_count > 2:
                 sleep_seconds = random.randint(60, 70)
-                print('阅文获取订单数据线程休眠', sleep_seconds,'秒,因为该接口有一分钟的限制')
+                print('阅文获取订单数据线程休眠', sleep_seconds, '秒,因为该接口有一分钟的限制')
                 time.sleep(sleep_seconds)
 
             for page in range(2, page_while_count):
@@ -243,6 +242,7 @@ def get_zhangdu_order(st, et):
     print('掌读订单数量:', len(total_order), '执行时长(秒):', date_util.getCurrentSecondTime() - start_exec_seconds)
     return total_order
 
+
 def get_zhangdu_order_task(st, et, account):
     order_list = ()
     url = 'https://api.zhangdu520.com/channel/getorder'
@@ -273,35 +273,35 @@ def get_zhangdu_order_task(st, et, account):
             continue
 
         for page in range(1, pageCount + 1):  # 分页
-                params = {
-                    'uid': uid,
-                    'timestamp': timestamp,
-                    'sign': sign,
-                    'starttime': starttime,
-                    'endtime': endtime,
-                    'page': page
-                }
-                list2 = requests.get(url=url, params=params).json()
-                if 'data' in list2.keys():
-                    for b in list2['data']['list']:
-                        if b['status'] == '1':
-                            c = {}
-                            c['amount'] = b['amount']
-                            c['channel_id'] = uid
-                            c['order_id'] = str(b['orderno'])
-                            c['order_time'] = b['ctime']
-                            c['user_id'] = b['openid']
-                            c['platform'] = '掌读'
-                            c['channel'] = channel
-                            c['reg_time'] = b['regtime']
-                            c['from_novel'] = ''
-                            c['stage'] = ''
-                            c['date'] = ((int(b['ctime']) + 8 * 3600) // 86400) * 86400 - 8 * 3600
-
-                            x = sorted(c.items(), key=lambda item: item[0])
-                            x = dict(x)
-                            x = tuple(x.values())
-                            order_list = order_list + ((x),)
+            params = {
+                'uid': uid,
+                'timestamp': timestamp,
+                'sign': sign,
+                'starttime': starttime,
+                'endtime': endtime,
+                'page': page
+            }
+            list2 = requests.get(url=url, params=params).json()
+            if 'data' in list2.keys():
+                for b in list2['data']['list']:
+                    if b['status'] == '1':
+                        c = {}
+                        c['amount'] = b['amount']
+                        c['channel_id'] = uid
+                        c['order_id'] = str(b['orderno'])
+                        c['order_time'] = b['ctime']
+                        c['user_id'] = b['openid']
+                        c['platform'] = '掌读'
+                        c['channel'] = channel
+                        c['reg_time'] = b['regtime']
+                        c['from_novel'] = ''
+                        c['stage'] = ''
+                        c['date'] = ((int(b['ctime']) + 8 * 3600) // 86400) * 86400 - 8 * 3600
+
+                        x = sorted(c.items(), key=lambda item: item[0])
+                        x = dict(x)
+                        x = tuple(x.values())
+                        order_list = order_list + ((x),)
 
         starttime = starttime + timespace
         endtime = min(et, starttime + timespace)
@@ -344,6 +344,7 @@ def get_huasheng_order(st, et):
     print('花生订单数量:', len(total_order), '执行时长(秒):', date_util.getCurrentSecondTime() - start_exec_seconds)
     return total_order
 
+
 def get_huasheng_order_task(st, et, account, merchant):
     order_list = ()
 
@@ -454,6 +455,7 @@ def get_zzy_order(st, et):
     print('掌中云订单数量:', len(total_order), '执行时长(秒):', date_util.getCurrentSecondTime() - start_exec_seconds)
     return total_order
 
+
 def get_zzy_order_task(st, et, account, item):
     # 掌中云的时间格式比较特殊,转换下
     st = platform_util.get_zhangzhongyun_format_time(st)
@@ -517,6 +519,7 @@ def get_zzy_order_task(st, et, account, item):
 
     return order_list
 
+
 ##《5》 悠书阁
 def get_ysg_order(st, et):
     start_exec_seconds = date_util.getCurrentSecondTime()
@@ -648,6 +651,7 @@ def mysql_insert_order(data):
         finally:
             connect.close()
 
+
 # 获取各平台的订单数量
 def mysql_select_platform_order_count(date):
     sql = 'SELECT platform, COUNT(1) AS num FROM quchen_text.`order_zwg` WHERE date = %s GROUP BY platform'
@@ -662,6 +666,7 @@ def mysql_select_platform_order_count(date):
         connect.close()
     return platform_order_count
 
+
 def start_all_job():
     start_exec_seconds = date_util.getCurrentSecondTime()
 
@@ -736,7 +741,6 @@ def start_all_job():
     #         else:
     #             print('什么鬼平台:', platform)
 
-
     print('订单检查执行时间(秒):', date_util.getCurrentSecondTime() - start_exec_seconds)
 
 

+ 57 - 51
dgp/tests/check_order_new.py

@@ -27,15 +27,13 @@ __title__ = '每日凌晨空闲时检查本地数据库中的订单数据是否
 import datetime
 import hashlib
 import math
+import random
 import time
+import traceback
 from concurrent.futures import ProcessPoolExecutor
 from urllib import parse
 
 import requests
-import random
-import traceback
-
-from apscheduler.schedulers.blocking import BlockingScheduler
 
 import account_list_zwg as al
 from MySQLConnection import MySQLConnection
@@ -72,6 +70,7 @@ def get_yuewen_order(st, et):
     print('阅文订单数量:', len(total_order_list), '执行时长(秒):', date_util.getCurrentSecondTime() - start_exec_seconds)
     return total_order_list
 
+
 def get_yuewen_order_task(st, et, account):
     order_list = ()
     url = 'https://open.yuewen.com/cpapi/wxRecharge/querychargelog'
@@ -150,10 +149,10 @@ def get_yuewen_order_task(st, et, account):
                 order_list = order_list + ((y),)
 
         if total_count > 100:
-            page_while_count  = math.ceil(total_count / 100) + 1
+            page_while_count = math.ceil(total_count / 100) + 1
             if page_while_count > 2:
                 sleep_seconds = random.randint(60, 70)
-                print('阅文获取订单数据线程休眠', sleep_seconds,'秒,因为该接口有一分钟的限制')
+                print('阅文获取订单数据线程休眠', sleep_seconds, '秒,因为该接口有一分钟的限制')
                 time.sleep(sleep_seconds)
 
             for page in range(2, page_while_count):
@@ -247,6 +246,7 @@ def get_zhangdu_order(st, et):
     print('掌读订单数量:', len(total_order_list), '执行时长(秒):', date_util.getCurrentSecondTime() - start_exec_seconds)
     return total_order_list
 
+
 def get_zhangdu_order_task(st, et, account):
     order_list = ()
     url = 'https://api.zhangdu520.com/channel/getorder'
@@ -277,35 +277,35 @@ def get_zhangdu_order_task(st, et, account):
             continue
 
         for page in range(1, pageCount + 1):  # 分页
-                params = {
-                    'uid': uid,
-                    'timestamp': timestamp,
-                    'sign': sign,
-                    'starttime': starttime,
-                    'endtime': endtime,
-                    'page': page
-                }
-                list2 = requests.get(url=url, params=params).json()
-                if 'data' in list2.keys():
-                    for b in list2['data']['list']:
-                        if b['status'] == '1':
-                            c = {}
-                            c['amount'] = b['amount']
-                            c['channel_id'] = uid
-                            c['order_id'] = str(b['orderno'])
-                            c['order_time'] = b['ctime']
-                            c['user_id'] = b['openid']
-                            c['platform'] = '掌读'
-                            c['channel'] = channel
-                            c['reg_time'] = b['regtime']
-                            c['from_novel'] = ''
-                            c['stage'] = ''
-                            c['date'] = ((int(b['ctime']) + 8 * 3600) // 86400) * 86400 - 8 * 3600
-
-                            x = sorted(c.items(), key=lambda item: item[0])
-                            x = dict(x)
-                            x = tuple(x.values())
-                            order_list = order_list + ((x),)
+            params = {
+                'uid': uid,
+                'timestamp': timestamp,
+                'sign': sign,
+                'starttime': starttime,
+                'endtime': endtime,
+                'page': page
+            }
+            list2 = requests.get(url=url, params=params).json()
+            if 'data' in list2.keys():
+                for b in list2['data']['list']:
+                    if b['status'] == '1':
+                        c = {}
+                        c['amount'] = b['amount']
+                        c['channel_id'] = uid
+                        c['order_id'] = str(b['orderno'])
+                        c['order_time'] = b['ctime']
+                        c['user_id'] = b['openid']
+                        c['platform'] = '掌读'
+                        c['channel'] = channel
+                        c['reg_time'] = b['regtime']
+                        c['from_novel'] = ''
+                        c['stage'] = ''
+                        c['date'] = ((int(b['ctime']) + 8 * 3600) // 86400) * 86400 - 8 * 3600
+
+                        x = sorted(c.items(), key=lambda item: item[0])
+                        x = dict(x)
+                        x = tuple(x.values())
+                        order_list = order_list + ((x),)
 
         starttime = starttime + timespace
         endtime = min(et, starttime + timespace)
@@ -354,6 +354,7 @@ def get_huasheng_order(st, et):
     print('花生订单数量:', len(total_order_list), '执行时长(秒):', date_util.getCurrentSecondTime() - start_exec_seconds)
     return total_order_list
 
+
 def get_huasheng_order_task(st, et, account, merchant):
     order_list = ()
 
@@ -388,13 +389,14 @@ def get_huasheng_order_task(st, et, account, merchant):
 
             if 'data' not in response_result_json.keys() or len(response_result_json['data']) == 0:
                 print('花生账号【{key}】, 渠道【{merchant_id}:{merchant_name}】本次请求数据为空,响应报文【{result}】'
-                      .format(key=apiKey, merchant_id=merchant_id, merchant_name=merchant_name, result=response_result_json))
+                      .format(key=apiKey, merchant_id=merchant_id, merchant_name=merchant_name,
+                              result=response_result_json))
 
             total_count = response_result_json['count']
             order_item_list = response_result_json['data']
 
             for order_item in order_item_list:
-                if order_item['order_status'] == 1:#1为已支付
+                if order_item['order_status'] == 1:  # 1为已支付
                     order = {}
                     ##dtime = datetime.datetime.strptime(order_item['pay_at'],"%Y-%m-%d")
                     ##order['date']= ((int(time.mktime(dtime.timetuple()))+8*3600)//86400)*86400-8*3600
@@ -402,7 +404,7 @@ def get_huasheng_order_task(st, et, account, merchant):
                     order['order_id'] = order_item['trans_id']
                     order['order_time'] = order_item['pay_at']
                     order['reg_time'] = order_item['join_at']
-                    #TODO 花生的时间需要统一
+                    # TODO 花生的时间需要统一
                     order['date'] = (start_time + 8 * 3600) // 86400 * 86400 - 8 * 3600
                     order['channel'] = merchant_name
                     order['channel_id'] = merchant_id
@@ -424,7 +426,7 @@ def get_huasheng_order_task(st, et, account, merchant):
 
             page = page + 1
 
-        start_time = start_time + 86400 #天数加1
+        start_time = start_time + 86400  # 天数加1
 
     return order_list
 
@@ -447,7 +449,7 @@ def get_zzy_order(st, et):
         secert = account[1]
         sign = md5value(secert + 'key=' + key)
         params = 'key=' + key + '&sign=' + sign
-        response_result_json = requests.get(url + params).json()# 获取子渠道列表
+        response_result_json = requests.get(url + params).json()  # 获取子渠道列表
 
         if 'data' not in response_result_json.keys():
             print('掌中云账号【{key}】本次请求数据为空,响应报文【{result}】'.format(key=key, result=response_result_json))
@@ -469,6 +471,7 @@ def get_zzy_order(st, et):
     print('掌中云订单数量:', len(total_order_list), '执行时长(秒):', date_util.getCurrentSecondTime() - start_exec_seconds)
     return total_order_list
 
+
 def get_zzy_order_task(st, et, account, channel):
     # 掌中云的时间格式比较特殊,转换下
     st = platform_util.get_zhangzhongyun_format_time(st)
@@ -488,12 +491,15 @@ def get_zzy_order_task(st, et, account, channel):
     per_page = str(1000)
     get_time = st
     limit_time = et
-    gte = parse.urlencode({'created_at[gte]': get_time}) #gte就是ge 大于等于开始时间
-    lt = parse.urlencode({'created_at[lt]': limit_time}) #小于 结束时间
+    gte = parse.urlencode({'created_at[gte]': get_time})  # gte就是ge 大于等于开始时间
+    lt = parse.urlencode({'created_at[lt]': limit_time})  # 小于 结束时间
 
     while True:
-        sign = md5value(secert + 'channel_id=' + str(channel_id) + '&created_at[gte]=' + get_time + '&created_at[lt]=' + limit_time + '&key=' + key + '&page=' + str(page) + '&per_page=' + per_page + '&status=' + status)
-        params = 'channel_id=' + str(channel_id) + '&' + gte + '&' + lt + '&page=' + str(page) + '&per_page=' + per_page + '&status=' + status + '&key=' + key + '&sign=' + sign
+        sign = md5value(secert + 'channel_id=' + str(
+            channel_id) + '&created_at[gte]=' + get_time + '&created_at[lt]=' + limit_time + '&key=' + key + '&page=' + str(
+            page) + '&per_page=' + per_page + '&status=' + status)
+        params = 'channel_id=' + str(channel_id) + '&' + gte + '&' + lt + '&page=' + str(
+            page) + '&per_page=' + per_page + '&status=' + status + '&key=' + key + '&sign=' + sign
 
         response_result_json = requests.get(order_url + params).json()
 
@@ -502,8 +508,8 @@ def get_zzy_order_task(st, et, account, channel):
                   .format(key=key, channel_id=channel_id, channel_name=channel_name, result=response_result_json))
             break
 
-        total_count = response_result_json['data']['count'] #总数量
-        order_item_list = response_result_json['data']['items'] #订单列表
+        total_count = response_result_json['data']['count']  # 总数量
+        order_item_list = response_result_json['data']['items']  # 订单列表
 
         for order_item in order_item_list:
             order = {}
@@ -539,6 +545,7 @@ def get_zzy_order_task(st, et, account, channel):
 
     return order_list
 
+
 ##《5》 悠书阁
 def get_ysg_order(st, et):
     start_exec_seconds = date_util.getCurrentSecondTime()
@@ -673,6 +680,7 @@ def mysql_insert_order(data):
         finally:
             connect.close()
 
+
 # 获取各平台的订单数量
 def mysql_select_platform_order_count(date):
     sql = 'SELECT platform, COUNT(1) AS num FROM quchen_text.`order_zwg` WHERE date = %s GROUP BY platform'
@@ -688,16 +696,15 @@ def mysql_select_platform_order_count(date):
         connect.close()
     return platform_order_count
 
+
 def start_all_job():
     start_exec_seconds = date_util.getCurrentSecondTime()
 
     st_unix = date_util.getYesterdayStartTime()
     et_unix = date_util.getTodayStartTime()
 
-    st_unix = 1601136000 #2020/9/27 0:0:0
-    et_unix = 1601308800 #2020/9/29 0:0:0
-
-
+    st_unix = 1601136000  # 2020/9/27 0:0:0
+    et_unix = 1601308800  # 2020/9/29 0:0:0
 
     print('查询开始时间:', st_unix, date_util.getSecondsToDatetime(st_unix))
     print('查询结束时间:', et_unix, date_util.getSecondsToDatetime(et_unix))
@@ -767,7 +774,6 @@ def start_all_job():
     #         else:
     #             print('什么鬼平台:', platform)
 
-
     print('订单检查执行时间(秒):', date_util.getCurrentSecondTime() - start_exec_seconds)
 
 

+ 74 - 74
dgp/tests/demo/a.py

@@ -6,78 +6,78 @@ get_data_hourly.py
 
 
 def get_zzy_order(st, et):
-	time1 = time.time()
-	API_list = al.zzy_account_list
-	r = ()
+    time1 = time.time()
+    API_list = al.zzy_account_list
+    r = ()
 
-	for x in API_list:
-		my_key = x[0]
-		secert = x[1]
-		stage = x[2]
-		my_sign = md5value(secert + 'key=' + my_key)
-		url = 'https://openapi.818tu.com/partners/channel/channels/list?'
-		parameter = 'key=' + my_key + '&sign=' + my_sign
-		channel_list = requests.get(url + parameter)  # 获取子渠道列表
+    for x in API_list:
+        my_key = x[0]
+        secert = x[1]
+        stage = x[2]
+        my_sign = md5value(secert + 'key=' + my_key)
+        url = 'https://openapi.818tu.com/partners/channel/channels/list?'
+        parameter = 'key=' + my_key + '&sign=' + my_sign
+        channel_list = requests.get(url + parameter)  # 获取子渠道列表
 
-		if 'data' in channel_list.json().keys():
-			items = channel_list.json()['data']['items']
-		elif len(x) > 3:
-			my_key = x[3]
-			secert = x[4]
-			my_sign = md5value(secert + 'key=' + my_key)
-			url = 'https://openapi.818tu.com/partners/channel/channels/list?'
-			parameter = 'key=' + my_key + '&sign=' + my_sign
-			channel_list = requests.get(url + parameter)
-			items = channel_list.json()['data']['items']
-		else:
-			print(channel_list.json())
-			items = []
+        if 'data' in channel_list.json().keys():
+            items = channel_list.json()['data']['items']
+        elif len(x) > 3:
+            my_key = x[3]
+            secert = x[4]
+            my_sign = md5value(secert + 'key=' + my_key)
+            url = 'https://openapi.818tu.com/partners/channel/channels/list?'
+            parameter = 'key=' + my_key + '&sign=' + my_sign
+            channel_list = requests.get(url + parameter)
+            items = channel_list.json()['data']['items']
+        else:
+            print(channel_list.json())
+            items = []
 
-		if items != []:
-			for item in items:  # 获取channel_id 后逐个拉取历史orders
-				channel_id = item['id']
-				channel = item['nickname']
-				status = str(1)
-				per_page = str(1000)
-				limit_time = et
-				get_time = st
-				lt = parse.urlencode({'created_at[lt]': limit_time})
-				gt = parse.urlencode({'created_at[gte]': get_time})
-				url_1 = 'https://openapi.818tu.com/partners/channel/orders/list?'
-				my_sign_1 = md5value(secert + 'channel_id=' + str(
-					channel_id) + '&created_at[gte]=' + get_time + '&created_at[lt]=' + limit_time + '&key=' + my_key + '&per_page=' + per_page + '&status=' + status)
-				parameter_1 = 'channel_id=' + str(
-					channel_id) + '&' + gt + '&' + lt + '&per_page=' + per_page + '&status=' + status + '&key=' + my_key + '&sign=' + my_sign_1
-				orders = requests.get(url_1 + parameter_1)
-				t = orders.json()['data']['count'] // int(per_page) + 1
-				for page in range(1, t + 1):
-					my_sign_2 = md5value(secert + 'channel_id=' + str(
-						channel_id) + '&created_at[gte]=' + get_time + '&created_at[lt]=' + limit_time + '&key=' + my_key + '&page=' + str(
-						page) + '&per_page=' + per_page + '&status=' + status)
-					parameter_2 = 'channel_id=' + str(channel_id) + '&' + gt + '&' + lt + '&page=' + str(
-						page) + '&per_page=' + per_page + '&status=' + status + '&key=' + my_key + '&sign=' + my_sign_2
-					orders_1 = requests.get(url_1 + parameter_2)
-					b = orders_1.json()['data']['items']
+        if items != []:
+            for item in items:  # 获取channel_id 后逐个拉取历史orders
+                channel_id = item['id']
+                channel = item['nickname']
+                status = str(1)
+                per_page = str(1000)
+                limit_time = et
+                get_time = st
+                lt = parse.urlencode({'created_at[lt]': limit_time})
+                gt = parse.urlencode({'created_at[gte]': get_time})
+                url_1 = 'https://openapi.818tu.com/partners/channel/orders/list?'
+                my_sign_1 = md5value(secert + 'channel_id=' + str(
+                    channel_id) + '&created_at[gte]=' + get_time + '&created_at[lt]=' + limit_time + '&key=' + my_key + '&per_page=' + per_page + '&status=' + status)
+                parameter_1 = 'channel_id=' + str(
+                    channel_id) + '&' + gt + '&' + lt + '&per_page=' + per_page + '&status=' + status + '&key=' + my_key + '&sign=' + my_sign_1
+                orders = requests.get(url_1 + parameter_1)
+                t = orders.json()['data']['count'] // int(per_page) + 1
+                for page in range(1, t + 1):
+                    my_sign_2 = md5value(secert + 'channel_id=' + str(
+                        channel_id) + '&created_at[gte]=' + get_time + '&created_at[lt]=' + limit_time + '&key=' + my_key + '&page=' + str(
+                        page) + '&per_page=' + per_page + '&status=' + status)
+                    parameter_2 = 'channel_id=' + str(channel_id) + '&' + gt + '&' + lt + '&page=' + str(
+                        page) + '&per_page=' + per_page + '&status=' + status + '&key=' + my_key + '&sign=' + my_sign_2
+                    orders_1 = requests.get(url_1 + parameter_2)
+                    b = orders_1.json()['data']['items']
 
-					for a in b:
-						c = {}
-						c['user_id'] = str(a['member']['openid'])
-						c['channel'] = channel
-						c['reg_time'] = a['member']['created_at']
-						c['channel_id'] = channel_id
-						c['amount'] = round(a['price'] / 100, 2)
-						c['order_id'] = str(a['id'])
-						c['order_time'] = a['created_at']
-						c['platform'] = '掌中云'
-						dtime = datetime.datetime.strptime(a['created_at'][0:10], "%Y-%m-%d")
-						c['date'] = ((int(time.mktime(dtime.timetuple())) + 8 * 3600) // 86400) * 86400 - 8 * 3600
-						c['stage'] = stage
+                    for a in b:
+                        c = {}
+                        c['user_id'] = str(a['member']['openid'])
+                        c['channel'] = channel
+                        c['reg_time'] = a['member']['created_at']
+                        c['channel_id'] = channel_id
+                        c['amount'] = round(a['price'] / 100, 2)
+                        c['order_id'] = str(a['id'])
+                        c['order_time'] = a['created_at']
+                        c['platform'] = '掌中云'
+                        dtime = datetime.datetime.strptime(a['created_at'][0:10], "%Y-%m-%d")
+                        c['date'] = ((int(time.mktime(dtime.timetuple())) + 8 * 3600) // 86400) * 86400 - 8 * 3600
+                        c['stage'] = stage
 
-						if str(a['from_novel_id']) != 'None':
-							c['from_novel'] = a['from_novel']['title']
-						else:
-							c['from_novel'] = 'None'
-						"""
+                        if str(a['from_novel_id']) != 'None':
+                            c['from_novel'] = a['from_novel']['title']
+                        else:
+                            c['from_novel'] = 'None'
+                        """
                         del[a['member']]
                         del[a['referral_link_id']]
                         del[a['id']]
@@ -89,10 +89,10 @@ def get_zzy_order(st, et):
                         del a['price']
                         del a['agent_uid']
                         """
-						x = sorted(c.items(), key=lambda item: item[0])
-						x = dict(x)
-						x = tuple(x.values())
-						r = r + ((x),)
-	cost_time = round((time.time() - time1) / 60, 1)
-	print('get_zzy_order:', len(r), 'cost_minutes:', cost_time)
-	return r
+                        x = sorted(c.items(), key=lambda item: item[0])
+                        x = dict(x)
+                        x = tuple(x.values())
+                        r = r + ((x),)
+    cost_time = round((time.time() - time1) / 60, 1)
+    print('get_zzy_order:', len(r), 'cost_minutes:', cost_time)
+    return r

+ 85 - 85
dgp/tests/demo/b.py

@@ -6,95 +6,95 @@ get_order_daily.py
 
 
 def get_zzy_order(st, et):
-	API_list = al.zzy_account_list
-	url = 'https://openapi.818tu.com/partners/channel/channels/list?'
+    API_list = al.zzy_account_list
+    url = 'https://openapi.818tu.com/partners/channel/channels/list?'
 
-	for x in API_list:
-		my_key = x[0]
-		secert = x[1]
-		stage = x[2]
-		my_sign = md5value(secert + 'key=' + my_key)
-		parameter = 'key=' + my_key + '&sign=' + my_sign
-		channel_list = requests.get(url + parameter)  # 获取子渠道列表
+    for x in API_list:
+        my_key = x[0]
+        secert = x[1]
+        stage = x[2]
+        my_sign = md5value(secert + 'key=' + my_key)
+        parameter = 'key=' + my_key + '&sign=' + my_sign
+        channel_list = requests.get(url + parameter)  # 获取子渠道列表
 
-		if 'data' in channel_list.json().keys():
-			items = channel_list.json()['data']['items']
-		elif len(x) > 3:
-			# print(channel_list.json())
-			my_key = x[3]
-			secert = x[4]
-			my_sign = md5value(secert + 'key=' + my_key)
-			parameter = 'key=' + my_key + '&sign=' + my_sign
-			# url = 'https://openapi.818tu.com/partners/channel/channels/list?'
-			channel_list = requests.get(url + parameter)
-			items = channel_list.json()['data']['items']
-		else:
-			print(channel_list.json())
-			items = []
+        if 'data' in channel_list.json().keys():
+            items = channel_list.json()['data']['items']
+        elif len(x) > 3:
+            # print(channel_list.json())
+            my_key = x[3]
+            secert = x[4]
+            my_sign = md5value(secert + 'key=' + my_key)
+            parameter = 'key=' + my_key + '&sign=' + my_sign
+            # url = 'https://openapi.818tu.com/partners/channel/channels/list?'
+            channel_list = requests.get(url + parameter)
+            items = channel_list.json()['data']['items']
+        else:
+            print(channel_list.json())
+            items = []
 
-		for item in items:  # 获取channel_id 后逐个拉取历史orders
-			r = ()
-			channel_id = item['id']
-			channel = item['nickname']
-			status = str(1)
-			per_page = str(1000)
-			limit_time = et
-			get_time = st
-			lt = parse.urlencode({'created_at[lt]': limit_time})
-			gt = parse.urlencode({'created_at[gt]': get_time})
-			url_1 = 'https://openapi.818tu.com/partners/channel/orders/list?'
-			my_sign_1 = md5value(secert + 'channel_id=' + str(
-				channel_id) + '&created_at[gt]=' + get_time + '&created_at[lt]=' + limit_time + '&key=' + my_key + '&per_page=' + per_page + '&status=' + status)
-			parameter_1 = 'channel_id=' + str(
-				channel_id) + '&' + gt + '&' + lt + '&per_page=' + per_page + '&status=' + status + '&key=' + my_key + '&sign=' + my_sign_1
-			orders = requests.get(url_1 + parameter_1)
-			t = orders.json()['data']['count'] // int(per_page) + 1
-			for page in range(1, t + 1):
-				my_sign_2 = md5value(secert + 'channel_id=' + str(
-					channel_id) + '&created_at[gt]=' + get_time + '&created_at[lt]=' + limit_time + '&key=' + my_key + '&page=' + str(
-					page) + '&per_page=' + per_page + '&status=' + status)
-				parameter_2 = 'channel_id=' + str(channel_id) + '&' + gt + '&' + lt + '&page=' + str(
-					page) + '&per_page=' + per_page + '&status=' + status + '&key=' + my_key + '&sign=' + my_sign_2
-				orders_1 = requests.get(url_1 + parameter_2)
-				b = orders_1.json()['data']['items']
+        for item in items:  # 获取channel_id 后逐个拉取历史orders
+            r = ()
+            channel_id = item['id']
+            channel = item['nickname']
+            status = str(1)
+            per_page = str(1000)
+            limit_time = et
+            get_time = st
+            lt = parse.urlencode({'created_at[lt]': limit_time})
+            gt = parse.urlencode({'created_at[gt]': get_time})
+            url_1 = 'https://openapi.818tu.com/partners/channel/orders/list?'
+            my_sign_1 = md5value(secert + 'channel_id=' + str(
+                channel_id) + '&created_at[gt]=' + get_time + '&created_at[lt]=' + limit_time + '&key=' + my_key + '&per_page=' + per_page + '&status=' + status)
+            parameter_1 = 'channel_id=' + str(
+                channel_id) + '&' + gt + '&' + lt + '&per_page=' + per_page + '&status=' + status + '&key=' + my_key + '&sign=' + my_sign_1
+            orders = requests.get(url_1 + parameter_1)
+            t = orders.json()['data']['count'] // int(per_page) + 1
+            for page in range(1, t + 1):
+                my_sign_2 = md5value(secert + 'channel_id=' + str(
+                    channel_id) + '&created_at[gt]=' + get_time + '&created_at[lt]=' + limit_time + '&key=' + my_key + '&page=' + str(
+                    page) + '&per_page=' + per_page + '&status=' + status)
+                parameter_2 = 'channel_id=' + str(channel_id) + '&' + gt + '&' + lt + '&page=' + str(
+                    page) + '&per_page=' + per_page + '&status=' + status + '&key=' + my_key + '&sign=' + my_sign_2
+                orders_1 = requests.get(url_1 + parameter_2)
+                b = orders_1.json()['data']['items']
 
-				for a in b:
-					c = {}
-					c['user_id'] = str(a['member']['openid'])
-					c['channel'] = channel
-					c['reg_time'] = a['member']['created_at']
-					c['channel_id'] = channel_id
-					c['amount'] = round(a['price'] / 100, 2)
-					c['order_id'] = str(a['id'])
-					c['order_time'] = a['created_at']
-					c['platform'] = '掌中云'
-					c['stage'] = stage
-					# c['amount']=a['amount']
-					dtime = datetime.datetime.strptime(a['created_at'][0:10], "%Y-%m-%d")
-					c['date'] = ((int(time.mktime(dtime.timetuple())) + 8 * 3600) // 86400) * 86400 - 8 * 3600
+                for a in b:
+                    c = {}
+                    c['user_id'] = str(a['member']['openid'])
+                    c['channel'] = channel
+                    c['reg_time'] = a['member']['created_at']
+                    c['channel_id'] = channel_id
+                    c['amount'] = round(a['price'] / 100, 2)
+                    c['order_id'] = str(a['id'])
+                    c['order_time'] = a['created_at']
+                    c['platform'] = '掌中云'
+                    c['stage'] = stage
+                    # c['amount']=a['amount']
+                    dtime = datetime.datetime.strptime(a['created_at'][0:10], "%Y-%m-%d")
+                    c['date'] = ((int(time.mktime(dtime.timetuple())) + 8 * 3600) // 86400) * 86400 - 8 * 3600
 
-					if str(a['from_novel_id']) != 'None':
-						c['from_novel'] = a['from_novel']['title']
-					else:
-						c['from_novel'] = 'None'
-					"""
-					del a['member']
-					del a['referral_link_id']
-					del a['id']
-					del a['created_at']
-					del a['paid_at']
-					del a['border_id']
-					del a['from_novel_id']
-					del a['status']
-					del a['price']
-					del a['agent_uid']
-					"""
-					x = sorted(c.items(), key=lambda item: item[0])
-					x = dict(x)
-					x = tuple(x.values())
-					r = r + ((x),)
+                    if str(a['from_novel_id']) != 'None':
+                        c['from_novel'] = a['from_novel']['title']
+                    else:
+                        c['from_novel'] = 'None'
+                    """
+                    del a['member']
+                    del a['referral_link_id']
+                    del a['id']
+                    del a['created_at']
+                    del a['paid_at']
+                    del a['border_id']
+                    del a['from_novel_id']
+                    del a['status']
+                    del a['price']
+                    del a['agent_uid']
+                    """
+                    x = sorted(c.items(), key=lambda item: item[0])
+                    x = dict(x)
+                    x = tuple(x.values())
+                    r = r + ((x),)
 
-			if len(r) > 0:
-				mysql_insert_order(r)
+            if len(r) > 0:
+                mysql_insert_order(r)
 
-			print('zzy', channel, len(r))
+            print('zzy', channel, len(r))

+ 0 - 5
dgp/tests/demo/test.py

@@ -24,11 +24,8 @@ __title__ = '测试类'
                   ┗┻┛  ┗┻┛
 """
 
-import time
-
 from LoggerService import LoggerService
 # import account_list as al
-from MySQLConnection import MySQLConnection
 from util import date_util
 
 
@@ -70,8 +67,6 @@ if __name__ == '__main__':
     #     # 关闭数据库连接
     #     connect.close()
 
-
-
     # scheduler = BlockingScheduler()
     #
     # #每天凌晨执行

+ 2 - 4
dgp/tests/demo/test_read_ini.py

@@ -24,9 +24,7 @@ __title__ = '测试读取ini文件'
                   ┗┻┛  ┗┻┛
 """
 
-import configparser
 import math
-import os
 
 # 获取当前文件所在目录的上一级目录
 # parent_dir_path = os.path.dirname(os.path.abspath('../..'))
@@ -58,11 +56,11 @@ print(math.ceil(101 / 100))
 
 for i in range(5):
     if 1 != 1:
-        items = [0,1]
+        items = [0, 1]
     else:
         print('掌中云本次请求数据为空')
         items = []
         continue
     print('123345')
     for item in items:
-        print(item)
+        print(item)

+ 11 - 4
dgp/tests/util/platform_util.py

@@ -24,13 +24,15 @@ __title__ = '平台操作工具类'
                   ┗┻┛  ┗┻┛
 """
 
-import pandas as pd
 import os
 import time
 
-#得到当前文件的父目录
+import pandas as pd
+
+# 得到当前文件的父目录
 parent_dir_path = os.path.dirname(os.path.abspath('.'))
 
+
 def get_yuewen_account_list():
     """
     description:  阅文账号列表
@@ -38,6 +40,7 @@ def get_yuewen_account_list():
     """
     return get_account_list('阅文', 'yuewen_account_config.csv')
 
+
 def get_zhangdu_account_list():
     """
     description:  掌读账号列表
@@ -45,6 +48,7 @@ def get_zhangdu_account_list():
     """
     return get_account_list('掌读', 'zhangdu_account_config.csv')
 
+
 def get_huasheng_account_list():
     """
     description:  花生账号列表
@@ -52,6 +56,7 @@ def get_huasheng_account_list():
     """
     return get_account_list('花生', 'huasheng_account_config.csv')
 
+
 def get_zhangzhongyun_account_list():
     """
     description:  掌中云账号列表
@@ -59,6 +64,7 @@ def get_zhangzhongyun_account_list():
     """
     return get_account_list('掌中云', 'zhangzhongyun_account_config.csv')
 
+
 def get_youshuge_account_list():
     """
     description:  悠书阁账号列表
@@ -76,16 +82,17 @@ def get_account_list(platform, account_file_name):
     file_path = parent_dir_path + "/tests/conf/account/" + account_file_name
     # print(file_path)
 
-    data = pd.read_csv(file_path, header=None, encoding = 'utf8')
+    data = pd.read_csv(file_path, header=None, encoding='utf8')
     account = []
     for i in data.index:
         account.append(list(data.values[i]))
 
     account_list = list(account)  # 若想用二维列表的形式读取即删掉此行语句
-    print('读取到【{platform}】账号数量【{quantity}】个'.format(platform=platform,quantity=len(account_list)))
+    print('读取到【{platform}】账号数量【{quantity}】个'.format(platform=platform, quantity=len(account_list)))
 
     return account_list
 
+
 # get_zhangzhongyun_account_list()
 
 

+ 1 - 14
setup.py

@@ -21,19 +21,6 @@ __mtime__ = '2020/9/24'
                   ┗┻┛  ┗┻┛
 """
 
-import requests
-import hashlib
-import time
-from urllib import parse
-import datetime
-import json
-import math
-import pymysql
-import random
-from apscheduler.schedulers.blocking import BlockingScheduler
-import smtplib
-from email.mime.text import MIMEText
-
 """
 安装、部署、打包的脚本。。。。。。。。。
-"""
+"""