初始版本
This commit is contained in:
184
server/app/common/enum/DefaultEnum.php
Executable file
184
server/app/common/enum/DefaultEnum.php
Executable file
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum;
|
||||
|
||||
|
||||
class DefaultEnum
|
||||
{
|
||||
//默认排序
|
||||
const SORT = 0;
|
||||
|
||||
//显示隐藏
|
||||
const HIDE = 0;//隐藏
|
||||
const SHOW = 1;//显示
|
||||
|
||||
//性别
|
||||
const UNKNOWN = 0;//未知
|
||||
const MAN = 1;//男
|
||||
const WOMAN = 2;//女
|
||||
|
||||
//属性
|
||||
const SYSTEM = 1;//系统默认
|
||||
const CUSTOM = 2;//自定义
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取显示状态
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/8 3:56 下午
|
||||
*/
|
||||
public static function getShowDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::HIDE => '隐藏',
|
||||
self::SHOW => '显示'
|
||||
];
|
||||
if ($value === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 启用状态
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/14 4:02 下午
|
||||
*/
|
||||
public static function getEnableDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::HIDE => '停用',
|
||||
self::SHOW => '启用'
|
||||
];
|
||||
if ($value === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 性别
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/10 11:40 上午
|
||||
*/
|
||||
public static function getSexDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::UNKNOWN => '未知',
|
||||
self::MAN => '男',
|
||||
self::WOMAN => '女'
|
||||
];
|
||||
if ($value === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 属性
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/14 4:41 下午
|
||||
*/
|
||||
public static function getAttrDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::SYSTEM => '系统默认',
|
||||
self::CUSTOM => '自定义'
|
||||
];
|
||||
if ($value === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 是否推荐
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/23 3:30 下午
|
||||
*/
|
||||
public static function getRecommendDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::HIDE => '不推荐',
|
||||
self::SHOW => '推荐'
|
||||
];
|
||||
if ($value === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 56个民族
|
||||
* @param $from
|
||||
* @return string|string[]
|
||||
* @author cjhao
|
||||
* @date 2024/8/15 16:46
|
||||
*/
|
||||
public static function getNationLists($from = true)
|
||||
{
|
||||
$data = [
|
||||
"汉族", "蒙古族", "回族", "藏族", "维吾尔族", "苗族", "彝族", "壮族",
|
||||
"布依族", "朝鲜族", "满族", "侗族", "瑶族", "白族", "土家族", "哈尼族",
|
||||
"哈萨克族", "傣族", "黎族", "僳僳族", "佤族", "畲族", "高山族", "拉祜族",
|
||||
"水族", "东乡族", "纳西族", "景颇族", "柯尔克孜族", "土族", "达斡尔族",
|
||||
"仫佬族", "羌族", "布朗族", "撒拉族", "毛南族", "仡佬族", "锡伯族", "阿昌族",
|
||||
"普米族", "塔吉克族", "怒族", "乌孜别克族", "俄罗斯族", "鄂温克族", "德昂族",
|
||||
"保安族", "裕固族", "京族", "塔塔尔族", "独龙族", "鄂伦春族", "赫哲族",
|
||||
"门巴族", "珞巴族", "基诺族"
|
||||
];
|
||||
if(true === $from){
|
||||
return $data;
|
||||
}
|
||||
return $data[$from] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取学历列表
|
||||
* @param $from
|
||||
* @return string|string[]
|
||||
* @author cjhao
|
||||
* @date 2024/8/15 16:52
|
||||
*/
|
||||
public static function getEducationLists($from = true)
|
||||
{
|
||||
$data = [
|
||||
"小学文化", "初中","高中","大专",
|
||||
"本科","硕士","博士"
|
||||
];
|
||||
if(true === $from){
|
||||
return $data;
|
||||
}
|
||||
return $data[$from] ?? '';
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user