69 lines
1.6 KiB
PHP
Executable File
69 lines
1.6 KiB
PHP
Executable File
<?php
|
|
|
|
namespace app\model;
|
|
|
|
class SpuActivity extends Base
|
|
{
|
|
public const TYPE_NORMAL = 'normal';//普通商品
|
|
public const TYPE_SCORE = 'score';//积分商品
|
|
public const TYPE_GROUP_BUY = 'group_buy';// 团购
|
|
public const TYPE_GROUP_MAKE = 'group_make';// 拼团
|
|
public const TYPE_LIMIT_TIME = 'limit_time';// 限时促销
|
|
|
|
public const SPU_TYPE_ENTITY = 'entity';// 商品类型-实体
|
|
public const SPU_TYPE_VIRTUAL = 'virtual';// 商品类型-虚拟
|
|
|
|
public static function statusTextList(): array
|
|
{
|
|
return [
|
|
(string) self::COMMON_ON => '已上架',
|
|
(string) self::COMMON_OFF => '已下架',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 活动类型
|
|
*
|
|
* @return string[]
|
|
*/
|
|
public static function activityList(): array
|
|
{
|
|
return [
|
|
self::TYPE_GROUP_BUY,
|
|
self::TYPE_GROUP_MAKE,
|
|
self::TYPE_LIMIT_TIME,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 活动列表
|
|
*
|
|
* @return array
|
|
*/
|
|
public static function activity(): array
|
|
{
|
|
$list = [];
|
|
foreach (self::activityList() as $item) {
|
|
$arr = [];
|
|
$arr['name'] = $item;
|
|
$arr['title'] = self::activityTextList()[$item];
|
|
$list[] = $arr;
|
|
}
|
|
|
|
return $list;
|
|
}
|
|
|
|
/**
|
|
* 活动类型说明
|
|
*
|
|
* @return string[]
|
|
*/
|
|
public static function activityTextList(): array
|
|
{
|
|
return [
|
|
self::TYPE_GROUP_BUY => '团购活动',
|
|
self::TYPE_GROUP_MAKE => '拼团活动',
|
|
self::TYPE_LIMIT_TIME => '限时促销',
|
|
];
|
|
}
|
|
} |