Add the cartype scripts, incremental runner, scheduler helper, and project notes so the project can be versioned and pushed to the remote repository.
41 lines
991 B
Python
41 lines
991 B
Python
import json
|
|
|
|
import newsetting
|
|
|
|
tent = newsetting.All_Setting('192.168.5.2',3306,'project_company_travel')
|
|
|
|
def get_cartype(raw_uuid):
|
|
|
|
sql1 = f"""
|
|
select json_data from rawdata where uuid = '{raw_uuid}'
|
|
"""
|
|
data = tent.get_shoppingmalls(sql1)[0][0]
|
|
# data2 = json.loads(data)['requests']
|
|
json_data = json.loads(json.loads(data)['requests'])
|
|
vehicle = json_data['data']['vehicle']
|
|
carType = vehicle['carType']
|
|
color = vehicle['color']
|
|
return carType,color
|
|
# input(1)
|
|
|
|
def update_data(id,carType,color):
|
|
sql = f"""
|
|
update order_detail_new set carType = '{carType}',color = '{color}' where id = {id}
|
|
"""
|
|
tent.update_data(sql)
|
|
|
|
|
|
sql1 = """
|
|
select id,raw_uuid from order_detail_new where raw_uuid is not null and amap_order_id is not null and id >= 103396
|
|
"""
|
|
|
|
|
|
|
|
a1 = tent.get_shoppingmalls(sql1)
|
|
for i in a1:
|
|
id, raw_uuid = i
|
|
print(i)
|
|
carType,color = get_cartype(raw_uuid)
|
|
update_data(id,carType,color)
|
|
# input(1)
|