first commit

This commit is contained in:
Your Name
2026-01-19 14:19:22 +08:00
commit fe2d9c1868
4777 changed files with 665503 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\enum;
/**
* 管理后台登录终端
* Class terminalEnum
* @package app\common\enum
*/
class AdminTerminalEnum
{
const PC = 1;
const MOBILE = 2;
}

View File

@@ -0,0 +1,37 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\enum;
/**
* 定时任务枚举
* Class CrontabEnum
* @package app\common\enum
*/
class CrontabEnum
{
/**
* 类型
* CRONTAB 定时任务
*/
const CRONTAB = 1;
const DAEMON = 2;
/**
* 定时任务状态
*/
const START = 1;
const STOP = 2;
const ERROR = 3;
}

View File

@@ -0,0 +1,134 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\enum;
class DefaultEnum
{
//默认排序
const SORT = 50;
//显示隐藏
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];
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace app\common\enum;
class ExportEnum
{
//获取导出信息
const INFO = 1;
//导出excel
const EXPORT = 2;
}

View File

@@ -0,0 +1,30 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\enum;
class FileEnum
{
// 图片类型
const IMAGE_TYPE = 10; // 图片类型
const VIDEO_TYPE = 20; // 视频类型
const FILE_TYPE = 30; // 文件类型
// 图片来源
const SOURCE_ADMIN = 0; // 后台
const SOURCE_USER = 1; // 用户
}

View File

@@ -0,0 +1,63 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\enum;
class GeneratorEnum
{
// 模板类型
const TEMPLATE_TYPE_SINGLE = 0;// 单表
const TEMPLATE_TYPE_TREE = 1; // 树表
// 生成方式
const GENERATE_TYPE_ZIP = 0; // 压缩包下载
const GENERATE_TYPE_MODULE = 1; // 生成到模块
// 删除方式
const DELETE_TRUE = 0; // 真实删除
const DELETE_SOFT = 1; // 软删除
// 删除字段名 (默认名称)
const DELETE_NAME = 'delete_time';
// 菜单创建类型
const GEN_SELF = 0; // 手动添加
const GEN_AUTO = 1; // 自动添加
// 关联模型类型relations
const RELATION_HAS_ONE = 'has_one';
const RELATION_HAS_MANY = 'has_many';
/**
* @notes 获取模板类型描述
* @param bool $value
* @return string|string[]
* @author 段誉
* @date 2022/6/14 11:24
*/
public static function getTemplateTypeDesc($value = true)
{
$data = [
self::TEMPLATE_TYPE_SINGLE => '单表(增删改查)',
self::TEMPLATE_TYPE_TREE => '树表(增删改查)',
];
if ($value === true) {
return $data;
}
return $data[$value] ?? '';
}
}

View File

@@ -0,0 +1,32 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\enum;
/**
* 登录枚举
* Class LoginEnum
* @package app\common\enum
*/
class LoginEnum
{
/**
* 支持的登录方式
* ACCOUNT_PASSWORD 账号/手机号密码登录
* MOBILE_CAPTCHA 手机验证码登录
* THIRD_LOGIN 第三方登录
*/
const ACCOUNT_PASSWORD = 1;
const MOBILE_CAPTCHA = 2;
const THIRD_LOGIN = 3;
}

View File

@@ -0,0 +1,60 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\enum;
class MenuEnum
{
//商城页面
const SHOP_PAGE = [
[
'index' => 1,
'name' => '首页',
'path' => '/pages/index/index',
'params' => [],
'type' => 'shop',
],
];
//菜单类型
const NAVIGATION_HOME = 1;//首页导航
const NAVIGATION_PERSONAL = 2;//个人中心
//链接类型
const LINK_SHOP = 1;//商城页面
const LINK_CATEGORY = 2;//分类页面
const LINK_CUSTOM = 3;//自定义链接
/**
* @notes 链接类型
* @param bool $value
* @return string|string[]
* @author ljj
* @date 2022/2/14 12:14 下午
*/
public static function getLinkDesc($value = true)
{
$data = [
self::LINK_SHOP => '商城页面',
self::LINK_CATEGORY => '分类页面',
self::LINK_CUSTOM => '自定义链接'
];
if ($value === true) {
return $data;
}
return $data[$value];
}
}

View File

@@ -0,0 +1,94 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\enum;
/**
* 微信公众号枚举
* Class OfficialAccountEnum
* @package app\common\enum
*/
class OfficialAccountEnum
{
/**
* 菜单类型
* click - 关键字
* view - 跳转网页链接
* miniprogram - 小程序
*/
const MENU_TYPE = ['click', 'view', 'miniprogram'];
/**
* 关注回复
*/
const REPLY_TYPE_FOLLOW = 1;
/**
* 关键字回复
*/
const REPLY_TYPE_KEYWORD = 2;
/**
* 默认回复
*/
const REPLY_TYPE_DEFAULT= 3;
/**
* 回复类型
* follow - 关注回复
* keyword - 关键字回复
* default - 默认回复
*/
const REPLY_TYPE = [
self::REPLY_TYPE_FOLLOW => 'follow',
self::REPLY_TYPE_KEYWORD => 'keyword',
self::REPLY_TYPE_DEFAULT => 'default'
];
/**
* 匹配类型 - 全匹配
*/
const MATCHING_TYPE_FULL = 1;
/**
* 匹配类型 - 模糊匹配
*/
const MATCHING_TYPE_FUZZY = 2;
/**
* 消息类型 - 事件
*/
const MSG_TYPE_EVENT = 'event';
/**
* 消息类型 - 文本
*/
const MSG_TYPE_TEXT = 'text';
/**
* 事件类型 - 关注
*/
const EVENT_SUBSCRIBE = 'subscribe';
/**
* @notes 获取类型英文名称
* @param $type
* @return string
* @author Tab
* @date 2021/7/29 16:32
*/
public static function getReplyType($type)
{
return self::REPLY_TYPE[$type] ?? '';
}
}

View File

@@ -0,0 +1,46 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\enum;
/**
* 通过枚举类,枚举只有两个值的时候使用
* Class YesNoEnum
* @package app\common\enum
*/
class YesNoEnum
{
const YES = 1;
const NO = 0;
/**
* @notes 获取禁用状态
* @param bool $value
* @return string|string[]
* @author 令狐冲
* @date 2021/7/8 19:02
*/
public static function getDisableDesc($value = true)
{
$data = [
self::YES => '禁用',
self::NO => '正常'
];
if ($value === true) {
return $data;
}
return $data[$value];
}
}

View File

@@ -0,0 +1,272 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\enum\notice;
/**
* 通知枚举
* Class NoticeEnum
* @package app\common\enum
*/
class NoticeEnum
{
/**
* 通知类型
*/
const SYSTEM = 1;
const SMS = 2;
const OA = 3;
const MNP = 4;
/**
* 短信验证码场景
*/
const LOGIN_CAPTCHA = 101;
const BIND_MOBILE_CAPTCHA = 102;
const CHANGE_MOBILE_CAPTCHA = 103;
const FIND_LOGIN_PASSWORD_CAPTCHA = 104;
/**
* 验证码场景
*/
const SMS_SCENE = [
self::LOGIN_CAPTCHA,
self::BIND_MOBILE_CAPTCHA,
self::CHANGE_MOBILE_CAPTCHA,
self::FIND_LOGIN_PASSWORD_CAPTCHA,
];
//通知类型
const BUSINESS_NOTIFICATION = 1;//业务通知
const VERIFICATION_CODE = 2;//验证码
/**
* @notes 通知类型
* @param bool $value
* @return string|string[]
* @author ljj
* @date 2022/2/17 2:49 下午
*/
public static function getTypeDesc($value = true)
{
$data = [
self::BUSINESS_NOTIFICATION => '业务通知',
self::VERIFICATION_CODE => '验证码'
];
if ($value === true) {
return $data;
}
return $data[$value];
}
/**
* @notes 获取场景描述
* @param $sceneId
* @param false $flag
* @return string|string[]
* @author 段誉
* @date 2022/3/29 11:33
*/
public static function getSceneDesc($sceneId, $flag = false)
{
$desc = [
self::LOGIN_CAPTCHA => '登录验证码',
self::BIND_MOBILE_CAPTCHA => '绑定手机验证码',
self::CHANGE_MOBILE_CAPTCHA => '变更手机验证码',
self::FIND_LOGIN_PASSWORD_CAPTCHA => '找回登录密码验证码',
];
if ($flag) {
return $desc;
}
return $desc[$sceneId] ?? '';
}
/**
* @notes 更具标记获取场景
* @param $tag
* @return int|string
* @author 段誉
* @date 2022/9/15 15:08
*/
public static function getSceneByTag($tag)
{
$scene = [
// 手机验证码登录
'YZMDL' => self::LOGIN_CAPTCHA,
// 绑定手机号验证码
'BDSJHM' => self::BIND_MOBILE_CAPTCHA,
// 变更手机号验证码
'BGSJHM' => self::CHANGE_MOBILE_CAPTCHA,
// 找回登录密码
'ZHDLMM' => self::FIND_LOGIN_PASSWORD_CAPTCHA,
];
return $scene[$tag] ?? '';
}
/**
* @notes 获取场景变量
* @param $sceneId
* @param false $flag
* @return array|string[]
* @author 段誉
* @date 2022/3/29 11:33
*/
public static function getVars($sceneId, $flag = false)
{
$desc = [
self::LOGIN_CAPTCHA => '验证码:code',
self::BIND_MOBILE_CAPTCHA => '验证码:code',
self::CHANGE_MOBILE_CAPTCHA => '验证码:code',
self::FIND_LOGIN_PASSWORD_CAPTCHA => '验证码:code',
];
if ($flag) {
return $desc;
}
return isset($desc[$sceneId]) ? ['可选变量 ' . $desc[$sceneId]] : [];
}
/**
* @notes 获取系统通知示例
* @param $sceneId
* @param false $flag
* @return array|string[]
* @author 段誉
* @date 2022/3/29 11:33
*/
public static function getSystemExample($sceneId, $flag = false)
{
$desc = [];
if ($flag) {
return $desc;
}
return isset($desc[$sceneId]) ? [$desc[$sceneId]] : [];
}
/**
* @notes 获取短信通知示例
* @param $sceneId
* @param false $flag
* @return array|string[]
* @author 段誉
* @date 2022/3/29 11:33
*/
public static function getSmsExample($sceneId, $flag = false)
{
$desc = [
self::LOGIN_CAPTCHA => '您正在登录,验证码${code}切勿将验证码泄露于他人本条验证码有效期5分钟。',
self::BIND_MOBILE_CAPTCHA => '您正在绑定手机号,验证码${code}切勿将验证码泄露于他人本条验证码有效期5分钟。',
self::CHANGE_MOBILE_CAPTCHA => '您正在变更手机号,验证码${code}切勿将验证码泄露于他人本条验证码有效期5分钟。',
self::FIND_LOGIN_PASSWORD_CAPTCHA => '您正在找回登录密码,验证码${code}切勿将验证码泄露于他人本条验证码有效期5分钟。',
];
if ($flag) {
return $desc;
}
return isset($desc[$sceneId]) ? ['示例:' . $desc[$sceneId]] : [];
}
/**
* @notes 获取公众号模板消息示例
* @param $sceneId
* @param false $flag
* @return array|string[]|\string[][]
* @author 段誉
* @date 2022/3/29 11:33
*/
public static function getOaExample($sceneId, $flag = false)
{
$desc = [];
if ($flag) {
return $desc;
}
return $desc[$sceneId] ?? [];
}
/**
* @notes 获取小程序订阅消息示例
* @param $sceneId
* @param false $flag
* @return array|mixed
* @author 段誉
* @date 2022/3/29 11:33
*/
public static function getMnpExample($sceneId, $flag = false)
{
$desc = [];
if ($flag) {
return $desc;
}
return $desc[$sceneId] ?? [];
}
/**
* @notes 提示
* @param $type
* @param $sceneId
* @return array|string|string[]|\string[][]
* @author 段誉
* @date 2022/3/29 11:33
*/
public static function getOperationTips($type, $sceneId)
{
// 场景变量
$vars = self::getVars($sceneId);
// 其他提示
$other = [];
// 示例
switch ($type) {
case self::SYSTEM:
$example = self::getSystemExample($sceneId);
break;
case self::SMS:
$other[] = '生效条件1、管理后台完成短信设置。 2、第三方短信平台申请模板 3、若是腾讯云模板变量名须换成变量名出现顺序对应的数字(例:您好{nickname},您的订单{order_sn}已发货! 须改为 您好{1},您的订单{2}已发货!)';
$example = self::getSmsExample($sceneId);
break;
case self::OA:
$other[] = '配置路径:公众号后台 > 广告与服务 > 模板消息';
$other[] = '推荐行业主营行业IT科技/互联网|电子商务 副营行业:消费品/消费品';
$example = self::getOaExample($sceneId);
break;
case self::MNP:
$other[] = '配置路径:小程序后台 > 功能 > 订阅消息';
$example = self::getMnpExample($sceneId);
break;
}
$tips = array_merge($vars, $example, $other);
return $tips;
}
}

View File

@@ -0,0 +1,55 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\enum\notice;
/**
* 短信枚举
* Class SmsEnum
* @package app\common\enum
*/
class SmsEnum
{
/**
* 发送状态
*/
const SEND_ING = 0;
const SEND_SUCCESS = 1;
const SEND_FAIL = 2;
/**
* 短信平台
*/
const ALI = 1;
const TENCENT = 2;
const SMSBAO = 3;
/**
* @notes 获取短信平台名称
* @param $value
* @return string
* @author 段誉
* @date 2022/8/5 11:10
*/
public static function getNameDesc($value)
{
$desc = [
'ALI' => '阿里云短信',
'TENCENT' => '腾讯云短信',
'SMSBAO' => '短信宝短信',
];
return $desc[$value] ?? '';
}
}

View File

@@ -0,0 +1,55 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\enum\user;
/**
* 管理后台登录终端
* Class terminalEnum
* @package app\common\enum
*/
class UserEnum
{
/**
* 性别
* SEX_OTHER = 未知
* SEX_MEN = 男
* SEX_WOMAN = 女
*/
const SEX_OTHER = 0;
const SEX_MEN = 1;
const SEX_WOMAN = 2;
/**
* @notes 性别描述
* @param bool $from
* @return string|string[]
* @author 段誉
* @date 2022/9/7 15:05
*/
public static function getSexDesc($from = true)
{
$desc = [
self::SEX_OTHER => '未知',
self::SEX_MEN => '男',
self::SEX_WOMAN => '女',
];
if (true === $from) {
return $desc;
}
return $desc[$from] ?? '';
}
}

View File

@@ -0,0 +1,64 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\enum\user;
/**
* 管理后台登录终端
* Class terminalEnum
* @package app\common\enum
*/
class UserTerminalEnum
{
//const OTHER = 0; //其他来源
const WECHAT_MMP = 1; //微信小程序
const WECHAT_OA = 2; //微信公众号
const H5 = 3;//手机H5登录
const PC = 4;//电脑PC
const IOS = 5;//苹果app
const ANDROID = 6;//安卓app
const ALL_TERMINAL = [
self::WECHAT_MMP,
self::WECHAT_OA,
self::H5,
self::PC,
self::IOS,
self::ANDROID,
];
/**
* @notes 获取终端
* @param bool $from
* @return array|mixed|string
* @author cjhao
* @date 2021/7/30 18:09
*/
public static function getTermInalDesc($from = true)
{
$desc = [
self::WECHAT_MMP => '微信小程序',
self::WECHAT_OA => '微信公众号',
self::H5 => '手机H5',
self::PC => '电脑PC',
self::IOS => '苹果APP',
self::ANDROID => '安卓APP',
];
if(true === $from){
return $desc;
}
return $desc[$from] ?? '';
}
}