sql="select region_name from lie_region where region_id in ("+str(province)+","+str(city)+","+str(district)+") "+"order by field ("+"region_id"+","+str(province)+","+str(city)+","+str(district)+") "
sql1="select region_name from lie_region where region_id = "+str(province)
sql2="select region_name from lie_region where region_id = "+str(city)
sql3="select region_name from lie_region where region_id = "+str(district)
user_detail_address=""
cursor=db.cursor()
cursor.execute(sql)
result=cursor.fetchall()
foriinrange(len(result)):
iflen(result[i])==0:
continue
user_detail_address+=result[i][0]
# 省
cursor.execute(sql1)
result1=cursor.fetchall()
foriinrange(len(result1)):
iflen(result1[i])!=0:
user_detail_address+=result1[i][0]
# 市
cursor.execute(sql2)
result2=cursor.fetchall()
foriinrange(len(result2)):
iflen(result2[i])!=0:
user_detail_address+=result2[i][0]
# 区
cursor.execute(sql3)
result3=cursor.fetchall()
foriinrange(len(result3)):
iflen(result3[i])!=0:
user_detail_address+=result3[i][0]
user_detail_address+=detail_address
cursor.close()
db.close()
db.cursor()
returnuser_detail_address
defpur():
db=mysql.connector.connect(
host="master.db2.liexindev.me",
...
...
@@ -41,6 +61,7 @@ def pur():
cursor=db.cursor()
cursor.execute("select end_cust_cn, end_cust_en, create_uid, create_name, end_cust_id, com_addr from lie_end_cust_info")
sql="select region_name from lie_region where region_id in "+"("+str(consignee_province)+","+str(consignee_city)+","+str(consignee_district)+") "+"order by field ("+"region_id"+","+str(consignee_province)+","+str(consignee_city)+","+str(consignee_district)+")"