1
This commit is contained in:
1 parent
bbc53e4321
commit
d370cac01d
1 file changed
+30
-22
+30
-22
@@ -78,19 +78,27 @@ def main(action, pid, sizes,orderId=0):
|
|||||||
df = pd.read_excel(excel_file)
|
df = pd.read_excel(excel_file)
|
||||||
new_data = {
|
new_data = {
|
||||||
'pid': [pid], # 假设新的 pid 是 '002'
|
'pid': [pid], # 假设新的 pid 是 '002'
|
||||||
'6cm': [0], # 新的 6cm 数据
|
'1/4': [0], # 新的 6cm 数据
|
||||||
'7cm': [0], # 新的 7cm 数据
|
'1/6': [0], # 新的 7cm 数据
|
||||||
'8cm': [0], # 新的 8cm 数据
|
'1/10': [0], # 新的 8cm 数据
|
||||||
|
'1/12': [0], # 新的 8cm 数据
|
||||||
|
'1/16': [0], # 新的 8cm 数据
|
||||||
|
'1/18': [0], # 新的 8cm 数据
|
||||||
|
'1/24': [0], # 新的 8cm 数据
|
||||||
|
'1/32': [0], # 新的 8cm 数据
|
||||||
|
'1/43': [0], # 新的 8cm 数据
|
||||||
|
'1/64': [0], # 新的 8cm 数据
|
||||||
}
|
}
|
||||||
|
|
||||||
for size in sizes:
|
for sizeV in sizes:
|
||||||
size = float(size)
|
arrSize = sizeV.split("_")
|
||||||
|
size = float(arrSize[0])
|
||||||
weight = cal_weight(obj, size)
|
weight = cal_weight(obj, size)
|
||||||
size = str(size/10)+"cm"
|
# size = str(size/10)+"cm"
|
||||||
arrData[size] = str(weight)+"g"
|
arrData[arrSize[1]] = str(weight)+"g"
|
||||||
|
|
||||||
if size+"cm" in df.columns:
|
if arrSize[1] in df.columns:
|
||||||
new_data[size+"cm"] = [weight]
|
new_data[arrSize[1]] = [weight]
|
||||||
|
|
||||||
# 更新数据
|
# 更新数据
|
||||||
# 将新数据转换为 DataFrame
|
# 将新数据转换为 DataFrame
|
||||||
@@ -100,19 +108,19 @@ def main(action, pid, sizes,orderId=0):
|
|||||||
# 保存更新后的 Excel 文件
|
# 保存更新后的 Excel 文件
|
||||||
df.to_excel(excel_file, index=False)
|
df.to_excel(excel_file, index=False)
|
||||||
|
|
||||||
#请求接口进行更新数据
|
# #请求接口进行更新数据
|
||||||
arrParams = {"pid":pid,"order_id":orderId}
|
# arrParams = {"pid":pid,"order_id":orderId}
|
||||||
if action == "auto":
|
# if action == "auto":
|
||||||
arrParams["auto_weight"] = json.dumps(arrData)
|
# arrParams["auto_weight"] = json.dumps(arrData)
|
||||||
|
|
||||||
if action == "print":
|
# if action == "print":
|
||||||
arrParams["print_weight"] = json.dumps(arrData)
|
# arrParams["print_weight"] = json.dumps(arrData)
|
||||||
|
|
||||||
#发起请求
|
# #发起请求
|
||||||
print(f"请求的参数-{arrParams}")
|
# print(f"请求的参数-{arrParams}")
|
||||||
url = "https://mp.api.suwa3d.com/api/physical/addPhysicalWeight"
|
# url = "https://mp.api.suwa3d.com/api/physical/addPhysicalWeight"
|
||||||
res = requests.post(url,data=arrParams)
|
# res = requests.post(url,data=arrParams)
|
||||||
print('res:', res.text)
|
# print('res:', res.text)
|
||||||
|
|
||||||
|
|
||||||
#获取真实身高
|
#获取真实身高
|
||||||
@@ -161,5 +169,5 @@ if __name__ == '__main__':
|
|||||||
sizes.append(tempHeight)
|
sizes.append(tempHeight)
|
||||||
|
|
||||||
print(sizes)
|
print(sizes)
|
||||||
break
|
# break
|
||||||
#main("print", pid, sizes)
|
main("print", pid, sizes)
|
||||||
Reference in new issue
Block a user