dongchangxi 9 months ago
parent
commit
2951906785
  1. 26
      timer/external_order_glb.py
  2. 8
      timer/get_task_to_db.py

26
timer/external_order_glb.py

@ -43,6 +43,8 @@ def find_pid_objname(pid):
if obj.name.startswith(str(pid)): if obj.name.startswith(str(pid)):
return obj.name return obj.name
#加载obj文件 #加载obj文件
def reload_obj(pid): def reload_obj(pid):
@ -50,18 +52,18 @@ def reload_obj(pid):
libs.down_obj_from_oss(config.workdir, pid, "print") libs.down_obj_from_oss(config.workdir, pid, "print")
# obj = reload_obj(pid, action) # obj = reload_obj(pid, action)
#执行获取obj缩略图 #执行获取obj缩略图
print("执行获取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}') # 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, 更新数据库内容 # #判断文件是否存在,存在则上传到oss, 更新数据库内容
if os.path.exists(f'D://print/{pid}/{pid}_pic.png'): # if os.path.exists(f'D://print/{pid}/{pid}_pic.png'):
#获取拍照订单的信息,从中得到拍照订单的信息 # #获取拍照订单的信息,从中得到拍照订单的信息
imagePathT = get_p3d_info(str(pid)) # imagePathT = get_p3d_info(str(pid))
if imagePathT != 0: # if imagePathT != 0:
print("imagePathT",imagePathT) # print("imagePathT",imagePathT)
config.oss_bucket_website.put_object_from_file(f'{imagePathT}', f'D://print/{pid}/{pid}_pic.png') # config.oss_bucket_website.put_object_from_file(f'{imagePathT}', f'D://print/{pid}/{pid}_pic.png')
#请求接口 # #请求接口
res = requests.post("https://mp.api.suwa3d.com/api/printOrder/updateCoverByPidForExternalOrder", data={'pid': pid, 'image_path': 'https://www.suwa3d.com/'+imagePathT}) # res = requests.post("https://mp.api.suwa3d.com/api/printOrder/updateCoverByPidForExternalOrder", data={'pid': pid, 'image_path': 'https://www.suwa3d.com/'+imagePathT})
print("res",res) # print("res",res)
obj_filename = os.path.join(config.workdir,'print',pid,f'{pid}.obj') obj_filename = os.path.join(config.workdir,'print',pid,f'{pid}.obj')
bpy.ops.wm.read_homefile() bpy.ops.wm.read_homefile()

8
timer/get_task_to_db.py

@ -48,13 +48,13 @@ def readTask(key):
pid = pid.decode('utf-8') pid = pid.decode('utf-8')
#判断影棚类型 #判断影棚类型
ps_type = get_ps_type(pid) #ps_type = get_ps_type(pid)
if ps_type == 2: #if ps_type == 2:
#方形影棚 #方形影棚
# r.rpush('ai:ai_repeat_build',pid) # r.rpush('ai:ai_repeat_build',pid)
r.rpush('ai:ai_repeat_build',pid) r.rpush('ai:ai_repeat_build',pid)
print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())+"-方形影棚数据推入到新的建模方式的重建队列") #print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())+"-方形影棚数据推入到新的建模方式的重建队列")
common.notify("方形影棚数据推入到新的建模方式的重建队列 (ai:ai_repeat_build),pid="+pid) common.notify("推入到新的建模方式的重建队列 (ai:ai_repeat_build),pid="+pid)
return return
psid = getPSid(pid) psid = getPSid(pid)

Loading…
Cancel
Save