shish 9 tháng trước cách đây
mục cha
commit
f77ea93176

+ 4 - 1
app-hd/controllers/GoodsController.php

@@ -33,7 +33,10 @@ class GoodsController extends BaseController
         if (empty($info)) {
         if (empty($info)) {
             util::fail('没有找到商品');
             util::fail('没有找到商品');
         }
         }
-
+        $shop = $this->shop;
+        if (empty($info->sn)) {
+            $info = GoodsClass::generateSn($info, $shop);
+        }
         $shopId = $this->shopId;
         $shopId = $this->shopId;
 
 
         $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
         $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);

+ 2 - 2
biz-hd/goods/classes/GoodsClass.php

@@ -870,7 +870,7 @@ class GoodsClass extends BaseClass
     public static function generateSn($goods, $shop)
     public static function generateSn($goods, $shop)
     {
     {
         if (!empty($goods->sn)) {
         if (!empty($goods->sn)) {
-            return true;
+            return $goods;
         }
         }
         $shopId = $shop->id;
         $shopId = $shop->id;
         $mainId = $shop->mainId;
         $mainId = $shop->mainId;
@@ -878,7 +878,7 @@ class GoodsClass extends BaseClass
         $sn = orderSn::getGoodsSn($data);
         $sn = orderSn::getGoodsSn($data);
         $goods->sn = $sn;
         $goods->sn = $sn;
         $goods->save();
         $goods->save();
-        return true;
+        return $goods;
     }
     }
 
 
 }
 }