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.
34 lines
1.0 KiB
34 lines
1.0 KiB
|
|
import redis,requests,json,os |
|
r = redis.Redis(host="172.31.1.253",password="",port=6379,db=6) |
|
|
|
# info 是json字符串 {"order_id":[858344,858345],"pid":271916} |
|
info = r.lpop('model:3dglb') |
|
info = json.loads('{"order_id":[858344,858345],"pid":271916}') |
|
#获取 order_id 列表 |
|
order_id_list = info['order_id'] |
|
#获取 pid |
|
pid = info['pid'] |
|
|
|
# print(pid) |
|
# 获取订单信息 |
|
for order_id in order_id_list: |
|
print(order_id) |
|
#url 请求 |
|
url = f"https://mp.api.suwa3d.com/api/printOrder/infoByOrderId?id={order_id}" |
|
response = requests.get(url) |
|
response = response.json() |
|
if response['code'] != 1000: |
|
continue |
|
|
|
#获取打印尺寸 |
|
printdata = response['data']['data'] |
|
for key,value in printdata.items(): |
|
#去掉cm |
|
key = key.replace('cm','') |
|
key = float(key)*10 |
|
print(key) |
|
print(f'执行脚本--- "python D:/make2/tools/cal_weight.py print {pid} {key} {order_id}"') |
|
#发起计算请求 |
|
os.system(f"python D:/make2/tools/cal_weight.py print {pid} {key} {order_id}") |
|
|
|
|