|
|
@@ -311,6 +311,19 @@ async def fromExcelHandler(params: HandlerDetail):
|
|
|
"info": "处理成功",
|
|
|
}
|
|
|
)
|
|
|
+ if len(move_folder_array.keys()) == len(goods_art_no_arrays):
|
|
|
+ progress = {"status":"处理完成",
|
|
|
+ "current":len(goods_art_no_arrays),
|
|
|
+ "total":len(goods_art_no_arrays),
|
|
|
+ "error":0
|
|
|
+ }
|
|
|
+ await sendAsyncMessage(
|
|
|
+ msg="抠图完成",
|
|
|
+ data={"output_folder": handler_result_folder, "list": handler_result},
|
|
|
+ status="抠图完成",
|
|
|
+ msg_type="segment_progress",
|
|
|
+ progress=progress
|
|
|
+ )
|
|
|
try:
|
|
|
if is_product_scene == 1:
|
|
|
if product_scene_prompt == "" or product_scene_prompt == None:
|
|
|
@@ -326,236 +339,294 @@ async def fromExcelHandler(params: HandlerDetail):
|
|
|
raise UnicornException("请选择女模特")
|
|
|
return_data_check_before_detail = run_main.check_before_detail(config_data)
|
|
|
print("报错前返回的结果数据", return_data_check_before_detail)
|
|
|
- if is_product_scene == 1:
|
|
|
- goods_dict = parserGoodsDict2Aigc(return_data_check_before_detail)
|
|
|
- new_goods_dict = {}
|
|
|
- await sendAsyncMessage(
|
|
|
- msg="开始处理场景图",
|
|
|
- goods_arts=[goods_art_no for goods_art_no in goods_dict.keys()],
|
|
|
- status="开始处理",
|
|
|
- msg_type="scene_progress",
|
|
|
- )
|
|
|
- for goods_art_no in goods_dict.keys():
|
|
|
- print("处理场景图", goods_art_no)
|
|
|
- goods_art_dict_info = goods_dict[goods_art_no]
|
|
|
- first_goods_art_no_info = goods_art_dict_info.get("货号资料", [])[0]
|
|
|
- first_pics = first_goods_art_no_info.get("pics")
|
|
|
- ceshi_image_path = first_pics.get("侧视-抠图")
|
|
|
- save_root_path = ceshi_image_path.split("阴影图处理")[0]
|
|
|
- save_image_path = f"{save_root_path}场景图.jpg"
|
|
|
- if os.path.isfile(save_image_path):
|
|
|
- goods_art_dict_info["场景图"] = save_image_path
|
|
|
- new_goods_dict[goods_art_no] = goods_art_dict_info
|
|
|
- continue
|
|
|
- aigc_clazz.center_paste_image(ceshi_image_path, save_image_path)
|
|
|
- try:
|
|
|
- image_path = aigc_clazz.generateProductScene(
|
|
|
- save_image_path, product_scene_prompt, save_image_path
|
|
|
- )
|
|
|
- # image_path = aigc_clazz.generateProductSceneQW(
|
|
|
- # save_image_path, product_scene_prompt, save_image_path
|
|
|
- # )
|
|
|
- goods_art_dict_info["场景图"] = image_path
|
|
|
- new_goods_dict[goods_art_no] = goods_art_dict_info
|
|
|
- handler_result.append(
|
|
|
- {
|
|
|
- "goods_art_no": goods_art_no,
|
|
|
- "success": True,
|
|
|
- "info": "场景图处理成功",
|
|
|
- }
|
|
|
- )
|
|
|
- await sendAsyncMessage(
|
|
|
- msg="场景图处理完成",
|
|
|
- goods_arts=[goods_art_no],
|
|
|
- status="场景图处理完成",
|
|
|
- msg_type="scene_progress",
|
|
|
- )
|
|
|
- except Exception as e:
|
|
|
- os.remove(save_image_path)
|
|
|
- handler_result.append(
|
|
|
- {
|
|
|
- "goods_art_no": goods_art_no,
|
|
|
- "success": False,
|
|
|
- "info": f"场景图处理失败:{e}",
|
|
|
- }
|
|
|
- )
|
|
|
- await sendAsyncMessage(
|
|
|
- msg="场景图处理失败",
|
|
|
- goods_arts=[goods_art_no],
|
|
|
- status="场景图处理失败",
|
|
|
- msg_type="scene_progress",
|
|
|
- )
|
|
|
- if new_goods_dict is not None or new_goods_dict != {}:
|
|
|
- return_data_check_before_detail["data"][
|
|
|
- "goods_no_dict"
|
|
|
- ] = new_goods_dict
|
|
|
- if is_upper_footer == 1:
|
|
|
- goods_dict = parserGoodsDict2Aigc(return_data_check_before_detail)
|
|
|
- new_goods_dict = {}
|
|
|
- await sendAsyncMessage(
|
|
|
- msg="开始处理模特图",
|
|
|
- goods_arts=list(goods_dict.keys()),
|
|
|
- status="开始处理模特图",
|
|
|
- msg_type="upper_footer_progress",
|
|
|
- )
|
|
|
- for goods_art_no in goods_dict.keys():
|
|
|
- goods_art_dict_info = goods_dict[goods_art_no]
|
|
|
- first_goods_art_no_info = goods_art_dict_info.get("货号资料", [])[0]
|
|
|
- first_pics = first_goods_art_no_info.get("pics")
|
|
|
- gender = goods_art_dict_info.get("性别")
|
|
|
- model_id = man_id if "男" in gender else women_id
|
|
|
- ceshi_image_path = first_pics.get("侧视-抠图")
|
|
|
- save_root_path = ceshi_image_path.split("阴影图处理")[0]
|
|
|
- save_image_path = f"{save_root_path}模特图.jpg"
|
|
|
- if os.path.isfile(save_image_path):
|
|
|
- goods_art_dict_info["模特图"] = save_image_path
|
|
|
- new_goods_dict[goods_art_no] = goods_art_dict_info
|
|
|
- continue
|
|
|
- shutil.copy(ceshi_image_path, save_image_path)
|
|
|
- try:
|
|
|
- image_path = aigc_clazz.generateUpperShoes(
|
|
|
- save_image_path, model_id, save_image_path
|
|
|
- )
|
|
|
- # image_path = aigc_clazz.generateModelShoesQW(
|
|
|
- # save_image_path, model_id, save_image_path
|
|
|
- # )
|
|
|
- goods_art_dict_info["模特图"] = image_path
|
|
|
- new_goods_dict[goods_art_no] = goods_art_dict_info
|
|
|
- handler_result.append(
|
|
|
- {
|
|
|
- "goods_art_no": goods_art_no,
|
|
|
- "success": True,
|
|
|
- "info": "模特图处理成功",
|
|
|
- }
|
|
|
- )
|
|
|
- await sendAsyncMessage(
|
|
|
- msg="模特图处理成功",
|
|
|
- goods_arts=[goods_art_no],
|
|
|
- status="模特图处理成功",
|
|
|
- msg_type="upper_footer_progress",
|
|
|
- )
|
|
|
- except Exception as e:
|
|
|
- os.remove(save_image_path)
|
|
|
- handler_result.append(
|
|
|
- {
|
|
|
- "goods_art_no": goods_art_no,
|
|
|
- "success": False,
|
|
|
- "info": f"模特图处理失败:{e}",
|
|
|
- }
|
|
|
- )
|
|
|
+ success_handler = return_data_check_before_detail.get("data").get("config_data").get("success_handler",[])
|
|
|
+ failed_items = [item for item in success_handler if item.get('success') == False]
|
|
|
+ print("failed_items",failed_items)
|
|
|
+ if len(failed_items) > 0:
|
|
|
+ await sendAsyncMessage(
|
|
|
+ msg="处理结束",
|
|
|
+ data={"output_folder": handler_result_folder, "list": failed_items},
|
|
|
+ status="处理结束",
|
|
|
+ msg_type="detail_result_progress",
|
|
|
+ )
|
|
|
+ if len(failed_items)!=0 and len(failed_items) == len(success_handler):
|
|
|
+ # 如果全部错误 直接终止
|
|
|
+ return True
|
|
|
+ else:
|
|
|
+ if is_product_scene == 1:
|
|
|
+ goods_dict = parserGoodsDict2Aigc(return_data_check_before_detail)
|
|
|
+ new_goods_dict = {}
|
|
|
+ product_scene_total_progress = len(goods_dict.keys())
|
|
|
+ product_scene_finish_progress = 0
|
|
|
+ product_scene_error_progress = 0
|
|
|
+ product_scene_progress = {"status":"正在处理", "current":product_scene_finish_progress, "total":product_scene_total_progress, "error":product_scene_error_progress}
|
|
|
+ print("product_scene_progress",goods_dict,product_scene_progress)
|
|
|
+ await sendAsyncMessage(
|
|
|
+ msg="开始处理场景图",
|
|
|
+ goods_arts=[goods_art_no for goods_art_no in goods_dict.keys()],
|
|
|
+ status="开始处理",
|
|
|
+ msg_type="scene_progress",
|
|
|
+ progress=product_scene_progress
|
|
|
+ )
|
|
|
+ for goods_art_no in goods_dict.keys():
|
|
|
+ print("处理场景图", goods_art_no)
|
|
|
+ product_scene_finish_progress+=1
|
|
|
+ product_scene_progress = {"status":"正在处理","goods_art_no":goods_art_no, "current":product_scene_finish_progress, "total":product_scene_total_progress, "error":product_scene_error_progress}
|
|
|
await sendAsyncMessage(
|
|
|
- msg="模特图处理失败",
|
|
|
- goods_arts=[goods_art_no],
|
|
|
- status="模特图处理失败",
|
|
|
- msg_type="upper_footer_progress",
|
|
|
- )
|
|
|
- if new_goods_dict is not None or new_goods_dict != {}:
|
|
|
- return_data_check_before_detail["data"][
|
|
|
- "goods_no_dict"
|
|
|
- ] = new_goods_dict
|
|
|
- await sendAsyncMessage(
|
|
|
- msg="开始处理详情页",
|
|
|
- goods_arts=[],
|
|
|
- status="开始处理详情页",
|
|
|
- msg_type="detail_progress",
|
|
|
- )
|
|
|
- check_for_detail_first_res = run_main.check_for_detail_first_call_back(
|
|
|
- return_data_check_before_detail
|
|
|
- )
|
|
|
- if isinstance(check_for_detail_first_res, partial):
|
|
|
- result = check_for_detail_first_res()
|
|
|
- try:
|
|
|
- config_data = result["config_data"]
|
|
|
- except:
|
|
|
- config_data = result
|
|
|
- if config_data["sign_text"] == "已结束详情处理":
|
|
|
- await sendAsyncMessage(
|
|
|
- msg="详情页处理结束",
|
|
|
- goods_arts=[],
|
|
|
- status="详情页处理结束",
|
|
|
- msg_type="detail_progress",
|
|
|
- )
|
|
|
- print("config_data", config_data)
|
|
|
- # if config_data["upload_is_enable"]:
|
|
|
- # to_deal_dir = "{}/软件-详情图生成".format(config_data["image_dir"])
|
|
|
- # check_path(to_deal_dir)
|
|
|
- # print("to_deal_dir", to_deal_dir)
|
|
|
- # if os.path.exists(to_deal_dir):
|
|
|
- # upload_pic = UploadPic(
|
|
|
- # windows=None,
|
|
|
- # to_deal_dir=to_deal_dir,
|
|
|
- # config_data=config_data,
|
|
|
- # token=token,
|
|
|
- # )
|
|
|
- # upload_pic.run()
|
|
|
- out_put_dir = config_data.get("out_put_dir")
|
|
|
- if out_put_dir == None:
|
|
|
- handler_result_folder = ""
|
|
|
- if len(config_data["success_handler"]) > 0:
|
|
|
- for good_art in config_data["success_handler"]:
|
|
|
- handler_result.append(good_art)
|
|
|
- else:
|
|
|
- for good_art in goods_art_no_arrays:
|
|
|
+ msg="正在处理场景图",
|
|
|
+ goods_arts=[goods_art_no],
|
|
|
+ status="正在处理场景图",
|
|
|
+ msg_type="scene_progress",
|
|
|
+ progress=product_scene_progress
|
|
|
+ )
|
|
|
+ goods_art_dict_info = goods_dict[goods_art_no]
|
|
|
+ first_goods_art_no_info = goods_art_dict_info.get("货号资料", [])[0]
|
|
|
+ first_pics = first_goods_art_no_info.get("pics")
|
|
|
+ ceshi_image_path = first_pics.get("侧视-抠图")
|
|
|
+ save_root_path = ceshi_image_path.split("阴影图处理")[0]
|
|
|
+ save_image_path = f"{save_root_path}场景图.jpg"
|
|
|
+ if os.path.isfile(save_image_path):
|
|
|
+ goods_art_dict_info["场景图"] = save_image_path
|
|
|
+ new_goods_dict[goods_art_no] = goods_art_dict_info
|
|
|
+ continue
|
|
|
+ aigc_clazz.center_paste_image(ceshi_image_path, save_image_path)
|
|
|
+ try:
|
|
|
+ image_path = aigc_clazz.generateProductScene(
|
|
|
+ save_image_path, product_scene_prompt, save_image_path
|
|
|
+ )
|
|
|
+ # image_path = aigc_clazz.generateProductSceneQW(
|
|
|
+ # save_image_path, product_scene_prompt, save_image_path
|
|
|
+ # )
|
|
|
+ goods_art_dict_info["场景图"] = image_path
|
|
|
+ new_goods_dict[goods_art_no] = goods_art_dict_info
|
|
|
handler_result.append(
|
|
|
{
|
|
|
- "goods_art_no": good_art,
|
|
|
- "success": False,
|
|
|
- "info": "处理失败",
|
|
|
+ "goods_art_no": goods_art_no,
|
|
|
+ "success": True,
|
|
|
+ "info": "场景图处理成功",
|
|
|
}
|
|
|
)
|
|
|
- else:
|
|
|
- out_put_dir_path = "{}/{}".format(os.getcwd(), out_put_dir).replace(
|
|
|
- "\\", "/"
|
|
|
- )
|
|
|
- handler_result_folder = os.path.dirname(out_put_dir_path)
|
|
|
- if len(config_data["success_handler"]) == 0:
|
|
|
- for good_art in goods_art_no_arrays:
|
|
|
+ product_scene_progress = {
|
|
|
+ "status":"处理成功",
|
|
|
+ "current":product_scene_finish_progress,
|
|
|
+ "total":product_scene_total_progress,
|
|
|
+ "error":product_scene_error_progress,
|
|
|
+ "goods_art_no":goods_art_no,
|
|
|
+ }
|
|
|
+ await sendAsyncMessage(
|
|
|
+ msg="场景图处理完成",
|
|
|
+ goods_arts=[goods_art_no],
|
|
|
+ status="场景图处理完成",
|
|
|
+ msg_type="scene_progress",
|
|
|
+ progress=product_scene_progress
|
|
|
+ )
|
|
|
+ except Exception as e:
|
|
|
+ os.remove(save_image_path)
|
|
|
handler_result.append(
|
|
|
{
|
|
|
- "goods_art_no": good_art,
|
|
|
+ "goods_art_no": goods_art_no,
|
|
|
"success": False,
|
|
|
- "info": "处理失败",
|
|
|
+ "info": f"场景图处理失败:{e}",
|
|
|
}
|
|
|
)
|
|
|
- else:
|
|
|
- if len(online_stores) > 0:
|
|
|
- result_goods_no_dict = return_data_check_before_detail["data"][
|
|
|
- "goods_no_dict"
|
|
|
- ]
|
|
|
- for goods_idx, goods_no_dict in enumerate(
|
|
|
- result_goods_no_dict.keys()
|
|
|
- ):
|
|
|
- all_detail_path_list = config_data["all_detail_path_list"]
|
|
|
- for detail_path in all_detail_path_list:
|
|
|
- if goods_no_dict in detail_path:
|
|
|
- detail_path_replace = detail_path.replace("\\", "/")
|
|
|
- result_goods_no_dict[goods_no_dict][
|
|
|
- "detail_path"
|
|
|
- ] = f"{detail_path_replace}/详情页.jpg"
|
|
|
+ product_scene_finish_progress -=1
|
|
|
+ product_scene_error_progress +=1
|
|
|
+ product_scene_progress = {"status":"处理失败","goods_art_no":goods_art_no, "current":product_scene_finish_progress, "total":product_scene_total_progress, "error":product_scene_error_progress}
|
|
|
await sendAsyncMessage(
|
|
|
- msg="开始上传商品数据",
|
|
|
+ msg="场景图处理失败",
|
|
|
+ goods_arts=[goods_art_no],
|
|
|
+ status="场景图处理失败",
|
|
|
+ msg_type="scene_progress",
|
|
|
+ progress=product_scene_progress
|
|
|
+ )
|
|
|
+ product_scene_progress = {"status":"处理完成", "current":product_scene_finish_progress, "total":product_scene_total_progress, "error":product_scene_error_progress}
|
|
|
+ await sendAsyncMessage(
|
|
|
+ msg="场景图处理结束",
|
|
|
goods_arts=[],
|
|
|
- status="开始上传商品数据",
|
|
|
- msg_type="upload_goods_progress",
|
|
|
+ status="场景图处理结束",
|
|
|
+ msg_type="scene_progress",
|
|
|
+ progress=product_scene_progress
|
|
|
)
|
|
|
- try:
|
|
|
- onlineData.uploadGoods2ThirdParty(
|
|
|
- result_goods_no_dict, online_stores=online_stores
|
|
|
- )
|
|
|
- except Exception as e:
|
|
|
- print(f"上传任务出现错误:{e}")
|
|
|
+ if new_goods_dict is not None or new_goods_dict != {}:
|
|
|
+ return_data_check_before_detail["data"][
|
|
|
+ "goods_no_dict"
|
|
|
+ ] = new_goods_dict
|
|
|
+ if is_upper_footer == 1:
|
|
|
+ goods_dict = parserGoodsDict2Aigc(return_data_check_before_detail)
|
|
|
+ new_goods_dict = {}
|
|
|
+ upper_footer_total_progress = len(goods_dict.keys())
|
|
|
+ upper_footer_finish_progress = 0
|
|
|
+ upper_footer_error_progress = 0
|
|
|
+ upper_footer_progress = {"status":"正在处理", "current":upper_footer_finish_progress, "total":upper_footer_total_progress, "error":upper_footer_error_progress}
|
|
|
+ await sendAsyncMessage(
|
|
|
+ msg="开始处理模特图",
|
|
|
+ goods_arts=list(goods_dict.keys()),
|
|
|
+ status="开始处理模特图",
|
|
|
+ msg_type="upper_footer_progress",
|
|
|
+ progress=upper_footer_progress
|
|
|
+ )
|
|
|
+ for goods_art_no in goods_dict.keys():
|
|
|
+ upper_footer_finish_progress+=1
|
|
|
+ upper_footer_progress = {"status":"正在处理","goods_art_no":goods_art_no, "current":product_scene_finish_progress, "total":product_scene_total_progress, "error":product_scene_error_progress}
|
|
|
+ await sendAsyncMessage(
|
|
|
+ msg="正在处理模特图",
|
|
|
+ goods_arts=[goods_art_no],
|
|
|
+ status="正在处理模特图",
|
|
|
+ msg_type="upper_footer_progress",
|
|
|
+ progress=upper_footer_progress
|
|
|
+ )
|
|
|
+ goods_art_dict_info = goods_dict[goods_art_no]
|
|
|
+ first_goods_art_no_info = goods_art_dict_info.get("货号资料", [])[0]
|
|
|
+ first_pics = first_goods_art_no_info.get("pics")
|
|
|
+ gender = goods_art_dict_info.get("性别")
|
|
|
+ model_id = man_id if "男" in gender else women_id
|
|
|
+ ceshi_image_path = first_pics.get("侧视-抠图")
|
|
|
+ save_root_path = ceshi_image_path.split("阴影图处理")[0]
|
|
|
+ save_image_path = f"{save_root_path}模特图.jpg"
|
|
|
+ if os.path.isfile(save_image_path):
|
|
|
+ goods_art_dict_info["模特图"] = save_image_path
|
|
|
+ new_goods_dict[goods_art_no] = goods_art_dict_info
|
|
|
+ continue
|
|
|
+ shutil.copy(ceshi_image_path, save_image_path)
|
|
|
+ try:
|
|
|
+ image_path = aigc_clazz.generateUpperShoes(
|
|
|
+ save_image_path, model_id, save_image_path
|
|
|
+ )
|
|
|
+ # image_path = aigc_clazz.generateModelShoesQW(
|
|
|
+ # save_image_path, model_id, save_image_path
|
|
|
+ # )
|
|
|
+ goods_art_dict_info["模特图"] = image_path
|
|
|
+ new_goods_dict[goods_art_no] = goods_art_dict_info
|
|
|
+ handler_result.append(
|
|
|
+ {
|
|
|
+ "goods_art_no": goods_art_no,
|
|
|
+ "success": True,
|
|
|
+ "info": "模特图处理成功",
|
|
|
+ }
|
|
|
+ )
|
|
|
+ upper_footer_progress = {"status":"处理完成", "goods_art_no": goods_art_no,"current":upper_footer_finish_progress, "total":upper_footer_total_progress, "error":upper_footer_error_progress}
|
|
|
+ await sendAsyncMessage(
|
|
|
+ msg="模特图处理成功",
|
|
|
+ goods_arts=[goods_art_no],
|
|
|
+ status="模特图处理成功",
|
|
|
+ msg_type="upper_footer_progress",
|
|
|
+ progress=upper_footer_progress
|
|
|
+ )
|
|
|
+ except Exception as e:
|
|
|
+ os.remove(save_image_path)
|
|
|
+ handler_result.append(
|
|
|
+ {
|
|
|
+ "goods_art_no": goods_art_no,
|
|
|
+ "success": False,
|
|
|
+ "info": f"模特图处理失败:{e}",
|
|
|
+ }
|
|
|
+ )
|
|
|
+ upper_footer_error_progress+=1
|
|
|
+ upper_footer_progress = {"status":"处理失败", "goods_art_no": goods_art_no,"current":upper_footer_finish_progress, "total":upper_footer_total_progress, "error":upper_footer_error_progress}
|
|
|
await sendAsyncMessage(
|
|
|
- msg="商品上传第三方成功",
|
|
|
+ msg="模特图处理失败",
|
|
|
+ goods_arts=[goods_art_no],
|
|
|
+ status="模特图处理失败",
|
|
|
+ msg_type="upper_footer_progress",
|
|
|
+ progress=upper_footer_progress
|
|
|
+ )
|
|
|
+ upper_footer_progress = {"status":"处理完成", "current":upper_footer_finish_progress, "total":upper_footer_total_progress, "error":upper_footer_error_progress}
|
|
|
+ await sendAsyncMessage(
|
|
|
+ msg="模特图处理结束",
|
|
|
goods_arts=[],
|
|
|
- status="商品上传第三方成功",
|
|
|
- msg_type="upload_goods_progress",
|
|
|
+ status="模特图处理结束",
|
|
|
+ msg_type="upper_footer_progress",
|
|
|
+ progress=upper_footer_progress
|
|
|
)
|
|
|
- handler_result = config_data["success_handler"]
|
|
|
- else:
|
|
|
- for good_art in goods_art_no_arrays:
|
|
|
- handler_result.append(
|
|
|
- {"goods_art_no": good_art, "success": False, "info": "处理失败"}
|
|
|
+ if new_goods_dict is not None or new_goods_dict != {}:
|
|
|
+ return_data_check_before_detail["data"][
|
|
|
+ "goods_no_dict"
|
|
|
+ ] = new_goods_dict
|
|
|
+ check_for_detail_first_res = run_main.check_for_detail_first_call_back(
|
|
|
+ return_data_check_before_detail
|
|
|
+ )
|
|
|
+ if isinstance(check_for_detail_first_res, partial):
|
|
|
+ result = check_for_detail_first_res()
|
|
|
+ try:
|
|
|
+ config_data = result["config_data"]
|
|
|
+ except:
|
|
|
+ config_data = result
|
|
|
+ if config_data["sign_text"] == "已结束详情处理":
|
|
|
+ await sendAsyncMessage(
|
|
|
+ msg="详情页处理结束",
|
|
|
+ goods_arts=[],
|
|
|
+ status="详情页处理结束",
|
|
|
+ msg_type="detail_progress",
|
|
|
)
|
|
|
+ print("config_data", config_data)
|
|
|
+ out_put_dir = config_data.get("out_put_dir")
|
|
|
+ if out_put_dir == None:
|
|
|
+ handler_result_folder = ""
|
|
|
+ if len(config_data["success_handler"]) > 0:
|
|
|
+ for good_art in config_data["success_handler"]:
|
|
|
+ handler_result.append(good_art)
|
|
|
+ else:
|
|
|
+ for good_art in goods_art_no_arrays:
|
|
|
+ handler_result.append(
|
|
|
+ {
|
|
|
+ "goods_art_no": good_art,
|
|
|
+ "success": False,
|
|
|
+ "info": "处理失败",
|
|
|
+ }
|
|
|
+ )
|
|
|
+ else:
|
|
|
+ out_put_dir_path = "{}/{}".format(os.getcwd(), out_put_dir).replace(
|
|
|
+ "\\", "/"
|
|
|
+ )
|
|
|
+ handler_result_folder = os.path.dirname(out_put_dir_path)
|
|
|
+ if len(config_data["success_handler"]) == 0:
|
|
|
+ for good_art in goods_art_no_arrays:
|
|
|
+ handler_result.append(
|
|
|
+ {
|
|
|
+ "goods_art_no": good_art,
|
|
|
+ "success": False,
|
|
|
+ "info": "处理失败",
|
|
|
+ }
|
|
|
+ )
|
|
|
+ else:
|
|
|
+ if len(online_stores) > 0:
|
|
|
+ result_goods_no_dict = return_data_check_before_detail["data"][
|
|
|
+ "goods_no_dict"
|
|
|
+ ]
|
|
|
+ for goods_idx, goods_no_dict in enumerate(
|
|
|
+ result_goods_no_dict.keys()
|
|
|
+ ):
|
|
|
+ all_detail_path_list = config_data["all_detail_path_list"]
|
|
|
+ for detail_path in all_detail_path_list:
|
|
|
+ if goods_no_dict in detail_path:
|
|
|
+ detail_path_replace = detail_path.replace("\\", "/")
|
|
|
+ result_goods_no_dict[goods_no_dict][
|
|
|
+ "detail_path"
|
|
|
+ ] = f"{detail_path_replace}/详情页.jpg"
|
|
|
+ await sendAsyncMessage(
|
|
|
+ msg="开始上传商品数据",
|
|
|
+ goods_arts=[],
|
|
|
+ status="开始上传商品数据",
|
|
|
+ msg_type="upload_goods_progress",
|
|
|
+ )
|
|
|
+ try:
|
|
|
+ onlineData.uploadGoods2ThirdParty(
|
|
|
+ result_goods_no_dict, online_stores=online_stores
|
|
|
+ )
|
|
|
+ except Exception as e:
|
|
|
+ print(f"上传任务出现错误:{e}")
|
|
|
+ await sendAsyncMessage(
|
|
|
+ msg="商品上传第三方成功",
|
|
|
+ goods_arts=[],
|
|
|
+ status="商品上传第三方成功",
|
|
|
+ msg_type="upload_goods_progress",
|
|
|
+ )
|
|
|
+ handler_result = config_data["success_handler"]
|
|
|
+ else:
|
|
|
+ for good_art in goods_art_no_arrays:
|
|
|
+ handler_result.append(
|
|
|
+ {"goods_art_no": good_art, "success": False, "info": "处理失败"}
|
|
|
+ )
|
|
|
except UnicornException as e:
|
|
|
handler_result_folder = ""
|
|
|
handler_result.append(
|
|
|
@@ -1082,17 +1153,6 @@ async def process_handle_detail(request: Request, params: HandlerDetail):
|
|
|
msg_type="detail_result_progress",
|
|
|
)
|
|
|
return True
|
|
|
- # detail_total_progress = len(goods_dict.keys())
|
|
|
- # detail_finish_progress = 0
|
|
|
- detail_error_progress = 0
|
|
|
- # detail_progress = {"status":"开始处理", "current":detail_finish_progress, "total":detail_total_progress, "error":detail_error_progress}
|
|
|
- # await sendAsyncMessage(
|
|
|
- # msg="开始处理详情页",
|
|
|
- # goods_arts=[],
|
|
|
- # status="开始处理详情页",
|
|
|
- # msg_type="detail_progress",
|
|
|
- # progress=detail_progress
|
|
|
- # )
|
|
|
check_for_detail_first_res = run_main.check_for_detail_first_call_back(
|
|
|
return_data_check_before_detail
|
|
|
)
|
|
|
@@ -1103,16 +1163,6 @@ async def process_handle_detail(request: Request, params: HandlerDetail):
|
|
|
except:
|
|
|
config_data = result
|
|
|
if config_data["sign_text"] == "已结束详情处理":
|
|
|
- # detail_finish_progress = len(config_data["success_handler"])
|
|
|
- # detail_error_progress = detail_total_progress - detail_finish_progress
|
|
|
- # detail_progress = {"status":"处理完成", "current":detail_finish_progress, "total":detail_total_progress, "error":detail_error_progress}
|
|
|
- # await sendAsyncMessage(
|
|
|
- # msg="详情页处理结束",
|
|
|
- # goods_arts=[],
|
|
|
- # status="详情页处理结束",
|
|
|
- # msg_type="detail_progress",
|
|
|
- # progress=detail_progress
|
|
|
- # )
|
|
|
print("config_data", config_data)
|
|
|
out_put_dir = config_data.get("out_put_dir")
|
|
|
if out_put_dir == None:
|