You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.4 KiB
43 lines
1.4 KiB
import os,sys,requests,json |
|
|
|
|
|
if __name__ == "__main__": |
|
#获取参数 |
|
args = sys.argv |
|
print("args:",args) |
|
if len(args) != 2: |
|
print("参数错误") |
|
exit() |
|
|
|
pid = args[1] |
|
print("pid",pid) |
|
#根据pid查询order_id的集合 |
|
url="https://mp.api.suwa3d.com/api/physical/listOrderIdByPid?pid="+str(pid) |
|
res=requests.get(url) |
|
if res.status_code != 200: |
|
print('获取失败,程序退出') |
|
exit() |
|
res = json.loads(res.text) |
|
print("res",res) |
|
if res["code"] != 1000: |
|
exit() |
|
orderIds = res['data'] |
|
print("orderIds:",orderIds) |
|
#循环处理 |
|
for orderId in orderIds: |
|
#os.system(f"python D:/make2/tools/cal_weight.py print {pid} {orderId}") |
|
url = "https://mp.api.suwa3d.com/api/physical/infoModelSizeByOrderId?order_id="+str(orderId) |
|
print("url:",url) |
|
res = requests.get(url) |
|
if res.status_code != 200: |
|
print('获取失败,程序退出') |
|
continue |
|
print("res",res) |
|
res = json.loads(res.text) |
|
print("res",res) |
|
#获取到model_size |
|
modelSize = res['data']['model_size'] |
|
pid = res['data']['pid'] |
|
print(f"执行脚本 python D:/make2/tools/cal_weight.py auto {pid} {modelSize} {orderId}") |
|
os.system(f"python D:/make2/tools/cal_weight.py auto {pid} {modelSize} {orderId}") |
|
# python D:/make2/tools/get_weight_by_pid.py |