shish 3 роки тому
батько
коміт
9d1815f41c

+ 6 - 0
app-hd/controllers/MtController.php

@@ -99,6 +99,8 @@ class MtController extends PublicController
 
             $goodsName = $goodsInfo['data']['name'] ?? '';
             $goodsPrice = $goodsInfo['data']['price'] ?? '';
+            $description = $goodsInfo['data']['description'] ?? '';
+            $sh = strstr($description, '【鲜花】') !== false ? 1 : 0;
 
             $shopImg = [];
             $cover = '';
@@ -128,6 +130,7 @@ class MtController extends PublicController
                 'catIds' => $catIds,
                 'cover' => $cover,
                 'spu' => $appSpuCode,
+                'sh' => $sh,
             ];
             GoodsClass::addGoods($addData);
             $transaction->commit();
@@ -264,6 +267,8 @@ class MtController extends PublicController
 
             $goodsName = $goodsInfo['data']['name'] ?? '';
             $goodsPrice = $goodsInfo['data']['price'] ?? '';
+            $description = $goodsInfo['data']['description'] ?? '';
+            $sh = strstr($description, '【鲜花】') !== false ? 1 : 0;
 
             $shopImg = [];
             $cover = '';
@@ -280,6 +285,7 @@ class MtController extends PublicController
             $hasGoods->price = $goodsPrice;
             $hasGoods->name = $goodsName;
             $hasGoods->cover = $cover;
+            $hasGoods->sh = $sh;
             $hasGoods->shopImg = json_encode($shopImg);
             $hasGoods->save();
 

+ 3 - 1
biz-hd/goods/classes/GoodsClass.php

@@ -578,8 +578,8 @@ class GoodsClass extends BaseClass
         $newStock = $goodsData['stock'] - $num;
         if ($newStock < 0) {
 
+            $goodsName = $goodsData['name'] ?? '';
             if ($checkStock) {
-                $goodsName = $goodsData['name'] ?? '';
                 util::fail($goodsName . '库存不足,剩余:' . $goodsData['stock']);
             }
 
@@ -620,6 +620,7 @@ class GoodsClass extends BaseClass
                     $bookName = $order->bookName ?? '';
                 }
             }
+            $sh = $goodsData['sh'] ?? 0;
             $params = [
                 'goods' => [['productId' => $goodsId, 'num' => abs($newStock)]],
                 'sjId' => $sjId,
@@ -641,6 +642,7 @@ class GoodsClass extends BaseClass
                 'thirdSn' => $thirdSn,
                 'cardInfo' => $cardInfo,
                 'anonymity' => $anonymity,
+                'sh' => $sh,
             ];
             $main = MainClass::getById($mainId, true);
             if (empty($main)) {

+ 2 - 0
biz-hd/work/classes/WorkClass.php

@@ -125,6 +125,7 @@ class WorkClass extends BaseClass
         $thirdSn = $data['thirdSn'] ?? '';
         $cardInfo = $data['cardInfo'] ?? '';
         $anonymity = $data['anonymity'] ?? 0;
+        $sh = $data['sh'] ?? 0;
 
         $ids = array_column($goods, 'productId');
         $info = GoodsClass::getByIds($ids, null, 'id');
@@ -191,6 +192,7 @@ class WorkClass extends BaseClass
                 'thirdSn' => $thirdSn,
                 'cardInfo' => $cardInfo,
                 'anonymity' => $anonymity,
+                'sh' => $sh,
             ];
             self::createFinish($current, $main);
         }

+ 3 - 0
console/controllers/MtController.php

@@ -62,6 +62,7 @@ class MtController extends Controller
             $picture = $val['picture'] ?? '';
             $price = $val['price'] ?? 0;
             $name = $val['name'] ?? '';
+            $description = $val['description'] ?? '';
             $appSpuCode = $val['app_spu_code'] ?? '';
             if (!empty($appSpuCode)) {
                 $current = GoodsClass::getByCondition(['mainId' => $mainId, 'spu' => $appSpuCode], true);
@@ -69,6 +70,7 @@ class MtController extends Controller
                     continue;
                 }
             }
+            $sh = strstr($description, '【鲜花】') !== false ? 1 : 0;
             $imgArr = explode(',', $picture);
             $shopImg = [];
             foreach ($imgArr as $imgUrl) {
@@ -91,6 +93,7 @@ class MtController extends Controller
                 'catIds' => $catIds,
                 'cover' => $cover,
                 'spu' => $appSpuCode,
+                'sh' => $sh,
             ];
             $goods = GoodsClass::addGoods($addData);
             $goodsId = $goods->id ?? 0;