Browse Source

fix:后台增加是否热门字段

super-yimizi 1 month ago
parent
commit
0ac300007e

+ 3 - 1
application/admin/controller/shop/Goods.php

@@ -12,7 +12,7 @@ use app\admin\model\shop\Spec;
 use app\admin\model\shop\GoodsSkuSpec;
 use app\admin\model\shop\GoodsSkuSpec;
 use app\common\Enum\GoodsEnum;
 use app\common\Enum\GoodsEnum;
 use app\common\Service\SkuSpec as SkuSpecService;
 use app\common\Service\SkuSpec as SkuSpecService;
-
+use app\common\Enum\StatusEnum;
 /**
 /**
  * 商品管理
  * 商品管理
  *
  *
@@ -53,6 +53,8 @@ class Goods extends Backend
         $this->view->assign("stockShowTypeList", GoodsEnum::getStockShowTypeMap());
         $this->view->assign("stockShowTypeList", GoodsEnum::getStockShowTypeMap());
         $this->view->assign("salesShowTypeList", GoodsEnum::getSalesShowTypeMap());
         $this->view->assign("salesShowTypeList", GoodsEnum::getSalesShowTypeMap());
 
 
+        $this->view->assign("yesNoList", StatusEnum::getYesNoMap());
+
     }
     }
 
 
     
     

+ 12 - 0
application/admin/view/shop/goods/add.html

@@ -537,6 +537,18 @@
                         </div>
                         </div>
                     </div>
                     </div>
 
 
+                    <div class="form-group">
+                        <label class="control-label col-xs-12 col-sm-2">是否热门:</label>
+                        <div class="col-xs-12 col-sm-8">
+                            <div class="radio">
+                                {foreach name="yesNoList" item="vo"}
+                                <label for="row[is_hot]-{$key|htmlentities}"><input id="row[is_hot]-{$key|htmlentities}"  name="row[is_hot]" type="radio" value="{$key|htmlentities}" {in name="key" value="1"}checked{/in} /> {$vo|htmlentities}</label>
+                                {/foreach}
+                               
+                            </div>
+                        </div>
+                    </div>
+
                 </div>
                 </div>
 
 
             </div>
             </div>

+ 11 - 0
application/admin/view/shop/goods/edit.html

@@ -491,6 +491,17 @@
                             <textarea id="c-description" class="form-control" cols="10" rows="5" name="row[description]">{$row.description|htmlentities}</textarea>
                             <textarea id="c-description" class="form-control" cols="10" rows="5" name="row[description]">{$row.description|htmlentities}</textarea>
                         </div>
                         </div>
                     </div>
                     </div>
+                    <div class="form-group">
+                        <label class="control-label col-xs-12 col-sm-2">是否热门:</label>
+                        <div class="col-xs-12 col-sm-8">
+                            <div class="radio">
+                                {foreach name="yesNoList" item="vo"}
+                                <label for="row[is_hot]-{$key|htmlentities}"><input id="row[is_hot]-{$key|htmlentities}"  name="row[is_hot]" type="radio" value="{$key|htmlentities}" {in name="key" value="$row.is_hot"}checked{/in} /> {$vo|htmlentities}</label>
+                                {/foreach}
+                               
+                            </div>
+                        </div>
+                    </div>
 
 
                 </div>
                 </div>
 
 

+ 1 - 1
application/api/validate/Goods.php

@@ -10,7 +10,7 @@ class Goods extends Validate
      * 验证规则
      * 验证规则
      */
      */
     protected $rule = [
     protected $rule = [
-        'orderby' => 'in:weigh,sales,price,views,comments',
+        'orderby' => 'in:weigh,sales,price,views,comments,created_at',
         'orderway' => 'in:asc,desc',
         'orderway' => 'in:asc,desc',
         'pageSize' => 'integer|between:1,100',
         'pageSize' => 'integer|between:1,100',
         'page' => 'integer|between:1,100',
         'page' => 'integer|between:1,100',

+ 10 - 0
application/common/Enum/StatusEnum.php

@@ -9,6 +9,16 @@ class StatusEnum
     const ENABLED = 1; // 开启
     const ENABLED = 1; // 开启
     const DISABLED = 0; // 关闭
     const DISABLED = 0; // 关闭
 
 
+    const YES = 1; // 是
+    const NO = 0; // 否
+    public static function getYesNoMap()
+    {
+        return [
+            self::YES => '是',
+            self::NO => '否',
+        ];
+    }
+
     /**
     /**
      * 获取状态描述
      * 获取状态描述
      * @param int $status
      * @param int $status