作者 dengyuting

增加数据清理

  1 +name: /api/time/get_timestamp
  2 +request:
  3 + headers:
  4 + User-Agent: okhttp/3.12.3
  5 + method: GET
  6 + url: http://tongji.fjmaimaimai.com/api/time/get_timestamp
  7 +validate:
  8 + - eq:
  9 + - content.msg
  10 + - success
  11 + - eq:
  12 + - content.code
  13 + - 0
1 name: 删除意向订单 1 name: 删除意向订单
2 base_url: ${ENV(base_manager_url)} 2 base_url: ${ENV(base_manager_url)}
3 variables: 3 variables:
4 - id: 1027 4 + id: ${get_order_id_from_database(214, 1)}
5 request: 5 request:
6 headers: 6 headers:
7 Content-Type: application/json;charset=utf-8 7 Content-Type: application/json;charset=utf-8
@@ -4,8 +4,8 @@ import time,datetime @@ -4,8 +4,8 @@ import time,datetime
4 from urllib import parse 4 from urllib import parse
5 5
6 from helpfunc.login_func import * 6 from helpfunc.login_func import *
7 -# from helpfunc.pg_db_func import *  
8 -from helpfunc.db_func import * 7 +from helpfunc.pg_db_func import *
  8 +# from helpfunc.db_func import *
9 from helpfunc.header_func import * 9 from helpfunc.header_func import *
10 from random import randint 10 from random import randint
11 # from helpfunc.pg_app_db_func import * 11 # from helpfunc.pg_app_db_func import *
1 -# @Time :2019/11/26 11:25  
2 -# @Author :dengyuting  
3 -# @File :db_func.py  
4 -import pymysql  
5 -  
6 -db_config ={"host": "101.37.68.23",  
7 - "port": 3306,  
8 - "user": "dengyuting",  
9 - "password": "dyt_123456",  
10 - "db": "opportunity_test",  
11 - "charset": 'utf8'}  
12 -  
13 -def get_id1_from_database(tbl, company_id, column, column_value):  
14 - db = pymysql.connect(**db_config)  
15 - cursor = db.cursor()  
16 - company_id = str(company_id)  
17 - column_value = str(column_value)  
18 - sql= "select id from " + tbl + " where company_id=" + company_id + " and " + column + "=" + column_value + \  
19 - " and delete_at=0"  
20 - try:  
21 - cursor.execute(sql)  
22 - result = cursor.fetchone()  
23 - return result[0]  
24 - except Exception as err:  
25 - # 发生错误时回滚  
26 - print(err)  
27 - db.rollback()  
28 - db.close()  
29 -  
30 -def get_chanceid_from_database(company_id):  
31 - db = pymysql.connect(**db_config)  
32 - cursor = db.cursor()  
33 - company_id = str(company_id)  
34 - sql= "select id from chance where company_id=" + company_id + " order by create_at desc"  
35 - try:  
36 - cursor.execute(sql)  
37 - result = cursor.fetchone()  
38 - return result[0]  
39 - except Exception as err:  
40 - # 发生错误时回滚  
41 - print(err)  
42 - db.rollback()  
43 - db.close()  
44 -  
45 -def setup_hook_clean_db(companyid):  
46 - """  
47 - 初始化时清理数据库中对应公司的历史数据  
48 - :return:  
49 - """  
50 - db = pymysql.connect(**db_config)  
51 - cursor = db.cursor()  
52 - companyid = str(companyid)  
53 - # get_adminid = 'select admin_id from company where id='+companyid  
54 - # get_user_company_id = 'select id from user_company where company_id='+companyid  
55 - try:  
56 - # cursor.execute(get_adminid)  
57 - # result = cursor.fetchone()  
58 - # admin_id = result[0]  
59 - # admin_id = str(admin_id)  
60 - # cursor.execute(get_user_company_id)  
61 - # result = cursor.fetchone()  
62 - # user_company_id = result[0]  
63 - # user_company_id = str(user_company_id)  
64 - # cursor.execute('delete from department where company_id=' + companyid + ' and is_top!=1')  
65 - # cursor.execute('delete from user_company where company_id=' + companyid + ' and user_id!='+admin_id)  
66 - # cursor.execute('delete from user_department where company_id=' + companyid + ' and user_company_id!='+ user_company_id)  
67 - # cursor.execute('delete from position where company_id=' + companyid)  
68 - # cursor.execute('delete from user_position where company_id=' + companyid)  
69 - # cursor.execute('delete from role where company_id=' + companyid + ' and is_default!=1')  
70 - # cursor.execute('delete from user_role where company_id=' + companyid)  
71 - # cursor.execute('delete from chance_type where company_id=' + companyid)  
72 - # cursor.execute('delete from audit_template where company_id=' + companyid)  
73 - # cursor.execute('delete from audit_form where company_id=' + companyid)  
74 - cursor.execute('delete a from chance_data a left JOIN chance b on a.chance_id=b.id where b.company_id=' + companyid)  
75 - db.commit()  
76 - cursor.execute('delete a from audit_flow_process a left JOIN chance b on a.chance_id=b.id where b.company_id=' + companyid)  
77 - db.commit()  
78 - cursor.execute('delete a from chance_department a left JOIN chance b on a.chance_id=b.id where b.company_id=' + companyid)  
79 - db.commit()  
80 - cursor.execute('delete from user_msg where receive_user_id in (select id from user_company where company_id=' + companyid + ') ' \  
81 - 'or sender_user_id in (select id from user_company where company_id=' + companyid +')')  
82 - db.commit()  
83 - cursor.execute('delete from comment where user_id in (select id from user_company where company_id=' + companyid + ')')  
84 - db.commit()  
85 - cursor.execute('delete from chance_favorite where user_id in (select id from user_company where company_id=' + companyid + ')')  
86 - db.commit()  
87 - #这句要放在最后执行  
88 - cursor.execute('delete from chance where company_id=' + companyid)  
89 - db.commit()  
90 - print("delete OK")  
91 - except Exception as err:  
92 - # 发生错误时回滚  
93 - print("this is:", err)  
94 - db.rollback()  
95 - db.close()  
  1 +# # @Time :2019/11/26 11:25
  2 +# # @Author :dengyuting
  3 +# # @File :db_func.py
  4 +# import pymysql
  5 +#
  6 +# db_config ={"host": "101.37.68.23",
  7 +# "port": 3306,
  8 +# "user": "dengyuting",
  9 +# "password": "dyt_123456",
  10 +# "db": "opportunity_test",
  11 +# "charset": 'utf8'}
  12 +#
  13 +# def get_id1_from_database(tbl, company_id, column, column_value):
  14 +# db = pymysql.connect(**db_config)
  15 +# cursor = db.cursor()
  16 +# company_id = str(company_id)
  17 +# column_value = str(column_value)
  18 +# sql= "select id from " + tbl + " where company_id=" + company_id + " and " + column + "=" + column_value + \
  19 +# " and delete_at=0"
  20 +# try:
  21 +# cursor.execute(sql)
  22 +# result = cursor.fetchone()
  23 +# return result[0]
  24 +# except Exception as err:
  25 +# # 发生错误时回滚
  26 +# print(err)
  27 +# db.rollback()
  28 +# db.close()
  29 +#
  30 +# def get_chanceid_from_database(company_id):
  31 +# db = pymysql.connect(**db_config)
  32 +# cursor = db.cursor()
  33 +# company_id = str(company_id)
  34 +# sql= "select id from chance where company_id=" + company_id + " order by create_at desc"
  35 +# try:
  36 +# cursor.execute(sql)
  37 +# result = cursor.fetchone()
  38 +# return result[0]
  39 +# except Exception as err:
  40 +# # 发生错误时回滚
  41 +# print(err)
  42 +# db.rollback()
  43 +# db.close()
  44 +#
  45 +# def setup_hook_clean_db(companyid):
  46 +# """
  47 +# 初始化时清理数据库中对应公司的历史数据
  48 +# :return:
  49 +# """
  50 +# db = pymysql.connect(**db_config)
  51 +# cursor = db.cursor()
  52 +# companyid = str(companyid)
  53 +# # get_adminid = 'select admin_id from company where id='+companyid
  54 +# # get_user_company_id = 'select id from user_company where company_id='+companyid
  55 +# try:
  56 +# # cursor.execute(get_adminid)
  57 +# # result = cursor.fetchone()
  58 +# # admin_id = result[0]
  59 +# # admin_id = str(admin_id)
  60 +# # cursor.execute(get_user_company_id)
  61 +# # result = cursor.fetchone()
  62 +# # user_company_id = result[0]
  63 +# # user_company_id = str(user_company_id)
  64 +# # cursor.execute('delete from department where company_id=' + companyid + ' and is_top!=1')
  65 +# # cursor.execute('delete from user_company where company_id=' + companyid + ' and user_id!='+admin_id)
  66 +# # cursor.execute('delete from user_department where company_id=' + companyid + ' and user_company_id!='+ user_company_id)
  67 +# # cursor.execute('delete from position where company_id=' + companyid)
  68 +# # cursor.execute('delete from user_position where company_id=' + companyid)
  69 +# # cursor.execute('delete from role where company_id=' + companyid + ' and is_default!=1')
  70 +# # cursor.execute('delete from user_role where company_id=' + companyid)
  71 +# # cursor.execute('delete from chance_type where company_id=' + companyid)
  72 +# # cursor.execute('delete from audit_template where company_id=' + companyid)
  73 +# # cursor.execute('delete from audit_form where company_id=' + companyid)
  74 +# cursor.execute('delete a from chance_data a left JOIN chance b on a.chance_id=b.id where b.company_id=' + companyid)
  75 +# db.commit()
  76 +# cursor.execute('delete a from audit_flow_process a left JOIN chance b on a.chance_id=b.id where b.company_id=' + companyid)
  77 +# db.commit()
  78 +# cursor.execute('delete a from chance_department a left JOIN chance b on a.chance_id=b.id where b.company_id=' + companyid)
  79 +# db.commit()
  80 +# cursor.execute('delete from user_msg where receive_user_id in (select id from user_company where company_id=' + companyid + ') ' \
  81 +# 'or sender_user_id in (select id from user_company where company_id=' + companyid +')')
  82 +# db.commit()
  83 +# cursor.execute('delete from comment where user_id in (select id from user_company where company_id=' + companyid + ')')
  84 +# db.commit()
  85 +# cursor.execute('delete from chance_favorite where user_id in (select id from user_company where company_id=' + companyid + ')')
  86 +# db.commit()
  87 +# #这句要放在最后执行
  88 +# cursor.execute('delete from chance where company_id=' + companyid)
  89 +# db.commit()
  90 +# print("delete OK")
  91 +# except Exception as err:
  92 +# # 发生错误时回滚
  93 +# print("this is:", err)
  94 +# db.rollback()
  95 +# db.close()
@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 # @file: pg_db_func.py 5 # @file: pg_db_func.py
6 import psycopg2 6 import psycopg2
7 7
  8 +
8 # 获得连接 9 # 获得连接
9 def GetConnect(): 10 def GetConnect():
10 conn = False 11 conn = False
@@ -17,230 +18,255 @@ def GetConnect(): @@ -17,230 +18,255 @@ def GetConnect():
17 except Exception as err: 18 except Exception as err:
18 print("连接数据库失败,%s" % err) 19 print("连接数据库失败,%s" % err)
19 return conn 20 return conn
20 -#获取超级管理员账号  
21 -def get_admin_account_from_database(tbl):  
22 - db = GetConnect()  
23 - cursor = db.cursor()  
24 - # sql= "select id from " + '''"''' + tbl + '''"'''+ ' ' + 'order by id desc '  
25 - sql = '''select account from \"{}\" where is_default ='t' '''.format(tbl)  
26 - # print(sql)  
27 - try:  
28 - cursor.execute(sql)  
29 - result = cursor.fetchone()  
30 - return result[0]  
31 - except Exception as err:  
32 - # 发生错误时回滚  
33 - print(err)  
34 - db.rollback()  
35 - db.close()  
36 -#获取管理员的id  
37 -def get_admin_id_from_database():  
38 - db = GetConnect()  
39 - cursor = db.cursor()  
40 - sql = '''select id from admin_user where is_usable = 't' order by id desc '''  
41 - # print(sql)  
42 - try:  
43 - cursor.execute(sql)  
44 - result = cursor.fetchone()  
45 - return result[0]  
46 - except Exception as err:  
47 - # 发生错误时回滚  
48 - print(err)  
49 - db.rollback()  
50 - db.close()  
51 -#获取管理员的account  
52 -def get_account_from_database():  
53 - db = GetConnect()  
54 - cursor = db.cursor()  
55 - sql= '''select account from admin_user where is_usable = 't' order by id desc '''  
56 - try:  
57 - cursor.execute(sql)  
58 - result = cursor.fetchone()  
59 - return result[0]  
60 - except Exception as err:  
61 - # 发生错误时回滚  
62 - print(err)  
63 - db.rollback()  
64 - db.close()  
65 21
66 -#实际订单的发货单号  
67 -def get_actual_delivery_code_from_database():  
68 - db = GetConnect()  
69 - cursor = db.cursor()  
70 - sql = '''select delivery_code from order_base where order_type = 1 order by id DESC'''  
71 - #print(sql)  
72 - try:  
73 - cursor.execute(sql)  
74 - result = cursor.fetchone()  
75 - return result[0]  
76 - except Exception as err:  
77 - # 发生错误时回滚  
78 - print(err)  
79 - db.rollback()  
80 - db.close()  
81 22
82 -#实际订单的id  
83 -def get_actual_id_from_database():  
84 - db = GetConnect()  
85 - cursor = db.cursor()  
86 - sql = '''select id from order_base where order_type = 1 order by id DESC'''  
87 - #print(sql)  
88 - try:  
89 - cursor.execute(sql)  
90 - result = cursor.fetchone()  
91 - return result[0]  
92 - except Exception as err:  
93 - # 发生错误时回滚  
94 - print(err)  
95 - db.rollback()  
96 - db.close()  
97 -#意向订单id  
98 -def get_purpose_id_from_database():  
99 - db = GetConnect()  
100 - cursor = db.cursor()  
101 - # sql= "select id from " + '''"''' + tbl + '''"'''+ ' ' + 'order by id desc '  
102 - sql = '''select id from order_base where order_type = 2 order by id DESC'''  
103 - try:  
104 - cursor.execute(sql)  
105 - result = cursor.fetchone()  
106 - return result[0]  
107 - except Exception as err:  
108 - # 发生错误时回滚  
109 - print(err)  
110 - db.rollback()  
111 - db.close()  
112 -#意向订单的产品ID  
113 -def get_ID_from_database(id):  
114 - db = GetConnect()  
115 - cursor = db.cursor()  
116 - sql= '''select id from order_good where order_id = {} order by id ASC '''.format(get_purpose_id_from_database())  
117 - # print(sql)  
118 - try:  
119 - cursor.execute(sql)  
120 - result = cursor.fetchall()  
121 - return result[id][0]  
122 - except Exception as err:  
123 - # 发生错误时回滚  
124 - print(err)  
125 - db.rollback()  
126 - db.close()  
127 -#分红管理的产品ID  
128 -def get_dividends_ID_from_database(id):  
129 - db = GetConnect()  
130 - cursor = db.cursor()  
131 - sql= '''select id from order_good where order_id = {} order by id ASC '''.format(get_actual_id_from_database())  
132 - # print(sql)  
133 - try:  
134 - cursor.execute(sql)  
135 - result = cursor.fetchall()  
136 - return result[id][0]  
137 - except Exception as err:  
138 - # 发生错误时回滚  
139 - print(err)  
140 - db.rollback()  
141 - db.close()  
142 -#意向订单的产品名称  
143 -def get_productName_from_database(id):  
144 - db = GetConnect()  
145 - cursor = db.cursor()  
146 - sql= '''select good_name from order_good where order_id = {} order by id ASC '''.format(get_purpose_id_from_database())  
147 - # print(sql)  
148 - try:  
149 - cursor.execute(sql)  
150 - result = cursor.fetchall()  
151 - return result[id][0]  
152 - except Exception as err:  
153 - # 发生错误时回滚  
154 - print(err)  
155 - db.rollback()  
156 - db.close()  
157 -#意向订单的产品数量  
158 -def get_orderNum_from_database(id): 23 +# 清除数据
  24 +def setup_hook_clean_db(companyid):
  25 + """
  26 + 初始化时清理数据库中对应公司的历史数据
  27 + :return:
  28 + """
159 db = GetConnect() 29 db = GetConnect()
160 cursor = db.cursor() 30 cursor = db.cursor()
161 - sql= '''select plan_good_number from order_good where order_id = {} order by id ASC '''.format(get_purpose_id_from_database())  
162 - # print(sql)  
163 - try:  
164 - cursor.execute(sql)  
165 - result = cursor.fetchall()  
166 - return result[id][0]  
167 - except Exception as err:  
168 - # 发生错误时回滚  
169 - print(err)  
170 - db.rollback()  
171 - db.close()  
172 -#意向订单的产品单价  
173 -def get_univalence_from_database(id):  
174 - db = GetConnect()  
175 - cursor = db.cursor()  
176 - sql= '''select price from order_good where order_id = {} order by id ASC '''.format(get_purpose_id_from_database())  
177 - # print(sql)  
178 - try:  
179 - cursor.execute(sql)  
180 - result = cursor.fetchall()  
181 - return result[id][0]  
182 - except Exception as err:  
183 - # 发生错误时回滚  
184 - print(err)  
185 - db.rollback()  
186 - db.close()  
187 -#意向订单的合伙人分红比例  
188 -def get_partnerRatio_from_database(id):  
189 - db = GetConnect()  
190 - cursor = db.cursor()  
191 - sql= '''select partner_bonus_percent from order_good where order_id = {} order by id ASC '''.format(get_purpose_id_from_database())  
192 - # print(sql)  
193 - try:  
194 - cursor.execute(sql)  
195 - result = cursor.fetchall()  
196 - return result[id][0]  
197 - except Exception as err:  
198 - # 发生错误时回滚  
199 - print(err)  
200 - db.rollback()  
201 - db.close()  
202 -#获取合伙人所属区域  
203 -def get_area_from_database():  
204 - db = GetConnect()  
205 - cursor = db.cursor()  
206 - sql = '''select region_info from partner_info where account = '13459147023' '''  
207 - # print(sql)  
208 - try:  
209 - cursor.execute(sql)  
210 - result = cursor.fetchone()  
211 - return result[0]['regionName']  
212 - except Exception as err:  
213 - # 发生错误时回滚  
214 - print(err)  
215 - db.rollback()  
216 - db.close()  
217 -#获取合伙人的业务员姓名  
218 -def get_salesman_from_database():  
219 - db = GetConnect()  
220 - cursor = db.cursor()  
221 - sql = '''select salesman from partner_info where account = '13459147023' '''  
222 - # print(sql)  
223 - try:  
224 - cursor.execute(sql)  
225 - result = cursor.fetchone()  
226 - return result[0][0]['name']  
227 - except Exception as err:  
228 - # 发生错误时回滚  
229 - print(err)  
230 - db.rollback()  
231 - db.close()  
232 -#获取合伙人的状态  
233 -def get_status_from_database():  
234 - db = GetConnect()  
235 - cursor = db.cursor()  
236 - sql = '''select status from partner_info where account = '13459147023' '''  
237 - # print(sql) 31 + companyid = str(companyid)
  32 +
238 try: 33 try:
239 - cursor.execute(sql)  
240 - result = cursor.fetchone()  
241 - return result[0] 34 + cursor.execute('delete from order_base where company_id=' + companyid)
  35 + db.commit()
  36 + cursor.execute('delete from order_good where company_id=' + companyid)
  37 + db.commit()
  38 + print("delete OK")
242 except Exception as err: 39 except Exception as err:
243 # 发生错误时回滚 40 # 发生错误时回滚
244 - print(err) 41 + print("this is:", err)
245 db.rollback() 42 db.rollback()
246 db.close() 43 db.close()
  44 +
  45 +
  46 +# #获取超级管理员账号
  47 +# def get_admin_account_from_database(tbl):
  48 +# db = GetConnect()
  49 +# cursor = db.cursor()
  50 +# # sql= "select id from " + '''"''' + tbl + '''"'''+ ' ' + 'order by id desc '
  51 +# sql = '''select account from \"{}\" where is_default ='t' '''.format(tbl)
  52 +# # print(sql)
  53 +# try:
  54 +# cursor.execute(sql)
  55 +# result = cursor.fetchone()
  56 +# return result[0]
  57 +# except Exception as err:
  58 +# # 发生错误时回滚
  59 +# print(err)
  60 +# db.rollback()
  61 +# db.close()
  62 +# #获取管理员的id
  63 +# def get_admin_id_from_database():
  64 +# db = GetConnect()
  65 +# cursor = db.cursor()
  66 +# sql = '''select id from admin_user where is_usable = 't' order by id desc '''
  67 +# # print(sql)
  68 +# try:
  69 +# cursor.execute(sql)
  70 +# result = cursor.fetchone()
  71 +# return result[0]
  72 +# except Exception as err:
  73 +# # 发生错误时回滚
  74 +# print(err)
  75 +# db.rollback()
  76 +# db.close()
  77 +# #获取管理员的account
  78 +# def get_account_from_database():
  79 +# db = GetConnect()
  80 +# cursor = db.cursor()
  81 +# sql= '''select account from admin_user where is_usable = 't' order by id desc '''
  82 +# try:
  83 +# cursor.execute(sql)
  84 +# result = cursor.fetchone()
  85 +# return result[0]
  86 +# except Exception as err:
  87 +# # 发生错误时回滚
  88 +# print(err)
  89 +# db.rollback()
  90 +# db.close()
  91 +#
  92 +# #实际订单的发货单号
  93 +# def get_actual_delivery_code_from_database():
  94 +# db = GetConnect()
  95 +# cursor = db.cursor()
  96 +# sql = '''select delivery_code from order_base where order_type = 1 order by id DESC'''
  97 +# #print(sql)
  98 +# try:
  99 +# cursor.execute(sql)
  100 +# result = cursor.fetchone()
  101 +# return result[0]
  102 +# except Exception as err:
  103 +# # 发生错误时回滚
  104 +# print(err)
  105 +# db.rollback()
  106 +# db.close()
  107 +#
  108 +# #实际订单的id
  109 +# def get_actual_id_from_database():
  110 +# db = GetConnect()
  111 +# cursor = db.cursor()
  112 +# sql = '''select id from order_base where order_type = 1 order by id DESC'''
  113 +# #print(sql)
  114 +# try:
  115 +# cursor.execute(sql)
  116 +# result = cursor.fetchone()
  117 +# return result[0]
  118 +# except Exception as err:
  119 +# # 发生错误时回滚
  120 +# print(err)
  121 +# db.rollback()
  122 +# db.close()
  123 +# #意向订单id
  124 +# def get_purpose_id_from_database():
  125 +# db = GetConnect()
  126 +# cursor = db.cursor()
  127 +# # sql= "select id from " + '''"''' + tbl + '''"'''+ ' ' + 'order by id desc '
  128 +# sql = '''select id from order_base where order_type = 2 order by id DESC'''
  129 +# try:
  130 +# cursor.execute(sql)
  131 +# result = cursor.fetchone()
  132 +# return result[0]
  133 +# except Exception as err:
  134 +# # 发生错误时回滚
  135 +# print(err)
  136 +# db.rollback()
  137 +# db.close()
  138 +# #意向订单的产品ID
  139 +# def get_ID_from_database(id):
  140 +# db = GetConnect()
  141 +# cursor = db.cursor()
  142 +# sql= '''select id from order_good where order_id = {} order by id ASC '''.format(get_purpose_id_from_database())
  143 +# # print(sql)
  144 +# try:
  145 +# cursor.execute(sql)
  146 +# result = cursor.fetchall()
  147 +# return result[id][0]
  148 +# except Exception as err:
  149 +# # 发生错误时回滚
  150 +# print(err)
  151 +# db.rollback()
  152 +# db.close()
  153 +# #分红管理的产品ID
  154 +# def get_dividends_ID_from_database(id):
  155 +# db = GetConnect()
  156 +# cursor = db.cursor()
  157 +# sql= '''select id from order_good where order_id = {} order by id ASC '''.format(get_actual_id_from_database())
  158 +# # print(sql)
  159 +# try:
  160 +# cursor.execute(sql)
  161 +# result = cursor.fetchall()
  162 +# return result[id][0]
  163 +# except Exception as err:
  164 +# # 发生错误时回滚
  165 +# print(err)
  166 +# db.rollback()
  167 +# db.close()
  168 +# #意向订单的产品名称
  169 +# def get_productName_from_database(id):
  170 +# db = GetConnect()
  171 +# cursor = db.cursor()
  172 +# sql= '''select good_name from order_good where order_id = {} order by id ASC '''.format(get_purpose_id_from_database())
  173 +# # print(sql)
  174 +# try:
  175 +# cursor.execute(sql)
  176 +# result = cursor.fetchall()
  177 +# return result[id][0]
  178 +# except Exception as err:
  179 +# # 发生错误时回滚
  180 +# print(err)
  181 +# db.rollback()
  182 +# db.close()
  183 +# #意向订单的产品数量
  184 +# def get_orderNum_from_database(id):
  185 +# db = GetConnect()
  186 +# cursor = db.cursor()
  187 +# sql= '''select plan_good_number from order_good where order_id = {} order by id ASC '''.format(get_purpose_id_from_database())
  188 +# # print(sql)
  189 +# try:
  190 +# cursor.execute(sql)
  191 +# result = cursor.fetchall()
  192 +# return result[id][0]
  193 +# except Exception as err:
  194 +# # 发生错误时回滚
  195 +# print(err)
  196 +# db.rollback()
  197 +# db.close()
  198 +# #意向订单的产品单价
  199 +# def get_univalence_from_database(id):
  200 +# db = GetConnect()
  201 +# cursor = db.cursor()
  202 +# sql= '''select price from order_good where order_id = {} order by id ASC '''.format(get_purpose_id_from_database())
  203 +# # print(sql)
  204 +# try:
  205 +# cursor.execute(sql)
  206 +# result = cursor.fetchall()
  207 +# return result[id][0]
  208 +# except Exception as err:
  209 +# # 发生错误时回滚
  210 +# print(err)
  211 +# db.rollback()
  212 +# db.close()
  213 +# #意向订单的合伙人分红比例
  214 +# def get_partnerRatio_from_database(id):
  215 +# db = GetConnect()
  216 +# cursor = db.cursor()
  217 +# sql= '''select partner_bonus_percent from order_good where order_id = {} order by id ASC '''.format(get_purpose_id_from_database())
  218 +# # print(sql)
  219 +# try:
  220 +# cursor.execute(sql)
  221 +# result = cursor.fetchall()
  222 +# return result[id][0]
  223 +# except Exception as err:
  224 +# # 发生错误时回滚
  225 +# print(err)
  226 +# db.rollback()
  227 +# db.close()
  228 +# #获取合伙人所属区域
  229 +# def get_area_from_database():
  230 +# db = GetConnect()
  231 +# cursor = db.cursor()
  232 +# sql = '''select region_info from partner_info where account = '13459147023' '''
  233 +# # print(sql)
  234 +# try:
  235 +# cursor.execute(sql)
  236 +# result = cursor.fetchone()
  237 +# return result[0]['regionName']
  238 +# except Exception as err:
  239 +# # 发生错误时回滚
  240 +# print(err)
  241 +# db.rollback()
  242 +# db.close()
  243 +# #获取合伙人的业务员姓名
  244 +# def get_salesman_from_database():
  245 +# db = GetConnect()
  246 +# cursor = db.cursor()
  247 +# sql = '''select salesman from partner_info where account = '13459147023' '''
  248 +# # print(sql)
  249 +# try:
  250 +# cursor.execute(sql)
  251 +# result = cursor.fetchone()
  252 +# return result[0][0]['name']
  253 +# except Exception as err:
  254 +# # 发生错误时回滚
  255 +# print(err)
  256 +# db.rollback()
  257 +# db.close()
  258 +# #获取合伙人的状态
  259 +# def get_status_from_database():
  260 +# db = GetConnect()
  261 +# cursor = db.cursor()
  262 +# sql = '''select status from partner_info where account = '13459147023' '''
  263 +# # print(sql)
  264 +# try:
  265 +# cursor.execute(sql)
  266 +# result = cursor.fetchone()
  267 +# return result[0]
  268 +# except Exception as err:
  269 +# # 发生错误时回滚
  270 +# print(err)
  271 +# db.rollback()
  272 +# db.close()
  1 +config:
  2 + name: start_testcases
  3 + #清理数据
  4 + setup_hooks:
  5 + - ${setup_hook_clean_db(214)}
  6 + teardown_hooks:
  7 + - ${sleep(2)}
  8 +
  9 +teststeps:
  10 +- name: start_testcases
  11 + api: api/app_api/login/gettimestamp_api.yml
@@ -2,6 +2,9 @@ config: @@ -2,6 +2,9 @@ config:
2 name: 合伙人测试集 2 name: 合伙人测试集
3 testcases: 3 testcases:
4 4
  5 +- name: start....初始化数据库
  6 + testcase: testcases/common/start_testcases.yml
  7 +
5 ############################分红管理模块开始################################# 8 ############################分红管理模块开始#################################
6 - name: DIV001-事业分红列表-数据源来自于实发订单 9 - name: DIV001-事业分红列表-数据源来自于实发订单
7 testcase: testcases/dividends/DIV001_dividendslist_testcases.yml 10 testcase: testcases/dividends/DIV001_dividendslist_testcases.yml