Commit bab0f438 by 岳巧源

modify json

parent de9657e4
Showing with 9 additions and 6 deletions
...@@ -31,7 +31,7 @@ def liexin(): ...@@ -31,7 +31,7 @@ def liexin():
database="liexin" database="liexin"
) )
cursor = db.cursor() cursor = db.cursor()
cursor.execute("select tax_title, business_license, tax_id, user_sn, company_address, consignee_province, consignee_city, consignee_district, consignee_address from lie_taxinfo") cursor.execute("select tax_title, business_license, tax_id, user_sn, company_address, consignee_province, consignee_city, consignee_district, consignee_address, uc_id from lie_taxinfo")
result = cursor.fetchall() result = cursor.fetchall()
for row in result: for row in result:
tax_title = row[0] tax_title = row[0]
...@@ -43,6 +43,7 @@ def liexin(): ...@@ -43,6 +43,7 @@ def liexin():
consignee_city = row[6] consignee_city = row[6]
consignee_district = row[7] consignee_district = row[7]
consignee_address = row[8] consignee_address = row[8]
uc_id = row[9]
detail_address = "" detail_address = ""
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) + ")" 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) + ")"
cursor.execute(sql) cursor.execute(sql)
...@@ -63,19 +64,19 @@ def liexin(): ...@@ -63,19 +64,19 @@ def liexin():
{ {
"source_id": "tax_id_" + str(tax_id), "source_id": "tax_id_" + str(tax_id),
"source_code": user_sn, "source_code": user_sn,
"address_type": "", # ????? 直接写“发票地址”这几个汉字么? "address_type": "发票地址",
"address": company_address "address": company_address
}, },
{ {
"source_id": "consignee_address_" + str(tax_id), "source_id": "consignee_address_" + str(tax_id),
"source_code": user_sn, "source_code": user_sn,
"address_type": "", # ????? 直接写“收票地址”这几个汉字么? "address_type": "收票地址",
"address": detail_address "address": detail_address
}, },
{ {
"source_id": "user_address_" + str(tax_id), "source_id": "user_address_" + str(tax_id),
"source_code": user_sn, "source_code": user_sn,
"address_type": "", # ????? 直接写“客户地址”这几个汉字么? "address_type": "客户地址",
"address": "" "address": ""
} }
] ]
...@@ -115,12 +116,14 @@ def crm(): ...@@ -115,12 +116,14 @@ def crm():
"address_data": [ "address_data": [
{ {
"source_id": "company_" + str(id), # id "source_id": "company_" + str(id), # id
"source_code": "", # ???? 为空 "source_code": "",
"address_type": "", # 这个不确定 "address_type": "公司地址",
"address": com_addr # com_addr "address": com_addr # com_addr
} }
] ]
} }
if com_addr == "":
json_map["address_data"] = []
post_data_to_update_address(json_map) post_data_to_update_address(json_map)
print("-------------------------crm已更新!--------------------------------") print("-------------------------crm已更新!--------------------------------")
cursor.close() cursor.close()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment