新的信息

This commit is contained in:
dongchangxi committed 2024-09-02 16:52:37 +08:00
1 parent c66fc76e10
commit 345790cb05
51 files changed
+5187 -61

No files matched your search

+2 -2
View File
@@ -158,8 +158,8 @@ def get_time_out(hostname,step):
if __name__ == '__main__':
#开启死循环
while True:
check_task_distributed_detail()
check_task()
# check_task_distributed_detail()
# check_task()
#两分钟检测一次
time.sleep(120)
print("检测是否存在运行时间超长的任务,进行消息通知")
+74
View File
@@ -0,0 +1,74 @@
import redis,time,requests,json,os
def getOrderInfoByOrderId(orderId):
try:
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('获取失败,程序退出')
return "error","error"
print("res",res)
res = json.loads(res.text)
print("res",res)
#获取到model_size
modelSize = res['data']['model_size']
pid = res['data']['pid']
return pid,modelSize
except Exception as e:
print(f"获取订单信息异常: {str(e)}")
return "error","error"
if __name__ == '__main__':
r = redis.Redis(host="106.14.158.208",password="kcV2000",port=6379,db=6)
while True:
print(f"时间-{time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())}")
if r.llen('model:weight') == 0:
print('队列为空,等待10秒')
time.sleep(10)
continue
# info 的数据格式为有以下几种情况 1. orderId 2 orderId_print_9,1.2,45,27 3. orderId_auto_9,1.2,45,27
info = r.lpop('model:weight')
if info is None:
print('队列为空,等待10秒')
time.sleep(10)
info = info.decode('utf-8')
orderId = 0
pid = 0
modelSize = []
typeModel = "print"
#判断info是什么类型的数据
arrInfo = info.split("_")
if len(arrInfo) == 1:
orderId = arrInfo[0]
pid,modelSize = getOrderInfoByOrderId(orderId)
if pid == "error":
print("获取订单信息失败")
continue
elif len(arrInfo) == 3:
orderId = arrInfo[0]
pid,temp = getOrderInfoByOrderId(orderId)
if pid == "error":
print("获取订单信息失败")
continue
typeModel = arrInfo[1]
modelSize = arrInfo[2]
if typeModel != "print" and typeModel != "auto":
print("typeModel类型不对")
continue
if int(orderId) == 0 or int(pid) == 0 or len(modelSize) == 0:
print("orderId pid modelSize 有出现问题")
continue
#转成数组
arrModelSize = modelSize.split(",")
print(f'执行脚本--- "python D:/make2/tools/cal_weight.py {typeModel} {pid} {modelSize} {orderId}"')
#发起计算请求
os.system(f"python D:/make2/tools/cal_weight.py {typeModel} {pid} {modelSize} {orderId}")
+8
View File
@@ -0,0 +1,8 @@
import time,os
if __name__ == '__main__':
#开启死循环
while True:
#检测当前打印 和 脚底板 和 gs 队列长度
os.system("python E:\\make2\\tools\\push_cmd.py auto_view")
#一个小时检测一次
time.sleep(60*60)
+11 -11
View File
@@ -3,7 +3,7 @@ import redis,requests,json,os,sys
import platform
if platform.system() == 'Windows':
sys.path.append('e:\\libs\\')
sys.path.append('e:\\make2\\libs\\')
else:
sys.path.append('/data/deploy/make3d/make2/libs/')
import config
@@ -66,32 +66,32 @@ def main():
print(data['data'])
#pythob 进入到 E:\wails\oemProject ,将 data 数据写入到 wails.json 文件中的 ext_oem 字段中
with open("D:\\oemProject\\wails.json","r",encoding="utf-8") as f:
with open("E:\\make2\\oemProject\\wails.json","r",encoding="utf-8") as f:
wailsData = json.load(f)
wailsData['ext_oem'] = data['data']
wailsData['name'] = data['data']['brand_name']
wailsData["outputfilename"] = str(data['data']['id'])
with open("D:\\oemProject\\wails.json","w",encoding="utf-8") as f:
with open("E:\\make2\\oemProject\\wails.json","w",encoding="utf-8") as f:
json.dump(wailsData,f,ensure_ascii=False,indent=4)
# #将图片下载到本地
getExeImg(data['data']['logo'], "D:\\oemProject\\build\\appicon.png")
getExeImg(data['data']['exe_logo'], "E:\\make2\\oemProject\\build\\appicon.png")
#删除 D:\\oemProject\\build\\bin 目录下的所有exe 文件,不包含子目录
delete_exe_files_in_dir("D:\\oemProject\\build\\bin")
delete_exe_files_in_dir("E:\\make2\\oemProject\\build\\bin")
# #重命名文件
# os.system(f"cd D:\\oemProject && ren build\\bin\\{data['data']['brand_name']}amd64-installer.exe "+str(data['data']['id'])+".exe")
#写入成功后在 E:\\wails\\oemProject\\ 目录下执行 wails build 命令 -debug
os.system("cd D:\\oemProject && wails build -nsis")
os.system("cd E:\\make2\\oemProject && wails build -nsis -devtools")
time.sleep(35)
#删除指定目录下的多余产生的文件
os.system("cd D:\\oemProject && del /s/q/f build\\bin\\"+str(data['data']['id'])+".exe")
os.system("cd E:\\make2\\oemProject && del /s/q/f build\\bin\\"+str(data['data']['id'])+".exe")
#打包压缩指定文件夹
# 指定要打包的文件夹路径
folder_to_zip = 'D:\\oemProject\\build\\bin'
folder_to_zip = 'E:\\make2\\oemProject\\build\\bin'
# 指定生成的压缩包名称和路径
zip_filename = f"{str(data['data']['id'])}.zip"
@@ -104,7 +104,7 @@ def main():
#上传成功后,调用接口,告诉mp,已经生成exe及上传成功
requests.get(url+"/api/oem/infoSetupUpdate",params={"id":oemId})
#
os.system("cd D:\\make2 && del /s/q/f timer\\"+str(data['data']['id'])+".zip")
os.system("cd E:\\make2 && del /s/q/f timer\\"+str(data['data']['id'])+".zip")
def getExeImg(image_url, output_path):
@@ -118,10 +118,10 @@ def getExeImg(image_url, output_path):
# 保存图片为PNG格式
resized_image.save(output_path, 'PNG')
#转换格式
transToIco(output_path,"D:\\oemProject\\build\\windows\\icon.ico")
transToIco(output_path,"E:\\make2\\oemProject\\build\\windows\\icon.ico")
#复制图片到指定目录
time.sleep(3)
shutil.copy("D:\\oemProject\\build\\windows\\icon.ico","D:\\oemProject\\build\\bin\\icon.ico",)
shutil.copy("E:\\make2\\oemProject\\build\\windows\\icon.ico","E:\\make2\\oemProject\\build\\bin\\icon.ico",)
else:
print(f"Failed to download image. Status code: {response.status_code}")