|
@@ -5,242 +5,268 @@ |
|
@@ -5,242 +5,268 @@ |
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
|
11
|
try:
|
12
|
try:
|
12
|
conn = psycopg2.connect(database="partner_test",
|
13
|
conn = psycopg2.connect(database="partner_test",
|
13
|
- user="bianxinhua",
|
|
|
14
|
- password="bianxinhua_123",
|
|
|
15
|
- host="114.55.200.59",
|
|
|
16
|
- port="31543")
|
14
|
+ user="bianxinhua",
|
|
|
15
|
+ password="bianxinhua_123",
|
|
|
16
|
+ host="114.55.200.59",
|
|
|
17
|
+ port="31543")
|
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() |