rambo 3 місяців тому
батько
коміт
b4e0395d95
1 змінених файлів з 12 додано та 4 видалено
  1. 12 4
      python/service/online_request/module_online_data.py

+ 12 - 4
python/service/online_request/module_online_data.py

@@ -526,14 +526,15 @@ class OnlineDataRequest(object):
     def uploadGoods2ThirdParty(self, goods_no_dict=None, online_stores=[]):
         params = []
         message_type = "upload_goods_progress"
+        if goods_no_dict == None:
+            return
         self.sendSocketMessage(
             code=0,
             msg="开始上传商品数据",
-            data={"online_stores": online_stores, "status": "进行中"},
+            data={"goods_arts": list(goods_no_dict.keys()), "status": "进行中"},
             msg_type=message_type,
         )
-        if goods_no_dict == None:
-            return
+        success_goods_arts = []
         for store in online_stores:
             for goods_no in goods_no_dict.keys():
                 goods_data = goods_no_dict[goods_no]
@@ -547,6 +548,12 @@ class OnlineDataRequest(object):
                 if goods_price == '':
                     goods_price = 0
                 if goods_price == 0:
+                    self.sendSocketMessage(
+                        code=0,
+                        msg="上传商品异常",
+                        data={goods_arts: [goods_no], "status": "商品价格不存在"},
+                        msg_type=message_type,
+                    )
                     continue
                 skuList = []
                 itemImageInfoList = []
@@ -560,6 +567,7 @@ class OnlineDataRequest(object):
                     mainImages = sku_data.get("800x800", [])
                     if not mainImages:
                         continue
+                    success_goods_arts.append(sku_goods_art_no)
                     mainImagePath = mainImages[0]
                     imageUrl = self.uploadImage(local_path=mainImagePath)
                     skuItemData = {
@@ -633,7 +641,7 @@ class OnlineDataRequest(object):
         self.sendSocketMessage(
             code=0,
             msg="商品上传第三方成功",
-            data={"online_stores": online_stores, "status": "已完成"},
+            data={"goods_arts": success_goods_arts, "status": "已完成"},
             msg_type=message_type,
         )