Преглед изворни кода

Merge branch 'feature/new-backend-adaptation' of http://16.162.42.175:8014/guanli/ngds into feature/new-backend-adaptation

kevin_zhangl пре 2 година
родитељ
комит
4c233bcda7
2 измењених фајлова са 57 додато и 4 уклоњено
  1. 4 4
      backendApi/modules/v1/controllers/ShopController.php
  2. 53 0
      common/models/ShopGoods.php

+ 4 - 4
backendApi/modules/v1/controllers/ShopController.php

@@ -119,8 +119,8 @@ class ShopController extends BaseController {
         return static::notice([
             'sellType' => ShopGoods::SALE_TYPE,
             'goodsType' => ShopGoods::GOODS_TYPE,
-            'giftType' => ShopGoods::GIFT_TYPE,
-            'categoryType' => ShopGoods::CATEGORY_TYPE,
+            'giftType' => ShopGoods::getGiftType(),//ShopGoods::GIFT_TYPE,
+            'categoryType' => ShopGoods::getCategoryType(),//ShopGoods::CATEGORY_TYPE,
         ]);
     }
 
@@ -153,8 +153,8 @@ class ShopController extends BaseController {
                 'goodsInfo'=>$data,
                 'sellType' => ShopGoods::SALE_TYPE,
                 'goodsType' => ShopGoods::GOODS_TYPE,
-                'giftType' => ShopGoods::GIFT_TYPE,
-                'categoryType' => ShopGoods::CATEGORY_TYPE,
+                'giftType' => ShopGoods::getGiftType(),//ShopGoods::GIFT_TYPE,
+                'categoryType' => ShopGoods::getCategoryType(),//ShopGoods::CATEGORY_TYPE,
             ]
         );
     }

+ 53 - 0
common/models/ShopGoods.php

@@ -253,4 +253,57 @@ class ShopGoods extends \common\components\ActiveRecord
         ];
     }
 
+    // 获取商品类型
+    public static function getGiftType() {
+        return [
+            1 =>[
+                'name'=>\Yii::t('ctx', 'shopList1stPurchase'),//报单区
+            ],
+            2 =>[
+                'name'=>\Yii::t('ctx', 'shopListRepeatPurchase'),//复消区
+            ],
+            3 =>[
+                'name'=>\Yii::t('ctx', 'shopListEntryArea'),//工作室报单
+            ],
+            4 =>[
+                'name'=>\Yii::t('ctx', 'shopListResellingArea'),//工作室复消
+            ],
+        ];
+    }
+
+    // 获取分类类型
+    public static function getCategoryType() {
+        return [
+            [
+                'id' => 1,
+                'name' => \Yii::t('ctx', 'shopListStandardProducts'),//普通商品
+                'sell_type' => [
+                    self::SALE_TYPE[1],
+    //                self::SALE_TYPE[3],
+                    self::SALE_TYPE[7],
+                ]
+            ],
+    //        [
+    //            'id' => 4,
+    //            'name' => 'Travel bonus products',//旅游积分商品
+    //            'sell_type' => [
+    //                self::SALE_TYPE[4]
+    //            ]
+    //        ],
+            [
+                'id' => 5,
+                'name' => \Yii::t('ctx', 'shopListCarFundProducts'),
+                'sell_type' => [
+                    self::SALE_TYPE[5]
+                ]
+            ],
+            [
+                'id' => 6,
+                'name' => \Yii::t('ctx', 'shopListVillaFundProducts'),
+                'sell_type' => [
+                    self::SALE_TYPE[6]
+                ]
+            ],
+        ];
+    }
 }