外部订单处理封面图问题
This commit is contained in:
1 parent
6e420ca015
commit
d74b3439c8
1 file changed
+26
-1
@@ -49,7 +49,16 @@ def reload_obj(pid):
|
||||
#下载obj文件
|
||||
libs.down_obj_from_oss(config.workdir, pid, "print")
|
||||
# obj = reload_obj(pid, action)
|
||||
|
||||
#执行获取obj缩略图
|
||||
print("执行获取obj全身缩略图脚本")
|
||||
os.system(f'python d:\\make2\\tools\pic_for_obj\image_rander_small.py -pid {pid} -i D://print/{pid} -o D://print/{pid}')
|
||||
#判断文件是否存在,存在则上传到oss, 更新数据库内容
|
||||
if os.path.exists(f'D://print/{pid}/{pid}_pic.png'):
|
||||
#获取拍照订单的信息,从中得到拍照订单的信息
|
||||
imagePathT = get_p3d_info(str(pid))
|
||||
if imagePathT != 0:
|
||||
print("imagePathT",imagePathT)
|
||||
config.oss_bucket_website.put_object_from_file(f'{imagePathT}', f'D://print/{pid}/{pid}_pic.png')
|
||||
|
||||
obj_filename = os.path.join(config.workdir,'print',pid,f'{pid}.obj')
|
||||
bpy.ops.wm.read_homefile()
|
||||
@@ -63,6 +72,22 @@ def reload_obj(pid):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
|
||||
def get_p3d_info(pid):
|
||||
url = "https://mp.api.suwa3d.com/api/customerP3dLog/info?id="+pid
|
||||
res = requests.get(url)
|
||||
res = res.json()
|
||||
if res["code"] == 1000:
|
||||
|
||||
#https://www.suwa3d.com/external_order_cover/2025/01/09/1x4pzvxolk6d6xflb8p8r779e0oo2myn.png
|
||||
imagePath = res["data"]["texture_cover_img"]
|
||||
#字符串替换
|
||||
imagePath = imagePath.replace("https://www.suwa3d.com/","")
|
||||
|
||||
return imagePath
|
||||
else:
|
||||
return 0
|
||||
|
||||
|
||||
def base_fix(pid):
|
||||
# 统一blender环境
|
||||
reload_obj(pid)
|
||||
|
||||
Reference in new issue
Block a user