Files
anmo/server/app/common/enum/DefaultEnum.php
2025-08-19 14:16:51 +08:00

184 lines
5.1 KiB
PHP
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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] ?? '';
}
}