建模相关功能的修改
This commit is contained in:
1 parent
e1a7647fcb
commit
04852e95cd
7 files changed
+280
-7
No files matched your search
@@ -43,7 +43,10 @@ def readTask(key):
|
||||
print("走新的建模系统不是分布式插入-重建工单",key,pid,psid)
|
||||
libs_db.add_task(taskData)
|
||||
else:
|
||||
if int(psid) <= 90 and int(psid) != 29 and int(psid) != 56:
|
||||
intPid = int(psid)
|
||||
if intPid == 29 or intPid == 94 or intPid == 51:
|
||||
libs_db.add_task(taskData)
|
||||
elif int(psid) <= 90 and int(psid) != 29 and int(psid) != 56 and int(psid) != 1:
|
||||
print("走分布式建模",key,pid,psid)
|
||||
if int(psid) == 41 or int(psid) == 85:
|
||||
taskData["priority"] = 0
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
|
||||
import redis,requests,json,os,sys
|
||||
|
||||
import platform
|
||||
if platform.system() == 'Windows':
|
||||
sys.path.append('e:\\libs\\')
|
||||
else:
|
||||
sys.path.append('/data/deploy/make3d/make2/libs/')
|
||||
import config
|
||||
|
||||
import requests
|
||||
from PIL import Image
|
||||
from io import BytesIO
|
||||
|
||||
def main():
|
||||
#连接mp 的redis
|
||||
r = redis.Redis(host="106.14.158.208",password="kcV2000",port=6379,db=1)
|
||||
#取出数据
|
||||
oemId = r.lpop('setup')
|
||||
oemId = 21
|
||||
if oemId is None:
|
||||
print("没有从redis中获取到oemId的数据")
|
||||
return
|
||||
print("oemId",oemId)
|
||||
#请求mp的接口,获取对应的oem的数据
|
||||
res = requests.get("http://172.16.20.7:8199/api/oem/infoById",params={"id":oemId})
|
||||
#获取数据解析数据
|
||||
# print(res.text)
|
||||
#解析数据
|
||||
data = json.loads(res.text)
|
||||
# print(data)
|
||||
if data['code'] != 1000:
|
||||
print("根据id获取oem数据失败")
|
||||
return
|
||||
print(data['data'])
|
||||
|
||||
#pythob 进入到 E:\wails\oemProject ,将 data 数据写入到 wails.json 文件中的 ext_oem 字段中
|
||||
with open("D:\\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:
|
||||
json.dump(wailsData,f,ensure_ascii=False,indent=4)
|
||||
|
||||
# #将图片下载到本地
|
||||
getExeImg(data['data']['logo'], "D:\\oemProject\\build\\appicon.png")
|
||||
|
||||
|
||||
|
||||
#写入成功后在 E:\\wails\\oemProject\\ 目录下执行 wails build 命令
|
||||
os.system("cd D:\\oemProject && wails build")
|
||||
|
||||
# #执行 wails build 命令后,将 E:\wails\oemProject\build\bin ,在上传到 oss 中
|
||||
config.oss_bucket.put_object_from_file(f'exe/'+str(data['data']['id'])+".exe", "D:\\oemProject\\build\\bin\\"+str(data['data']['id'])+".exe")
|
||||
print("上传成功")
|
||||
# #上传成功后,调用接口,告诉mp,已经生成exe及上传成功
|
||||
requests.get("http://172.16.20.7:8199/api/oem/infoSetupUpdate",params={"id":oemId})
|
||||
|
||||
|
||||
def getExeImg(image_url, output_path):
|
||||
# 从URL获取图片
|
||||
response = requests.get(image_url)
|
||||
if response.status_code == 200:
|
||||
# 将内容读取为图片
|
||||
image = Image.open(BytesIO(response.content))
|
||||
# 修改图片尺寸为1024x1024
|
||||
resized_image = image.resize((1024, 1024))
|
||||
# 保存图片为PNG格式
|
||||
resized_image.save(output_path, 'PNG')
|
||||
else:
|
||||
print(f"Failed to download image. Status code: {response.status_code}")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in new issue
Block a user