Browse Source

fix:请求参数

super-yimizi 2 months ago
parent
commit
a235a19f2f

+ 2 - 2
application/admin/view/lottery/activity/add.html

@@ -244,7 +244,7 @@
         </div>
         
         <!-- 活动状态 -->
-        <div class="form-group">
+        <!-- <div class="form-group">
             <label class="control-label col-xs-12 col-sm-2">活动状态:</label>
             <div class="col-xs-12 col-sm-8">
                 {foreach name="statusList" item="vo"}
@@ -254,7 +254,7 @@
                 {/foreach}
                 <span class="help-block">草稿状态不会对外展示,进行中状态用户可参与</span>
             </div>
-        </div>
+        </div> -->
     </div>
 
     <div class="section-content">

+ 2 - 2
application/api/controller/Article.php

@@ -19,7 +19,7 @@ class Article extends Base
     {
         $parentId = $this->request->param('parent_id', 0, 'intval');
         $page = $this->request->param('page', 1, 'intval');
-        $pageSize = $this->request->param('page_size', 10, 'intval');
+        $pageSize = $this->request->param('pageSize', 10, 'intval');
         
         // 如果存在parent_id,先查询父分类信息
         if ($parentId > 0) {
@@ -67,7 +67,7 @@ class Article extends Base
     {
         $categoryId = $this->request->param('category_id', 0, 'intval');
         $page = $this->request->param('page', 1, 'intval');
-        $pageSize = $this->request->param('page_size', 10, 'intval');
+        $pageSize = $this->request->param('pageSize', 10, 'intval');
         $list = ArticleModel::getArticleList($categoryId, $page, $pageSize);
         $list->each(function ($item) {
             // 处理图像的

+ 61 - 16
application/common/Enum/ActivityEnum.php

@@ -7,10 +7,14 @@ namespace app\common\Enum;
 class ActivityEnum
 {
     // ============ 活动基础状态 ============
-    const ACTIVITY_STATUS_DRAFT = 0;        // 草稿
-    const ACTIVITY_STATUS_ONGOING = 1;      // 进行中
-    const ACTIVITY_STATUS_ENDED = 2;        // 已结束
-    const ACTIVITY_STATUS_SUSPENDED = 3;    // 已暂停
+    const ACTIVITY_STATUS_NOT_STARTED = 1;  // 未开始
+    const ACTIVITY_STATUS_ONGOING = 2;      // 进行中
+    const ACTIVITY_STATUS_ENDED = 3;        // 已结束
+    const ACTIVITY_STATUS_CANCELLED = 4;    // 已取消
+    const ACTIVITY_STATUS_SUSPENDED = 5;    // 已暂停
+    const ACTIVITY_STATUS_CLOSED = 6;       // 已关闭
+    const ACTIVITY_STATUS_DELETED = 7;      // 已删除
+    const ACTIVITY_STATUS_EXPIRED = 8;      // 已过期
 
     // ============ 活动类型 ============
     const ACTIVITY_TYPE_CONSUMPTION_LOTTERY = 1; // 消费抽奖
@@ -70,17 +74,35 @@ class ActivityEnum
     const REDEEM_EXPIRE_FIXED = 2;          // 固定时长
 
     /**
-     * 获取活动状态映射
+     * 获取活动状态映射(页面显示用)
      */
     public static function getActivityStatusMap()
     {
         return [
-            self::ACTIVITY_STATUS_DRAFT => '草稿',
+            self::ACTIVITY_STATUS_NOT_STARTED => '未开始',
             self::ACTIVITY_STATUS_ONGOING => '进行中',
             self::ACTIVITY_STATUS_ENDED => '已结束',
+            self::ACTIVITY_STATUS_CANCELLED => '已取消',
             self::ACTIVITY_STATUS_SUSPENDED => '已暂停',
         ];
     }
+    
+    /**
+     * 获取全部活动状态映射(包含逻辑状态)
+     */
+    public static function getAllActivityStatusMap()
+    {
+        return [
+            self::ACTIVITY_STATUS_NOT_STARTED => '未开始',
+            self::ACTIVITY_STATUS_ONGOING => '进行中',
+            self::ACTIVITY_STATUS_ENDED => '已结束',
+            self::ACTIVITY_STATUS_CANCELLED => '已取消',
+            self::ACTIVITY_STATUS_SUSPENDED => '已暂停',
+            self::ACTIVITY_STATUS_CLOSED => '已关闭',
+            self::ACTIVITY_STATUS_DELETED => '已删除',
+            self::ACTIVITY_STATUS_EXPIRED => '已过期',
+        ];
+    }
 
     /**
      * 获取活动类型映射
@@ -149,15 +171,18 @@ class ActivityEnum
      */
     public static function getPrizeDefaultImageMap()
     {
+        // 从配置文件获取图片路径
+        $config = config('site');
+        
         return [
-            self::PRIZE_TYPE_NO_PRIZE => '/assets/img/lottery/no_prize.png',
-            self::PRIZE_TYPE_GOODS => '/assets/img/lottery/goods.png',
-            self::PRIZE_TYPE_POINTS => '/assets/img/lottery/points.png',
-            self::PRIZE_TYPE_BALANCE => '/assets/img/lottery/balance.png',
-            self::PRIZE_TYPE_COUPON => '/assets/img/lottery/coupon.png',
-            self::PRIZE_TYPE_REDPACK => '/assets/img/lottery/redpack.png',
-            self::PRIZE_TYPE_CODE => '/assets/img/lottery/code.png',
-            self::PRIZE_TYPE_SHOP_GOODS => '/assets/img/lottery/shop_goods.png',
+            self::PRIZE_TYPE_NO_PRIZE => $config['prize_losing_lottery'] ?? '/assets/img/avatar.png',
+            self::PRIZE_TYPE_GOODS => $config['prize_goods'] ?? '/assets/img/package.png',
+            self::PRIZE_TYPE_POINTS => $config['prize_credit'] ?? '/assets/img/circle.png',
+            self::PRIZE_TYPE_BALANCE => $config['prize_balance'] ?? '/assets/img/circle.png',
+            self::PRIZE_TYPE_COUPON => $config['prize_coupon'] ?? '/assets/img/circle.png',
+            self::PRIZE_TYPE_REDPACK => $config['prize_redbag'] ?? '/assets/img/circle.png',
+            self::PRIZE_TYPE_CODE => $config['prize_code'] ?? '/assets/img/circle.png',
+            self::PRIZE_TYPE_SHOP_GOODS => $config['prize_shop_goods'] ?? '/assets/img/package.png',
         ];
     }
 
@@ -238,7 +263,7 @@ class ActivityEnum
      */
     public static function getActivityStatusText($status)
     {
-        $map = self::getActivityStatusMap();
+        $map = self::getAllActivityStatusMap();
         return $map[$status] ?? '未知';
     }
 
@@ -270,14 +295,34 @@ class ActivityEnum
     }
 
     /**
-     * 验证活动状态是否有效
+     * 验证活动状态是否有效(包含所有状态)
      */
     public static function isValidActivityStatus($status)
     {
+        return array_key_exists($status, self::getAllActivityStatusMap());
+    }
+
+    /**
+     * 判断是否为可在页面显示的状态
+     */
+    public static function isDisplayableStatus($status)
+    {
         return array_key_exists($status, self::getActivityStatusMap());
     }
 
     /**
+     * 判断是否为逻辑状态(不在页面显示)
+     */
+    public static function isLogicalStatus($status)
+    {
+        return in_array($status, [
+            self::ACTIVITY_STATUS_CLOSED,
+            self::ACTIVITY_STATUS_DELETED,
+            self::ACTIVITY_STATUS_EXPIRED
+        ]);
+    }
+
+    /**
      * 验证奖品类型是否有效
      */
     public static function isValidPrizeType($type)

+ 4 - 22
public/assets/js/backend/lottery/activity.js

@@ -198,9 +198,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
                     var len = $(this).val().length;
                     $('#activity-name-count').text(len + '/24');
                 });
-                
-                // 初始化商品选择
-                Controller.api.initGoodsSelector();
             },
             
             // 初始化任务规则管理
@@ -766,19 +763,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
             
             // 设置奖品默认图片
             setPrizeDefaultImage: function(form, type) {
-                // 使用辅助函数解析默认图片配置
-                var defaultImages = Controller.api.parseConfigJson('prizeDefaultImages', {
-                    1: '/assets/img/lottery/no_prize.png',     // 未中奖
-                    2: '/assets/img/lottery/goods.png',        // 实物奖品
-                    3: '/assets/img/lottery/credit.png',       // 积分
-                    4: '/assets/img/lottery/balance.png',      // 余额
-                    5: '/assets/img/lottery/coupon.png',       // 优惠券
-                    6: '/assets/img/lottery/redbag.png',       // 红包
-                    7: '/assets/img/lottery/code.png',         // 兑换码
-                    8: '/assets/img/lottery/shop_goods.png'    // 商城奖品
-                });
+                // 从后台配置获取默认图片
+                var defaultImages = Controller.api.parseConfigJson('prizeDefaultImages', {});
+                var defaultImage = defaultImages[type] || '/assets/img/default.png';
                 
-                var defaultImage = defaultImages[type] || '/assets/img/lottery/default.png';
                 form.find('input[name="prize_image"]').val(defaultImage).trigger('change');
             },
             
@@ -1594,13 +1582,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
                     conditionData: conditionData,
                     taskTypes: taskTypes
                 };
-            },
-            
-            // 初始化商品选择器
-            initGoodsSelector: function() {
-                // 商品选择器初始化逻辑
-            },
-            
+            },            
             // 选择商品 - 通用方法,支持单选和多选
             selectGoods: function(options) {
                 var defaults = {