'未开始', 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 => '已过期', ]; } /** * 获取活动类型映射 */ public static function getActivityTypeMap() { return [ self::ACTIVITY_TYPE_CONSUMPTION_LOTTERY => '消费抽奖', ]; } /** * 获取开奖方式映射 */ public static function getLotteryTypeMap() { return [ self::LOTTERY_TYPE_INSTANT => '即抽即中', self::LOTTERY_TYPE_TIME => '按时间开奖', self::LOTTERY_TYPE_PEOPLE => '按人数开奖', ]; } /** * 获取用户群体类型映射 */ public static function getUserLimitTypeMap() { return [ self::USER_LIMIT_ALL => '全部会员', self::USER_LIMIT_LEVEL => '会员等级', self::USER_LIMIT_TAG => '会员标签', ]; } /** * 获取引导样式映射 */ public static function getGuideStyleMap() { return [ self::GUIDE_STYLE_DEFAULT => '默认样式', self::GUIDE_STYLE_CUSTOM => '自定义', ]; } /** * 获取奖品类型映射 */ public static function getPrizeTypeMap() { return [ self::PRIZE_TYPE_NO_PRIZE => '未中奖', self::PRIZE_TYPE_GOODS => '实物奖品', self::PRIZE_TYPE_POINTS => '积分', self::PRIZE_TYPE_BALANCE => '余额', self::PRIZE_TYPE_COUPON => '优惠券', self::PRIZE_TYPE_REDPACK => '红包', self::PRIZE_TYPE_CODE => '兑换码', self::PRIZE_TYPE_SHOP_GOODS => '商城奖品', ]; } /** * 获取奖品默认图片映射 */ public static function getPrizeDefaultImageMap() { // 从配置文件获取图片路径 $config = config('site'); return [ 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', ]; } /** * 获取奖品发放方式映射 */ public static function getDeliverTypeMap() { return [ self::DELIVER_TYPE_AUTO => '自动发放', self::DELIVER_TYPE_MANUAL => '手动发放', ]; } /** * 获取奖品发放状态映射 */ public static function getDeliverStatusMap() { return [ self::DELIVER_STATUS_PENDING => '待发放', self::DELIVER_STATUS_SUCCESS => '已发放', self::DELIVER_STATUS_FAILED => '发放失败', self::DELIVER_STATUS_CANCELLED => '已取消', ]; } /** * 获取参与条件类型映射 */ public static function getConditionTypeMap() { return [ self::CONDITION_TYPE_BUY_GOODS => '购买指定商品', self::CONDITION_TYPE_ORDER_AMOUNT => '单笔订单消费满N元', self::CONDITION_TYPE_RECHARGE_AMOUNT => '单次充值金额满N元', self::CONDITION_TYPE_TOTAL_AMOUNT => '活动期间累计消费N元', ]; } /** * 获取商品规则映射 */ public static function getGoodsRuleMap() { return [ self::GOODS_RULE_INCLUDE => '指定商品参与', self::GOODS_RULE_EXCLUDE => '指定商品不可参与', ]; } /** * 获取触发类型映射 */ public static function getTriggerTypeMap() { return [ self::TRIGGER_TYPE_BUY_GOODS => '购买商品', self::TRIGGER_TYPE_ORDER_CONSUME => '订单消费', self::TRIGGER_TYPE_RECHARGE => '充值', self::TRIGGER_TYPE_TOTAL_CONSUME => '累计消费', ]; } /** * 获取兑奖期限类型映射 */ public static function getRedeemExpireTypeMap() { return [ self::REDEEM_EXPIRE_FOREVER => '永久有效', self::REDEEM_EXPIRE_FIXED => '固定时长', ]; } /** * 获取活动状态文本 */ public static function getActivityStatusText($status) { $map = self::getAllActivityStatusMap(); return $map[$status] ?? '未知'; } /** * 获取奖品类型文本 */ public static function getPrizeTypeText($type) { $map = self::getPrizeTypeMap(); return $map[$type] ?? '未知'; } /** * 获取开奖方式文本 */ public static function getLotteryTypeText($type) { $map = self::getLotteryTypeMap(); return $map[$type] ?? '未知'; } /** * 获取条件类型文本 */ public static function getConditionTypeText($type) { $map = self::getConditionTypeMap(); return $map[$type] ?? '未知'; } /** * 验证活动状态是否有效(包含所有状态) */ 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) { return array_key_exists($type, self::getPrizeTypeMap()); } /** * 验证开奖方式是否有效 */ public static function isValidLotteryType($type) { return array_key_exists($type, self::getLotteryTypeMap()); } /** * 验证条件类型是否有效 */ public static function isValidConditionType($type) { return array_key_exists($type, self::getConditionTypeMap()); } }