first commit
This commit is contained in:
117
app/adminapi/validate/FileValidate.php
Normal file
117
app/adminapi/validate/FileValidate.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?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\adminapi\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 文件验证
|
||||
* Class FileValidate
|
||||
* @package app\adminapi\validate
|
||||
*/
|
||||
class FileValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require|number',
|
||||
'cid' => 'require|number',
|
||||
'ids' => 'require|array',
|
||||
'type' => 'require|in:10,20,30',
|
||||
'pid' => 'require|number',
|
||||
'name' => 'require|max:20'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '缺少id参数',
|
||||
'cid.require' => '缺少cid参数',
|
||||
'ids.require' => '缺少ids参数',
|
||||
'type.require' => '缺少type参数',
|
||||
'pid.require' => '缺少pid参数',
|
||||
'name.require' => '请填写分组名称',
|
||||
'name.max' => '分组名称长度须为20字符内',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes id验证场景
|
||||
* @return FileValidate
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 14:32
|
||||
*/
|
||||
public function sceneId()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 重命名文件场景
|
||||
* @return FileValidate
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 14:32
|
||||
*/
|
||||
public function sceneRename()
|
||||
{
|
||||
return $this->only(['id', 'name']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 新增分类场景
|
||||
* @return FileValidate
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 14:33
|
||||
*/
|
||||
public function sceneAddCate()
|
||||
{
|
||||
return $this->only(['type', 'pid', 'name']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑分类场景
|
||||
* @return FileValidate
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 14:33
|
||||
*/
|
||||
public function sceneEditCate()
|
||||
{
|
||||
return $this->only(['id', 'name']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 移动场景
|
||||
* @return FileValidate
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 14:33
|
||||
*/
|
||||
public function sceneMove()
|
||||
{
|
||||
return $this->only(['ids', 'cid']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return FileValidate
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 14:35
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['ids']);
|
||||
}
|
||||
}
|
||||
142
app/adminapi/validate/LoginAgentValidate.php
Normal file
142
app/adminapi/validate/LoginAgentValidate.php
Normal file
@@ -0,0 +1,142 @@
|
||||
<?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\adminapi\validate;
|
||||
|
||||
|
||||
use app\common\enum\AdminTerminalEnum;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\user\{User,UserInfo};
|
||||
use app\common\cache\AdminAccountSafeCache;
|
||||
use app\common\service\{ConfigService,UtilsService};
|
||||
use app\common\enum\YesNoEnum;
|
||||
use app\common\validate\BaseValidate;
|
||||
use think\facade\Config;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
* Class LoginAgentValidate
|
||||
* @package app\adminapi\validate
|
||||
*/
|
||||
class LoginAgentValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'terminal' => 'require|in:' . AdminTerminalEnum::PC . ',' . AdminTerminalEnum::MOBILE,
|
||||
'account' => 'require',
|
||||
'password' => 'require|password',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'account.require' => '请输入账号',
|
||||
'password.require' => '请输入密码'
|
||||
];
|
||||
|
||||
/**
|
||||
* @notes @notes 密码验证
|
||||
* @param $password
|
||||
* @param $other
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/2 14:00
|
||||
*/
|
||||
public function password($password, $other, $data)
|
||||
{
|
||||
// 登录限制
|
||||
$config = [
|
||||
'login_restrictions' => ConfigService::get('admin_login', 'login_restrictions'),
|
||||
'password_error_times' => ConfigService::get('admin_login', 'password_error_times'),
|
||||
'limit_login_time' => ConfigService::get('admin_login', 'limit_login_time'),
|
||||
'google_auth' => ConfigService::get('website', 'agent_google_auth'),
|
||||
];
|
||||
|
||||
$adminAccountSafeCache = new AdminAccountSafeCache();
|
||||
if ($config['login_restrictions'] == 1) {
|
||||
$adminAccountSafeCache->count = $config['password_error_times'];
|
||||
$adminAccountSafeCache->minute = $config['limit_login_time'];
|
||||
}
|
||||
|
||||
//后台账号安全机制,连续输错后锁定,防止账号密码暴力破解
|
||||
if ($config['login_restrictions'] == 1 && !$adminAccountSafeCache->isSafe()) {
|
||||
return '密码连续' . $adminAccountSafeCache->count . '次输入错误,请' . $adminAccountSafeCache->minute . '分钟后重试';
|
||||
}
|
||||
|
||||
$where = [];
|
||||
|
||||
$login_way = $data['login_way'];//0邮箱1手机号
|
||||
if($login_way == 1){
|
||||
$where = ['country_code' => $data['country_code']];
|
||||
}
|
||||
|
||||
|
||||
$userInfo = User::where($where)
|
||||
->where(['account|mobile' => $data['account'],'is_agent' => 1])
|
||||
->field(['id,password,is_disable,is_open,agent_id'])
|
||||
->findOrEmpty();
|
||||
|
||||
if ($userInfo->isEmpty()) {
|
||||
return '用户不存在';//用户不存在
|
||||
}
|
||||
|
||||
if ($userInfo['is_open'] === YesNoEnum::NO) {
|
||||
return '用户未启用';//用户未启用
|
||||
}
|
||||
|
||||
if ($userInfo['is_disable'] === YesNoEnum::YES) {
|
||||
return '用户已禁用';//用户已禁用
|
||||
}
|
||||
|
||||
$user_info = UserInfo::where(['user_id' => $userInfo['id']])->findOrEmpty();
|
||||
|
||||
if($config['google_auth'] == 1){
|
||||
if(!$user_info->isEmpty() && $user_info['google_key']){
|
||||
if(!$data['code']){
|
||||
$adminAccountSafeCache->record();
|
||||
return '请输入谷歌验证码';
|
||||
}
|
||||
|
||||
$valid = UtilsService::get_google_verify($user_info['google_key'],$data['code']);
|
||||
if(!$valid) {
|
||||
$adminAccountSafeCache->record();
|
||||
return '验证码错误';
|
||||
}
|
||||
}else{
|
||||
$adminAccountSafeCache->record();
|
||||
return '验证码错误';
|
||||
}
|
||||
}
|
||||
|
||||
$passwordSalt = Config::get('project.unique_identification');
|
||||
if ($userInfo['password'] !== create_password($password, $passwordSalt)) {
|
||||
$adminAccountSafeCache->record();
|
||||
return '密码错误';//密码错误
|
||||
}
|
||||
|
||||
$adminInfo = Admin::where('id', '=', $userInfo['agent_id'])
|
||||
->where(['is_agent' => 1])
|
||||
->findOrEmpty();
|
||||
|
||||
if ($adminInfo->isEmpty()) {
|
||||
return '参数异常';//参数异常
|
||||
}
|
||||
|
||||
$adminAccountSafeCache->relieve();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
120
app/adminapi/validate/LoginValidate.php
Normal file
120
app/adminapi/validate/LoginValidate.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<?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\adminapi\validate;
|
||||
|
||||
|
||||
use app\common\enum\AdminTerminalEnum;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\cache\AdminAccountSafeCache;
|
||||
use app\common\service\{ConfigService,UtilsService};
|
||||
use app\common\validate\BaseValidate;
|
||||
use think\facade\Config;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
* Class LoginValidate
|
||||
* @package app\adminapi\validate
|
||||
*/
|
||||
class LoginValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'terminal' => 'require|in:' . AdminTerminalEnum::PC . ',' . AdminTerminalEnum::MOBILE,
|
||||
'account' => 'require',
|
||||
'password' => 'require|password',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'account.require' => '请输入账号',
|
||||
'password.require' => '请输入密码'
|
||||
];
|
||||
|
||||
/**
|
||||
* @notes @notes 密码验证
|
||||
* @param $password
|
||||
* @param $other
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/2 14:00
|
||||
*/
|
||||
public function password($password, $other, $data)
|
||||
{
|
||||
// 登录限制
|
||||
$config = [
|
||||
'login_restrictions' => ConfigService::get('admin_login', 'login_restrictions'),
|
||||
'password_error_times' => ConfigService::get('admin_login', 'password_error_times'),
|
||||
'limit_login_time' => ConfigService::get('admin_login', 'limit_login_time'),
|
||||
'google_auth' => ConfigService::get('website', 'google_auth'),
|
||||
];
|
||||
|
||||
$adminAccountSafeCache = new AdminAccountSafeCache();
|
||||
if ($config['login_restrictions'] == 1) {
|
||||
$adminAccountSafeCache->count = $config['password_error_times'];
|
||||
$adminAccountSafeCache->minute = $config['limit_login_time'];
|
||||
}
|
||||
|
||||
//后台账号安全机制,连续输错后锁定,防止账号密码暴力破解
|
||||
if ($config['login_restrictions'] == 1 && !$adminAccountSafeCache->isSafe()) {
|
||||
return '密码连续' . $adminAccountSafeCache->count . '次输入错误,请' . $adminAccountSafeCache->minute . '分钟后重试';
|
||||
}
|
||||
|
||||
$adminInfo = Admin::where('account', '=', $data['account'])
|
||||
->where(['is_agent' => 0])
|
||||
->field(['password,disable,google_key'])
|
||||
->findOrEmpty();
|
||||
|
||||
if ($adminInfo->isEmpty()) {
|
||||
return '账号不存在';
|
||||
}
|
||||
|
||||
if ($adminInfo['disable'] === 1) {
|
||||
return '账号已禁用';
|
||||
}
|
||||
|
||||
if (empty($adminInfo['password'])) {
|
||||
$adminAccountSafeCache->record();
|
||||
return '账号不存在';
|
||||
}
|
||||
|
||||
if($config['google_auth'] == 1){
|
||||
if($adminInfo['google_key']){
|
||||
if(!$data['code']){
|
||||
$adminAccountSafeCache->record();
|
||||
return '请输入谷歌验证码';
|
||||
}
|
||||
$valid = UtilsService::get_google_verify($adminInfo['google_key'],$data['code']);
|
||||
if(!$valid) {
|
||||
$adminAccountSafeCache->record();
|
||||
return '验证码错误';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$passwordSalt = Config::get('project.unique_identification');
|
||||
|
||||
if ($adminInfo['password'] !== create_password($password, $passwordSalt)) {
|
||||
$adminAccountSafeCache->record();
|
||||
return '密码错误';
|
||||
}
|
||||
|
||||
$adminAccountSafeCache->relieve();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
136
app/adminapi/validate/article/ArticleCateValidate.php
Normal file
136
app/adminapi/validate/article/ArticleCateValidate.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?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\adminapi\validate\article;
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
use app\common\model\article\ArticleCate;
|
||||
use app\common\model\article\Article;
|
||||
|
||||
/**
|
||||
* 资讯分类管理验证
|
||||
* Class ArticleCateValidate
|
||||
* @package app\adminapi\validate\article
|
||||
*/
|
||||
class ArticleCateValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require|checkArticleCate',
|
||||
'name' => 'require|length:1,90',
|
||||
'is_show' => 'require|in:0,1',
|
||||
'sort' => 'egt:0',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '资讯分类id不能为空',
|
||||
'name.require' => '资讯分类不能为空',
|
||||
'name.length' => '资讯分类长度须在1-90位字符',
|
||||
'sort.egt' => '排序值不正确',
|
||||
];
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ArticleCateValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/10 15:11
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove(['id'])
|
||||
->remove('id', 'require|checkArticleCate');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ArticleCateValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 17:55
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 更改状态场景
|
||||
* @return ArticleCateValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 18:02
|
||||
*/
|
||||
public function sceneStatus()
|
||||
{
|
||||
return $this->only(['id', 'is_show']);
|
||||
}
|
||||
|
||||
public function sceneEdit()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取所有资讯分类场景
|
||||
* @return ArticleCateValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/15 10:05
|
||||
*/
|
||||
public function sceneSelect()
|
||||
{
|
||||
return $this->only(['type']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ArticleCateValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 17:52
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id'])
|
||||
->append('id', 'checkDeleteArticleCate');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 检查指定资讯分类是否存在
|
||||
* @param $value
|
||||
* @return bool|string
|
||||
* @author heshihu
|
||||
* @date 2022/2/10 15:10
|
||||
*/
|
||||
public function checkArticleCate($value)
|
||||
{
|
||||
$article_category = ArticleCate::findOrEmpty($value);
|
||||
if ($article_category->isEmpty()) {
|
||||
return '资讯分类不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除时验证该资讯分类是否已使用
|
||||
* @param $value
|
||||
* @return bool|string
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 14:45
|
||||
*/
|
||||
public function checkDeleteArticleCate($value)
|
||||
{
|
||||
$article = Article::where('cid', $value)->findOrEmpty();
|
||||
if (!$article->isEmpty()) {
|
||||
return '资讯分类已使用,请先删除绑定该资讯分类的资讯';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
108
app/adminapi/validate/article/ArticleValidate.php
Normal file
108
app/adminapi/validate/article/ArticleValidate.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?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\adminapi\validate\article;
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
use app\common\model\article\Article;
|
||||
|
||||
/**
|
||||
* 资讯管理验证
|
||||
* Class ArticleValidate
|
||||
* @package app\adminapi\validate\article
|
||||
*/
|
||||
class ArticleValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require|checkArticle',
|
||||
'title' => 'require|length:1,255',
|
||||
// 'image' => 'require',
|
||||
'cid' => 'require',
|
||||
'is_show' => 'require|in:0,1',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '资讯id不能为空',
|
||||
'title.require' => '标题不能为空',
|
||||
'title.length' => '标题长度须在1-255位字符',
|
||||
// 'image.require' => '封面图必须存在',
|
||||
'cid.require' => '所属栏目必须存在',
|
||||
];
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ArticleValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 9:57
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove(['id'])
|
||||
->remove('id','require|checkArticle');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ArticleValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 10:15
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 更改状态场景
|
||||
* @return ArticleValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 10:18
|
||||
*/
|
||||
public function sceneStatus()
|
||||
{
|
||||
return $this->only(['id', 'is_show']);
|
||||
}
|
||||
|
||||
public function sceneEdit()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ArticleValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 10:17
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 检查指定资讯是否存在
|
||||
* @param $value
|
||||
* @return bool|string
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 10:11
|
||||
*/
|
||||
public function checkArticle($value)
|
||||
{
|
||||
$article = Article::findOrEmpty($value);
|
||||
if ($article->isEmpty()) {
|
||||
return '资讯不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
168
app/adminapi/validate/auth/AdminValidate.php
Normal file
168
app/adminapi/validate/auth/AdminValidate.php
Normal file
@@ -0,0 +1,168 @@
|
||||
<?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\adminapi\validate\auth;
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
use app\common\model\auth\Admin;
|
||||
|
||||
/**
|
||||
* 管理员验证
|
||||
* Class AdminValidate
|
||||
* @package app\adminapi\validate\auth
|
||||
*/
|
||||
class AdminValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require|checkAdmin',
|
||||
'account' => 'require|length:1,32|unique:'.Admin::class,
|
||||
'name' => 'require|length:1,16|unique:'.Admin::class,
|
||||
'password' => 'require|length:6,32|edit',
|
||||
'password_confirm' => 'requireWith:password|confirm',
|
||||
'role_id' => 'require',
|
||||
'disable' => 'require|in:0,1|checkAbleDisable',
|
||||
'multipoint_login' => 'require|in:0,1',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '管理员id不能为空',
|
||||
'account.require' => '账号不能为空',
|
||||
'account.length' => '账号长度须在1-32位字符',
|
||||
'account.unique' => '账号已存在',
|
||||
'password.require' => '密码不能为空',
|
||||
'password.length' => '密码长度须在6-32位字符',
|
||||
'password_confirm.requireWith' => '确认密码不能为空',
|
||||
'password_confirm.confirm' => '两次输入的密码不一致',
|
||||
'name.require' => '名称不能为空',
|
||||
'name.length' => '名称须在1-16位字符',
|
||||
'name.unique' => '名称已存在',
|
||||
'role_id.require' => '请选择角色',
|
||||
'disable.require' => '请选择状态',
|
||||
'disable.in' => '状态值错误',
|
||||
'multipoint_login.require' => '请选择是否支持多处登录',
|
||||
'multipoint_login.in' => '多处登录状态值为误',
|
||||
];
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return AdminValidate
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 15:46
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove(['password', 'edit'])
|
||||
->remove('id', 'require|checkAdmin')
|
||||
->remove('disable', 'checkAbleDisable');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return AdminValidate
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 15:46
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return AdminValidate
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 15:47
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->remove('password', 'require|length')
|
||||
->append('id', 'require|checkAdmin');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return AdminValidate
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 15:47
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑情况下,检查是否填密码
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 10:19
|
||||
*/
|
||||
public function edit($value, $rule, $data)
|
||||
{
|
||||
if (empty($data['password']) && empty($data['password_confirm'])) {
|
||||
return true;
|
||||
}
|
||||
$len = strlen($value);
|
||||
if ($len < 6 || $len > 32) {
|
||||
return '密码长度须在6-32位字符';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 检查指定管理员是否存在
|
||||
* @param $value
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 10:19
|
||||
*/
|
||||
public function checkAdmin($value)
|
||||
{
|
||||
$admin = Admin::findOrEmpty($value);
|
||||
if ($admin->isEmpty()) {
|
||||
return '管理员不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 禁用校验
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/8/11 9:59
|
||||
*/
|
||||
public function checkAbleDisable($value, $rule, $data)
|
||||
{
|
||||
$admin = Admin::findOrEmpty($data['id']);
|
||||
if ($admin->isEmpty()) {
|
||||
return '管理员不存在';
|
||||
}
|
||||
|
||||
if ($value && $admin['root']) {
|
||||
return '超级管理员不允许被禁用';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
206
app/adminapi/validate/auth/MenuValidate.php
Normal file
206
app/adminapi/validate/auth/MenuValidate.php
Normal file
@@ -0,0 +1,206 @@
|
||||
<?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\adminapi\validate\auth;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
use app\common\model\auth\{SystemRole,SystemMenu};
|
||||
|
||||
|
||||
/**
|
||||
* 系统菜单
|
||||
* Class SystemMenuValidate
|
||||
* @package app\adminapi\validate\auth
|
||||
*/
|
||||
class MenuValidate extends BaseValidate
|
||||
{
|
||||
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'pid' => 'require|checkPid',
|
||||
'type' => 'require|in:M,C,A',
|
||||
'name' => 'require|length:1,30|checkUniqueName',
|
||||
'icon' => 'max:100',
|
||||
'sort' => 'require|egt:0',
|
||||
'perms' => 'max:100',
|
||||
'paths' => 'max:200',
|
||||
'component' => 'max:200',
|
||||
'selected' => 'max:200',
|
||||
'params' => 'max:200',
|
||||
'is_cache' => 'require|in:0,1',
|
||||
'is_show' => 'require|in:0,1',
|
||||
'is_disable' => 'require|in:0,1',
|
||||
];
|
||||
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '参数缺失',
|
||||
'pid.require' => '请选择上级菜单',
|
||||
'type.require' => '请选择菜单类型',
|
||||
'type.in' => '菜单类型参数值错误',
|
||||
'name.require' => '请填写菜单名称',
|
||||
'name.length' => '菜单名称长度需为1~30个字符',
|
||||
'icon.max' => '图标名称不能超过100个字符',
|
||||
'sort.require' => '请填写排序',
|
||||
'sort.egt' => '排序值需大于或等于0',
|
||||
'perms.max' => '权限字符不能超过100个字符',
|
||||
'paths.max' => '路由地址不能超过200个字符',
|
||||
'component.max' => '组件路径不能超过200个字符',
|
||||
'selected.max' => '选中菜单路径不能超过200个字符',
|
||||
'params.max' => '路由参数不能超过200个字符',
|
||||
'is_cache.require' => '请选择缓存状态',
|
||||
'is_cache.in' => '缓存状态参数值错误',
|
||||
'is_show.require' => '请选择显示状态',
|
||||
'is_show.in' => '显示状态参数值错误',
|
||||
'is_disable.require' => '请选择菜单状态',
|
||||
'is_disable.in' => '菜单状态参数值错误',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return MenuValidate
|
||||
* @author 段誉
|
||||
* @date 2022/6/29 18:26
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return MenuValidate
|
||||
* @author 段誉
|
||||
* @date 2022/6/29 18:27
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return MenuValidate
|
||||
* @author 段誉
|
||||
* @date 2022/6/29 18:27
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id'])
|
||||
->append('id', 'checkAbleDelete');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 更新状态场景
|
||||
* @return MenuValidate
|
||||
* @author 段誉
|
||||
* @date 2022/7/6 17:04
|
||||
*/
|
||||
public function sceneStatus()
|
||||
{
|
||||
return $this->only(['id', 'is_disable']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 更新排序场景
|
||||
* @return MenuValidate
|
||||
* @author 段誉
|
||||
* @date 2022/7/6 17:04
|
||||
*/
|
||||
public function sceneSort()
|
||||
{
|
||||
return $this->only(['id', 'sort']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 校验菜单名称是否已存在
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/6/29 18:24
|
||||
*/
|
||||
protected function checkUniqueName($value, $rule, $data)
|
||||
{
|
||||
if ($data['type'] != 'M') {
|
||||
return true;
|
||||
}
|
||||
$where[] = ['type', '=', $data['type']];
|
||||
$where[] = ['name', '=', $data['name']];
|
||||
|
||||
if (!empty($data['id'])) {
|
||||
$where[] = ['id', '<>', $data['id']];
|
||||
}
|
||||
|
||||
$check = SystemMenu::where($where)->findOrEmpty();
|
||||
|
||||
if (!$check->isEmpty()) {
|
||||
return '菜单名称已存在';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 是否有子级菜单
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/6/30 9:40
|
||||
*/
|
||||
protected function checkAbleDelete($value, $rule, $data)
|
||||
{
|
||||
$hasChild = SystemMenu::where(['pid' => $value])->findOrEmpty();
|
||||
if (!$hasChild->isEmpty()) {
|
||||
return '存在子菜单,不允许删除';
|
||||
}
|
||||
|
||||
// 已绑定角色菜单不可以删除
|
||||
$isBindRole = SystemRole::hasWhere('roleMenuIndex', ['menu_id' => $value])->findOrEmpty();
|
||||
if (!$isBindRole->isEmpty()) {
|
||||
return '已分配菜单不可删除';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 校验上级
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/6/30 9:51
|
||||
*/
|
||||
protected function checkPid($value, $rule, $data)
|
||||
{
|
||||
if (!empty($data['id']) && $data['id'] == $value) {
|
||||
return '上级菜单不能选择自己';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
119
app/adminapi/validate/auth/RoleValidate.php
Normal file
119
app/adminapi/validate/auth/RoleValidate.php
Normal file
@@ -0,0 +1,119 @@
|
||||
<?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\adminapi\validate\auth;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
use app\common\model\auth\{AdminRole, SystemRole, Admin};
|
||||
|
||||
/**
|
||||
* 角色验证器
|
||||
* Class RoleValidate
|
||||
* @package app\adminapi\validate\auth
|
||||
*/
|
||||
class RoleValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require|checkRole',
|
||||
'name' => 'require|max:64|unique:' . SystemRole::class . ',name',
|
||||
'menu_id' => 'array',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '请选择角色',
|
||||
'name.require' => '请输入角色名称',
|
||||
'name.max' => '角色名称最长为16个字符',
|
||||
'name.unique' => '角色名称已存在',
|
||||
'menu_id.array' => '权限格式错误'
|
||||
];
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return RoleValidate
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 15:47
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['name', 'menu_id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return RoleValidate
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 15:47
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return RoleValidate
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 15:48
|
||||
*/
|
||||
public function sceneDel()
|
||||
{
|
||||
return $this->only(['id'])
|
||||
->append('id', 'checkAdmin');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 验证角色是否存在
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 15:48
|
||||
*/
|
||||
public function checkRole($value, $rule, $data)
|
||||
{
|
||||
if (!SystemRole::find($value)) {
|
||||
return '角色不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @notes 验证角色是否被使用
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 15:49
|
||||
*/
|
||||
public function checkAdmin($value, $rule, $data)
|
||||
{
|
||||
if (AdminRole::where(['role_id' => $value])->find()) {
|
||||
return '有管理员在使用该角色,不允许删除';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
74
app/adminapi/validate/auth/editSelfValidate.php
Normal file
74
app/adminapi/validate/auth/editSelfValidate.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?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\adminapi\validate\auth;
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
use app\common\model\auth\Admin;
|
||||
use think\facade\Config;
|
||||
|
||||
/**
|
||||
* 编辑超级管理员验证
|
||||
* Class editSelfValidate
|
||||
* @package app\adminapi\validate\auth
|
||||
*/
|
||||
class editSelfValidate extends BaseValidate
|
||||
{
|
||||
|
||||
protected $rule = [
|
||||
'name' => 'require|length:1,16',
|
||||
'avatar' => 'require',
|
||||
'password_old' => 'length:6,32',
|
||||
'password' => 'length:6,32|checkPassword',
|
||||
'password_confirm' => 'requireWith:password|confirm',
|
||||
];
|
||||
|
||||
|
||||
protected $message = [
|
||||
'name.require' => '请填写名称',
|
||||
'name.length' => '名称须在1-16位字符',
|
||||
'avatar.require' => '请选择头像',
|
||||
'password_now.length' => '密码长度须在6-32位字符',
|
||||
'password_confirm.requireWith' => '确认密码不能为空',
|
||||
'password_confirm.confirm' => '两次输入的密码不一致',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 校验密码
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/4/8 17:40
|
||||
*/
|
||||
public function checkPassword($value, $rule, $data)
|
||||
{
|
||||
if (empty($data['password_old'])) {
|
||||
return '请填写当前密码';
|
||||
}
|
||||
|
||||
$admin = Admin::findOrEmpty($data['admin_id']);
|
||||
$passwordSalt = Config::get('project.unique_identification');
|
||||
$oldPassword = create_password($data['password_old'], $passwordSalt);
|
||||
|
||||
if ($admin['password'] != $oldPassword) {
|
||||
return '当前密码错误';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
138
app/adminapi/validate/crontab/CrontabValidate.php
Normal file
138
app/adminapi/validate/crontab/CrontabValidate.php
Normal file
@@ -0,0 +1,138 @@
|
||||
<?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\adminapi\validate\crontab;
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
use Cron\CronExpression;
|
||||
|
||||
/**
|
||||
* 定时任务验证器
|
||||
* Class CrontabValidate
|
||||
* @package app\adminapi\validate\crontab
|
||||
*/
|
||||
class CrontabValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'name' => 'require',
|
||||
'type' => 'require|in:1',
|
||||
'command' => 'require',
|
||||
'status' => 'require|in:1,2,3',
|
||||
'expression' => 'require|checkExpression',
|
||||
'id' => 'require',
|
||||
'operate' => 'require'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'name.require' => '请输入定时任务名称',
|
||||
'type.require' => '请选择类型',
|
||||
'type.in' => '类型值错误',
|
||||
'command.require' => '请输入命令',
|
||||
'status.require' => '请选择状态',
|
||||
'status.in' => '状态值错误',
|
||||
'expression.require' => '请输入运行规则',
|
||||
'id.require' => '参数缺失',
|
||||
'operate.require' => '请选择操作',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加定时任务场景
|
||||
* @return CrontabValidate
|
||||
* @author 段誉
|
||||
* @date 2022/3/29 14:39
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', 'require')->remove('operate', 'require');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 查看定时任务详情场景
|
||||
* @return CrontabValidate
|
||||
* @author 段誉
|
||||
* @date 2022/3/29 14:39
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑定时任务
|
||||
* @return CrontabValidate
|
||||
* @author 段誉
|
||||
* @date 2022/3/29 14:39
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->remove('operate', 'require');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除定时任务场景
|
||||
* @return CrontabValidate
|
||||
* @author 段誉
|
||||
* @date 2022/3/29 14:40
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes CrontabValidate
|
||||
* @return CrontabValidate
|
||||
* @author 段誉
|
||||
* @date 2022/3/29 14:40
|
||||
*/
|
||||
public function sceneOperate()
|
||||
{
|
||||
return $this->only(['id', 'operate']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取规则执行时间场景
|
||||
* @return CrontabValidate
|
||||
* @author 段誉
|
||||
* @date 2022/3/29 14:40
|
||||
*/
|
||||
public function sceneExpression()
|
||||
{
|
||||
return $this->only(['expression']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 校验运行规则
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/3/29 14:40
|
||||
*/
|
||||
public function checkExpression($value, $rule, $data)
|
||||
{
|
||||
if (CronExpression::isValidExpression($value) === false) {
|
||||
return '定时任务运行规则错误';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
96
app/adminapi/validate/decorate/DecorateHintValidate.php
Normal file
96
app/adminapi/validate/decorate/DecorateHintValidate.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?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\adminapi\validate\decorate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 提示内容验证器
|
||||
* Class DecorateHintValidate
|
||||
* @package app\adminapi\validate\decorate
|
||||
*/
|
||||
class DecorateHintValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'title' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'title' => '标题',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return DecorateHintValidate
|
||||
* @author BD
|
||||
* @date 2024/03/17 17:01
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['title']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return DecorateHintValidate
|
||||
* @author BD
|
||||
* @date 2024/03/17 17:01
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','title']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return DecorateHintValidate
|
||||
* @author BD
|
||||
* @date 2024/03/17 17:01
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return DecorateHintValidate
|
||||
* @author BD
|
||||
* @date 2024/03/17 17:01
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
104
app/adminapi/validate/decorate/DecorateNavValidate.php
Normal file
104
app/adminapi/validate/decorate/DecorateNavValidate.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?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\adminapi\validate\decorate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 菜单按钮验证器
|
||||
* Class DecorateNavValidate
|
||||
* @package app\adminapi\validate\decorate
|
||||
*/
|
||||
class DecorateNavValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'name' => 'require',
|
||||
'link' => 'require',
|
||||
'loca' => 'require',
|
||||
'is_show' => 'require',
|
||||
'sort' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'name' => '菜单名称',
|
||||
'link' => '菜单链接',
|
||||
'loca' => '菜单位置',
|
||||
'is_show' => '显示状态',
|
||||
'sort' => '排序',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return DecorateNavValidate
|
||||
* @author BD
|
||||
* @date 2024/03/17 16:41
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['name','link','loca','is_show','sort']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return DecorateNavValidate
|
||||
* @author BD
|
||||
* @date 2024/03/17 16:41
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','name','link','loca','is_show','sort']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return DecorateNavValidate
|
||||
* @author BD
|
||||
* @date 2024/03/17 16:41
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return DecorateNavValidate
|
||||
* @author BD
|
||||
* @date 2024/03/17 16:41
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
98
app/adminapi/validate/decorate/DecorateSwiperValidate.php
Normal file
98
app/adminapi/validate/decorate/DecorateSwiperValidate.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?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\adminapi\validate\decorate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 轮播图验证器
|
||||
* Class DecorateSwiperValidate
|
||||
* @package app\adminapi\validate\decorate
|
||||
*/
|
||||
class DecorateSwiperValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'loca' => 'require',
|
||||
'is_show' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'loca' => '位置',
|
||||
'is_show' => '显示状态',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return DecorateSwiperValidate
|
||||
* @author BD
|
||||
* @date 2024/03/16 17:34
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['loca','is_show']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return DecorateSwiperValidate
|
||||
* @author BD
|
||||
* @date 2024/03/16 17:34
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','loca','is_show']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return DecorateSwiperValidate
|
||||
* @author BD
|
||||
* @date 2024/03/16 17:34
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return DecorateSwiperValidate
|
||||
* @author BD
|
||||
* @date 2024/03/16 17:34
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
179
app/adminapi/validate/dept/DeptValidate.php
Normal file
179
app/adminapi/validate/dept/DeptValidate.php
Normal file
@@ -0,0 +1,179 @@
|
||||
<?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\adminapi\validate\dept;
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\auth\AdminDept;
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 部门验证器
|
||||
* Class DeptValidate
|
||||
* @package app\adminapi\validate\dept
|
||||
*/
|
||||
class DeptValidate extends BaseValidate
|
||||
{
|
||||
|
||||
protected $rule = [
|
||||
'id' => 'require|checkDept',
|
||||
'pid' => 'require|integer',
|
||||
'name' => 'require|unique:'.Dept::class.'|length:1,30',
|
||||
'status' => 'require|in:0,1',
|
||||
'sort' => 'egt:0',
|
||||
];
|
||||
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '参数缺失',
|
||||
'name.require' => '请填写部门名称',
|
||||
'name.length' => '部门名称长度须在1-30位字符',
|
||||
'name.unique' => '部门名称已存在',
|
||||
'sort.egt' => '排序值不正确',
|
||||
'pid.require' => '请选择上级部门',
|
||||
'pid.integer' => '上级部门参数错误',
|
||||
'status.require' => '请选择部门状态',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return DeptValidate
|
||||
* @author 段誉
|
||||
* @date 2022/5/25 18:16
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true)->append('pid', 'checkDept');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return DeptValidate
|
||||
* @author 段誉
|
||||
* @date 2022/5/25 18:16
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return DeptValidate
|
||||
* @author 段誉
|
||||
* @date 2022/5/26 18:42
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->append('pid', 'checkPid');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return DeptValidate
|
||||
* @author 段誉
|
||||
* @date 2022/5/25 18:16
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id'])->append('id', 'checkAbleDetele');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 校验部门
|
||||
* @param $value
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/5/25 18:17
|
||||
*/
|
||||
public function checkDept($value)
|
||||
{
|
||||
$dept = Dept::findOrEmpty($value);
|
||||
if ($dept->isEmpty()) {
|
||||
return '部门不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 校验能否删除
|
||||
* @param $value
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/5/26 14:22
|
||||
*/
|
||||
public function checkAbleDetele($value)
|
||||
{
|
||||
$hasLower = Dept::where(['pid' => $value])->findOrEmpty();
|
||||
if (!$hasLower->isEmpty()) {
|
||||
return '已关联下级部门,暂不可删除';
|
||||
}
|
||||
|
||||
$check = AdminDept::where(['dept_id' => $value])->findOrEmpty();
|
||||
if (!$check->isEmpty()) {
|
||||
return '已关联管理员,暂不可删除';
|
||||
}
|
||||
|
||||
$dept = Dept::findOrEmpty($value);
|
||||
if ($dept['pid'] == 0) {
|
||||
return '顶级部门不可删除';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 校验部门
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param array $data
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/5/26 18:41
|
||||
*/
|
||||
public function checkPid($value, $rule, $data = [])
|
||||
{
|
||||
// 当前编辑的部门id信息是否存在
|
||||
$dept = Dept::findOrEmpty($data['id']);
|
||||
if ($dept->isEmpty()) {
|
||||
return '当前部门信息缺失';
|
||||
}
|
||||
|
||||
// 顶级部门不校验上级部门id
|
||||
if ($dept['pid'] == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($data['id'] == $value) {
|
||||
return '上级部门不可是当前部门';
|
||||
}
|
||||
|
||||
$leaderDept = Dept::findOrEmpty($value);
|
||||
if ($leaderDept->isEmpty()) {
|
||||
return '部门不存在';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
127
app/adminapi/validate/dept/JobsValidate.php
Normal file
127
app/adminapi/validate/dept/JobsValidate.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?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\adminapi\validate\dept;
|
||||
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\auth\AdminJobs;
|
||||
use app\common\model\dept\Jobs;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 岗位验证
|
||||
* Class JobsValidate
|
||||
* @package app\adminapi\validate\dept
|
||||
*/
|
||||
class JobsValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require|checkJobs',
|
||||
'name' => 'require|unique:'.Jobs::class.'|length:1,50',
|
||||
'code' => 'require|unique:'.Jobs::class,
|
||||
'status' => 'require|in:0,1',
|
||||
'sort' => 'egt:0',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '参数缺失',
|
||||
'name.require' => '请填写岗位名称',
|
||||
'name.length' => '岗位名称长度须在1-50位字符',
|
||||
'name.unique' => '岗位名称已存在',
|
||||
'code.require' => '请填写岗位编码',
|
||||
'code.unique' => '岗位编码已存在',
|
||||
'sort.egt' => '排序值不正确',
|
||||
'status.require' => '请选择岗位状态',
|
||||
'status.in' => '岗位状态值错误',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return JobsValidate
|
||||
* @author 段誉
|
||||
* @date 2022/5/26 9:53
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return JobsValidate
|
||||
* @author 段誉
|
||||
* @date 2022/5/26 9:53
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
public function sceneEdit()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return JobsValidate
|
||||
* @author 段誉
|
||||
* @date 2022/5/26 9:54
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id'])->append('id', 'checkAbleDetele');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 校验岗位
|
||||
* @param $value
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/5/26 9:55
|
||||
*/
|
||||
public function checkJobs($value)
|
||||
{
|
||||
$jobs = Jobs::findOrEmpty($value);
|
||||
if ($jobs->isEmpty()) {
|
||||
return '岗位不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 校验能否删除
|
||||
* @param $value
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/5/26 14:22
|
||||
*/
|
||||
public function checkAbleDetele($value)
|
||||
{
|
||||
$check = AdminJobs::where(['jobs_id' => $value])->findOrEmpty();
|
||||
if (!$check->isEmpty()) {
|
||||
return '已关联管理员,暂不可删除';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
119
app/adminapi/validate/dict/DictDataValidate.php
Normal file
119
app/adminapi/validate/dict/DictDataValidate.php
Normal file
@@ -0,0 +1,119 @@
|
||||
<?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\adminapi\validate\dict;
|
||||
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\dict\DictType;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 字典数据验证
|
||||
* Class DictDataValidate
|
||||
* @package app\adminapi\validate\dict
|
||||
*/
|
||||
class DictDataValidate extends BaseValidate
|
||||
{
|
||||
|
||||
protected $rule = [
|
||||
'id' => 'require|checkDictData',
|
||||
'name' => 'require|length:1,255',
|
||||
'value' => 'require',
|
||||
'type_id' => 'require|checkDictType',
|
||||
'status' => 'require|in:0,1',
|
||||
];
|
||||
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '参数缺失',
|
||||
'name.require' => '请填写字典数据名称',
|
||||
'name.length' => '字典数据名称长度须在1-255位字符',
|
||||
'value.require' => '请填写字典数据值',
|
||||
'type_id.require' => '字典类型缺失',
|
||||
'status.require' => '请选择字典数据状态',
|
||||
'status.in' => '字典数据状态参数错误',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return DictDataValidate
|
||||
* @author 段誉
|
||||
* @date 2022/6/20 16:54
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes ID场景
|
||||
* @return DictDataValidate
|
||||
* @author 段誉
|
||||
* @date 2022/6/20 16:54
|
||||
*/
|
||||
public function sceneId()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return DictDataValidate
|
||||
* @author 段誉
|
||||
* @date 2022/6/20 18:36
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->remove('type_id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 校验字典数据
|
||||
* @param $value
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/6/20 16:55
|
||||
*/
|
||||
protected function checkDictData($value)
|
||||
{
|
||||
$article = DictData::findOrEmpty($value);
|
||||
if ($article->isEmpty()) {
|
||||
return '字典数据不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 校验字典类型
|
||||
* @param $value
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/6/20 17:03
|
||||
*/
|
||||
protected function checkDictType($value)
|
||||
{
|
||||
$type = DictType::findOrEmpty($value);
|
||||
if ($type->isEmpty()) {
|
||||
return '字典类型不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
133
app/adminapi/validate/dict/DictTypeValidate.php
Normal file
133
app/adminapi/validate/dict/DictTypeValidate.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?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\adminapi\validate\dict;
|
||||
|
||||
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\dict\DictType;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 字典类型验证
|
||||
* Class DictTypeValidate
|
||||
* @package app\adminapi\validate\dict
|
||||
*/
|
||||
class DictTypeValidate extends BaseValidate
|
||||
{
|
||||
|
||||
protected $rule = [
|
||||
'id' => 'require|checkDictType',
|
||||
'name' => 'require|length:1,255',
|
||||
'type' => 'require|unique:' . DictType::class,
|
||||
'status' => 'require|in:0,1',
|
||||
'remark' => 'max:200',
|
||||
];
|
||||
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '参数缺失',
|
||||
'name.require' => '请填写字典名称',
|
||||
'name.length' => '字典名称长度须在1~255位字符',
|
||||
'type.require' => '请填写字典类型',
|
||||
'type.unique' => '字典类型已存在',
|
||||
'status.require' => '请选择状态',
|
||||
'remark.max' => '备注长度不能超过200',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return DictTypeValidate
|
||||
* @author 段誉
|
||||
* @date 2022/6/20 16:00
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return DictTypeValidate
|
||||
* @author 段誉
|
||||
* @date 2022/6/20 16:00
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
public function sceneEdit()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return DictTypeValidate
|
||||
* @author 段誉
|
||||
* @date 2022/6/20 16:03
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id'])
|
||||
->append('id', 'checkAbleDelete');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @notes 检查字典类型是否存在
|
||||
* @param $value
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/6/20 16:04
|
||||
*/
|
||||
protected function checkDictType($value)
|
||||
{
|
||||
$dictType = DictType::findOrEmpty($value);
|
||||
if ($dictType->isEmpty()) {
|
||||
return '字典类型不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @notes 验证是否可删除
|
||||
* @param $value
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/6/20 16:04
|
||||
*/
|
||||
protected function checkAbleDelete($value)
|
||||
{
|
||||
$dictData = DictData::whereIn('type_id', $value)->select();
|
||||
|
||||
foreach ($dictData as $item) {
|
||||
if (!empty($item)) {
|
||||
return '字典类型已被使用,请先删除绑定该字典类型的数据';
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
87
app/adminapi/validate/feedback/FeedbackCateValidate.php
Normal file
87
app/adminapi/validate/feedback/FeedbackCateValidate.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
namespace app\adminapi\validate\feedback;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 意见反馈类型验证器
|
||||
* Class FeedbackCateValidate
|
||||
* @package app\adminapi\validate\feedback
|
||||
*/
|
||||
class FeedbackCateValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'name' => 'require',
|
||||
'sort' => 'require',
|
||||
'is_show' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'name' => '分类名称',
|
||||
'sort' => '排序',
|
||||
'is_show' => '显示状态',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return FeedbackCateValidate
|
||||
* @author BD
|
||||
* @date 2024/06/06 00:12
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['name','sort','is_show']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return FeedbackCateValidate
|
||||
* @author BD
|
||||
* @date 2024/06/06 00:12
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','name','sort','is_show']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return FeedbackCateValidate
|
||||
* @author BD
|
||||
* @date 2024/06/06 00:12
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return FeedbackCateValidate
|
||||
* @author BD
|
||||
* @date 2024/06/06 00:12
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
87
app/adminapi/validate/feedback/FeedbackRecordValidate.php
Normal file
87
app/adminapi/validate/feedback/FeedbackRecordValidate.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
namespace app\adminapi\validate\feedback;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 意见反馈记录验证器
|
||||
* Class FeedbackRecordValidate
|
||||
* @package app\adminapi\validate\feedback
|
||||
*/
|
||||
class FeedbackRecordValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'user_id' => 'require',
|
||||
'cid' => 'require',
|
||||
'content' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'user_id' => '用户id',
|
||||
'cid' => '类型id',
|
||||
'content' => '反馈内容',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return FeedbackRecordValidate
|
||||
* @author BD
|
||||
* @date 2024/06/06 01:11
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['user_id','cid','content']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return FeedbackRecordValidate
|
||||
* @author BD
|
||||
* @date 2024/06/06 01:11
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','user_id','cid','content']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return FeedbackRecordValidate
|
||||
* @author BD
|
||||
* @date 2024/06/06 01:11
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return FeedbackRecordValidate
|
||||
* @author BD
|
||||
* @date 2024/06/06 01:11
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
81
app/adminapi/validate/finance/RechargeRecordValidate.php
Normal file
81
app/adminapi/validate/finance/RechargeRecordValidate.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?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\adminapi\validate\finance;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 充值记录验证器
|
||||
* Class RechargeRecordValidate
|
||||
* @package app\adminapi\validate\finance
|
||||
*/
|
||||
class RechargeRecordValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return RechargeRecordValidate
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 同意场景
|
||||
* @return RechargeRecordValidate
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function sceneAgree()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 拒绝场景
|
||||
* @return RechargeRecordValidate
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function sceneRefuse()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
68
app/adminapi/validate/finance/UserFinanceValidate.php
Normal file
68
app/adminapi/validate/finance/UserFinanceValidate.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?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\adminapi\validate\finance;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 资金明细验证器
|
||||
* Class UserFinanceValidate
|
||||
* @package app\adminapi\validate\finance
|
||||
*/
|
||||
class UserFinanceValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return UserFinanceValidate
|
||||
* @author BD
|
||||
* @date 2024/03/07 13:10
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 解冻场景
|
||||
* @return UserFinanceValidate
|
||||
* @author BD
|
||||
* @date 2024/03/07 13:10
|
||||
*/
|
||||
public function sceneUnfrozen()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
91
app/adminapi/validate/finance/WithdrawRecordValidate.php
Normal file
91
app/adminapi/validate/finance/WithdrawRecordValidate.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?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\adminapi\validate\finance;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 提现记录验证器
|
||||
* Class WithdrawRecordValidate
|
||||
* @package app\adminapi\validate\finance
|
||||
*/
|
||||
class WithdrawRecordValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return WithdrawRecordValidate
|
||||
* @author BD
|
||||
* @date 2024/02/25 12:35
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes udun代付场景
|
||||
* @return RechargeRecordValidate
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function sceneUdunPay()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 同意场景
|
||||
* @return RechargeRecordValidate
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function sceneAgree()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 拒绝场景
|
||||
* @return RechargeRecordValidate
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function sceneRefuse()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
96
app/adminapi/validate/goods/GoodsCateValidate.php
Normal file
96
app/adminapi/validate/goods/GoodsCateValidate.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?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\adminapi\validate\goods;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 商品分类验证器
|
||||
* Class GoodsCateValidate
|
||||
* @package app\adminapi\validate\goods
|
||||
*/
|
||||
class GoodsCateValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'name' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'name' => '分类名称',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return GoodsCateValidate
|
||||
* @author BD
|
||||
* @date 2024/03/11 01:58
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['name']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return GoodsCateValidate
|
||||
* @author BD
|
||||
* @date 2024/03/11 01:58
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','name']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return GoodsCateValidate
|
||||
* @author BD
|
||||
* @date 2024/03/11 01:58
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return GoodsCateValidate
|
||||
* @author BD
|
||||
* @date 2024/03/11 01:58
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
88
app/adminapi/validate/goods/GoodsRecordValidate.php
Normal file
88
app/adminapi/validate/goods/GoodsRecordValidate.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?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\adminapi\validate\goods;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 抢单记录验证器
|
||||
* Class GoodsRecordValidate
|
||||
* @package app\adminapi\validate\goods
|
||||
*/
|
||||
class GoodsRecordValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'goods_id' => 'require',
|
||||
'sn' => 'require',
|
||||
'user_id' => 'require',
|
||||
'goods_title' => 'require',
|
||||
'goods_image' => 'require',
|
||||
'money' => 'require',
|
||||
'commission' => 'require',
|
||||
'status' => 'require',
|
||||
'type' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'goods_id' => '商品',
|
||||
'sn' => '订单编号',
|
||||
'user_id' => '用户id',
|
||||
'goods_title' => '商品标题',
|
||||
'goods_image' => '商品图片',
|
||||
'money' => '订单金额',
|
||||
'commission' => '佣金',
|
||||
'status' => '订单状态',
|
||||
'type' => '订单类型',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return GoodsRecordValidate
|
||||
* @author BD
|
||||
* @date 2024/03/19 02:29
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 派单场景
|
||||
* @return GoodsRecordValidate
|
||||
* @author BD
|
||||
* @date 2024/03/19 02:29
|
||||
*/
|
||||
public function sceneDispatch()
|
||||
{
|
||||
return $this->only(['id','goods_id']);
|
||||
}
|
||||
|
||||
}
|
||||
106
app/adminapi/validate/goods/GoodsValidate.php
Normal file
106
app/adminapi/validate/goods/GoodsValidate.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?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\adminapi\validate\goods;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 商品验证器
|
||||
* Class GoodsValidate
|
||||
* @package app\adminapi\validate\goods
|
||||
*/
|
||||
class GoodsValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'cid' => 'require',
|
||||
'title' => 'require',
|
||||
'image' => 'require',
|
||||
'money' => 'require',
|
||||
'is_show' => 'require',
|
||||
'sort' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'cid' => '商品分类',
|
||||
'title' => '标题',
|
||||
'image' => '图片',
|
||||
'money' => '金额',
|
||||
'is_show' => '显示状态',
|
||||
'sort' => '排序',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return GoodsValidate
|
||||
* @author BD
|
||||
* @date 2024/03/11 01:58
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['cid','title','image','money','is_show','sort']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return GoodsValidate
|
||||
* @author BD
|
||||
* @date 2024/03/11 01:58
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','cid','title','image','money','is_show','sort']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return GoodsValidate
|
||||
* @author BD
|
||||
* @date 2024/03/11 01:58
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return GoodsValidate
|
||||
* @author BD
|
||||
* @date 2024/03/11 01:58
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
111
app/adminapi/validate/item/ItemCateValidate.php
Normal file
111
app/adminapi/validate/item/ItemCateValidate.php
Normal file
@@ -0,0 +1,111 @@
|
||||
<?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\adminapi\validate\item;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 项目分类验证器
|
||||
* Class ItemCateValidate
|
||||
* @package app\adminapi\validate\item
|
||||
*/
|
||||
class ItemCateValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'name' => 'require',
|
||||
'sort' => 'require',
|
||||
'is_show' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'name' => '分类名称',
|
||||
'sort' => '排序',
|
||||
'is_show' => '是否显示',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ItemCateValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 13:23
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['name','sort','is_show']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return ItemCateValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 13:23
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','name','sort','is_show']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ItemCateValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 13:23
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ItemCateValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 13:23
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 更改状态场景
|
||||
* @return ArticleCateValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 18:02
|
||||
*/
|
||||
public function sceneStatus()
|
||||
{
|
||||
return $this->only(['id', 'is_show']);
|
||||
}
|
||||
|
||||
}
|
||||
103
app/adminapi/validate/item/ItemRecordValidate.php
Normal file
103
app/adminapi/validate/item/ItemRecordValidate.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
namespace app\adminapi\validate\item;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 项目记录验证器
|
||||
* Class ItemRecordValidate
|
||||
* @package app\adminapi\validate\item
|
||||
*/
|
||||
class ItemRecordValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'sn' => 'require',
|
||||
'contract_no' => 'require',
|
||||
'user_id' => 'require',
|
||||
'item_id' => 'require',
|
||||
'money' => 'require',
|
||||
'rate' => 'require',
|
||||
'cycle' => 'require',
|
||||
'total_num' => 'require',
|
||||
'wait_num' => 'require',
|
||||
'type' => 'require',
|
||||
'status' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'sn' => '订单编号',
|
||||
'contract_no' => '合同编号',
|
||||
'user_id' => '用户id',
|
||||
'item_id' => '项目id',
|
||||
'money' => '订单金额',
|
||||
'rate' => '利率',
|
||||
'cycle' => '周期',
|
||||
'total_num' => '总期数',
|
||||
'wait_num' => '剩余期数',
|
||||
'type' => '投资类型',
|
||||
'status' => '状态',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ItemRecordValidate
|
||||
* @author BD
|
||||
* @date 2024/08/07 15:42
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['sn','contract_no','user_id','item_id','money','rate','cycle','total_num','wait_num','type','status']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return ItemRecordValidate
|
||||
* @author BD
|
||||
* @date 2024/08/07 15:42
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','sn','contract_no','user_id','item_id','money','rate','cycle','total_num','wait_num','type','status']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ItemRecordValidate
|
||||
* @author BD
|
||||
* @date 2024/08/07 15:42
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ItemRecordValidate
|
||||
* @author BD
|
||||
* @date 2024/08/07 15:42
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
114
app/adminapi/validate/item/ItemValidate.php
Normal file
114
app/adminapi/validate/item/ItemValidate.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?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\adminapi\validate\item;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 项目验证器
|
||||
* Class ItemValidate
|
||||
* @package app\adminapi\validate\item
|
||||
*/
|
||||
class ItemValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'cid' => 'require',
|
||||
'type' => 'require',
|
||||
'title' => 'require',
|
||||
'min_money' => 'require',
|
||||
'max_money' => 'require',
|
||||
'rate' => 'require',
|
||||
'cycle' => 'require',
|
||||
'progress' => 'require',
|
||||
'progress_auto' => 'require',
|
||||
'is_show' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'cid' => '项目分类',
|
||||
'type' => '投资类型',
|
||||
'title' => '项目标题',
|
||||
'min_money' => '最小投资额',
|
||||
'max_money' => '最大投资额',
|
||||
'rate' => '利率',
|
||||
'cycle' => '周期',
|
||||
'progress' => '项目进度',
|
||||
'progress_auto' => '自增进度',
|
||||
'is_show' => '是否显示',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ItemValidate
|
||||
* @author BD
|
||||
* @date 2024/01/16 13:23
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['cid','type','title','min_money','max_money','rate','cycle','progress','progress_auto','is_show']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return ItemValidate
|
||||
* @author BD
|
||||
* @date 2024/01/16 13:23
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','cid','type','title','min_money','max_money','rate','cycle','progress','progress_auto','is_show']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ItemValidate
|
||||
* @author BD
|
||||
* @date 2024/01/16 13:23
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ItemValidate
|
||||
* @author BD
|
||||
* @date 2024/01/16 13:23
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
97
app/adminapi/validate/lh/LhCoinValidate.php
Normal file
97
app/adminapi/validate/lh/LhCoinValidate.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
namespace app\adminapi\validate\lh;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 量化货币验证器
|
||||
* Class LhCoinValidate
|
||||
* @package app\adminapi\validate\lh
|
||||
*/
|
||||
class LhCoinValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'name' => 'require',
|
||||
'logo' => 'require',
|
||||
'symbol' => 'require',
|
||||
'symbol_market' => 'require',
|
||||
'price' => 'require',
|
||||
'buy_name' => 'require',
|
||||
'sale_name' => 'require',
|
||||
'is_show' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'name' => '货币名称',
|
||||
'logo' => 'Logo',
|
||||
'symbol' => '货币符号',
|
||||
'symbol_market' => '货币标识',
|
||||
'price' => '价格',
|
||||
'buy_name' => '买入平台',
|
||||
'sale_name' => '卖出平台',
|
||||
'is_show' => '显示状态',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return LhCoinValidate
|
||||
* @author BD
|
||||
* @date 2024/05/19 21:13
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['name','logo','symbol','buy_name','sale_name','is_show']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return LhCoinValidate
|
||||
* @author BD
|
||||
* @date 2024/05/19 21:13
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','name','logo','symbol','buy_name','sale_name','is_show']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return LhCoinValidate
|
||||
* @author BD
|
||||
* @date 2024/05/19 21:13
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return LhCoinValidate
|
||||
* @author BD
|
||||
* @date 2024/05/19 21:13
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
105
app/adminapi/validate/lh/LhRecordValidate.php
Normal file
105
app/adminapi/validate/lh/LhRecordValidate.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
namespace app\adminapi\validate\lh;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 量化记录验证器
|
||||
* Class LhRecordValidate
|
||||
* @package app\adminapi\validate\lh
|
||||
*/
|
||||
class LhRecordValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'sn' => 'require',
|
||||
'user_id' => 'require',
|
||||
'coin_id' => 'require',
|
||||
'coin_name' => 'require',
|
||||
'coin_logo' => 'require',
|
||||
'coin_symbol' => 'require',
|
||||
'coin_buy_name' => 'require',
|
||||
'coin_sale_name' => 'require',
|
||||
'money' => 'require',
|
||||
'income' => 'require',
|
||||
'money_buy' => 'require',
|
||||
'money_sale' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'sn' => '订单编号',
|
||||
'user_id' => '用户id',
|
||||
'coin_id' => '货币id',
|
||||
'coin_name' => '货币名称',
|
||||
'coin_logo' => 'Logo',
|
||||
'coin_symbol' => '货币符号',
|
||||
'coin_buy_name' => '买入平台',
|
||||
'coin_sale_name' => '卖出平台',
|
||||
'money' => '投资金额',
|
||||
'income' => '利润',
|
||||
'money_buy' => '买入金额',
|
||||
'money_sale' => '卖出金额',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return LhRecordValidate
|
||||
* @author BD
|
||||
* @date 2024/05/19 21:13
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['sn','user_id','coin_id','coin_name','coin_logo','coin_symbol','coin_buy_name','coin_sale_name','money','income','money_buy','money_sale']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return LhRecordValidate
|
||||
* @author BD
|
||||
* @date 2024/05/19 21:13
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','sn','user_id','coin_id','coin_name','coin_logo','coin_symbol','coin_buy_name','coin_sale_name','money','income','money_buy','money_sale']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return LhRecordValidate
|
||||
* @author BD
|
||||
* @date 2024/05/19 21:13
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return LhRecordValidate
|
||||
* @author BD
|
||||
* @date 2024/05/19 21:13
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
97
app/adminapi/validate/mall/MallGoodsRecordValidate.php
Normal file
97
app/adminapi/validate/mall/MallGoodsRecordValidate.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
namespace app\adminapi\validate\mall;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 奖品记录验证器
|
||||
* Class MallGoodsRecordValidate
|
||||
* @package app\adminapi\validate\mall
|
||||
*/
|
||||
class MallGoodsRecordValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'sn' => 'require',
|
||||
'user_id' => 'require',
|
||||
'm_goods_id' => 'require',
|
||||
'm_goods_title' => 'require',
|
||||
'm_goods_image' => 'require',
|
||||
'status' => 'require',
|
||||
'type' => 'require',
|
||||
'type2' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'sn' => '订单编号',
|
||||
'user_id' => '用户id',
|
||||
'm_goods_id' => '商品id',
|
||||
'm_goods_title' => '商品标题',
|
||||
'm_goods_image' => '商品图片',
|
||||
'status' => '状态',
|
||||
'type' => '奖品分类',
|
||||
'type2' => '奖品类型',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return MallGoodsRecordValidate
|
||||
* @author BD
|
||||
* @date 2024/10/15 14:00
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['sn','user_id','m_goods_id','m_goods_title','m_goods_image','status','type','type2']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return MallGoodsRecordValidate
|
||||
* @author BD
|
||||
* @date 2024/10/15 14:00
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','sn','user_id','m_goods_id','m_goods_title','m_goods_image','status','type','type2']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return MallGoodsRecordValidate
|
||||
* @author BD
|
||||
* @date 2024/10/15 14:00
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return MallGoodsRecordValidate
|
||||
* @author BD
|
||||
* @date 2024/10/15 14:00
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
97
app/adminapi/validate/mall/MallGoodsValidate.php
Normal file
97
app/adminapi/validate/mall/MallGoodsValidate.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
namespace app\adminapi\validate\mall;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 积分、抽奖奖品验证器
|
||||
* Class MallGoodsValidate
|
||||
* @package app\adminapi\validate\mall
|
||||
*/
|
||||
class MallGoodsValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'title' => 'require',
|
||||
'price' => 'require',
|
||||
'money' => 'require',
|
||||
'point' => 'require',
|
||||
'type' => 'require',
|
||||
'type2' => 'require',
|
||||
'is_show' => 'require',
|
||||
'sort' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'title' => '奖品标题',
|
||||
'price' => '所需积分',
|
||||
'money' => '现金金额',
|
||||
'point' => '奖品积分',
|
||||
'type' => '奖品分类',
|
||||
'type2' => '奖品类型',
|
||||
'is_show' => '显示状态',
|
||||
'sort' => '排序',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return MallGoodsValidate
|
||||
* @author BD
|
||||
* @date 2024/10/14 23:57
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['title','price','money','point','type','type2','is_show','sort']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return MallGoodsValidate
|
||||
* @author BD
|
||||
* @date 2024/10/14 23:57
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','title','price','money','point','type','type2','is_show','sort']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return MallGoodsValidate
|
||||
* @author BD
|
||||
* @date 2024/10/14 23:57
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return MallGoodsValidate
|
||||
* @author BD
|
||||
* @date 2024/10/14 23:57
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
116
app/adminapi/validate/member/UserMemberValidate.php
Normal file
116
app/adminapi/validate/member/UserMemberValidate.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?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\adminapi\validate\member;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 会员等级验证器
|
||||
* Class UserMemberValidate
|
||||
* @package app\adminapi\validate\member
|
||||
*/
|
||||
class UserMemberValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'name' => 'require',
|
||||
'logo' => 'require',
|
||||
'bg_img' => 'require',
|
||||
'text_color' => 'require',
|
||||
'money' => 'require',
|
||||
'level1_num' => 'require',
|
||||
// 'lh_min' => 'require',
|
||||
// 'lh_max' => 'require',
|
||||
// 'rate_min' => 'require',
|
||||
// 'rate_max' => 'require',
|
||||
// 'lh_num' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'name' => '等级名称',
|
||||
'logo' => 'LOGO',
|
||||
'bg_img' => '背景图',
|
||||
'text_color' => '文字颜色',
|
||||
'money' => '有效金额',
|
||||
'level1_num' => '1代有效人数',
|
||||
// 'lh_min' => '量化最低金额',
|
||||
// 'lh_max' => '量化最高金额',
|
||||
// 'rate_min' => '最小收益率',
|
||||
// 'rate_max' => '最大收益率',
|
||||
// 'lh_num' => '每日量化次数',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return UserMemberValidate
|
||||
* @author BD
|
||||
* @date 2024/03/14 00:28
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['name','logo','bg_img','text_color','money','level1_num']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return UserMemberValidate
|
||||
* @author BD
|
||||
* @date 2024/03/14 00:28
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['name','logo','bg_img','text_color','money','level1_num']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return UserMemberValidate
|
||||
* @author BD
|
||||
* @date 2024/03/14 00:28
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return UserMemberValidate
|
||||
* @author BD
|
||||
* @date 2024/03/14 00:28
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
39
app/adminapi/validate/notice/NoticeValidate.php
Normal file
39
app/adminapi/validate/notice/NoticeValidate.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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\adminapi\validate\notice;
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 通知验证
|
||||
* Class NoticeValidate
|
||||
* @package app\adminapi\validate\notice
|
||||
*/
|
||||
class NoticeValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '参数缺失',
|
||||
];
|
||||
|
||||
protected function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
59
app/adminapi/validate/notice/SmsConfigValidate.php
Normal file
59
app/adminapi/validate/notice/SmsConfigValidate.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?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\adminapi\validate\notice;
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 短信配置验证
|
||||
* Class SmsConfigValidate
|
||||
* @package app\adminapi\validate\notice
|
||||
*/
|
||||
class SmsConfigValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'type' => 'require',
|
||||
'sign' => 'require',
|
||||
'app_id' => 'requireIf:type,tencent',
|
||||
'app_key' => 'requireIf:type,ali',
|
||||
'secret_id' => 'requireIf:type,tencent',
|
||||
'secret_key' => 'requireIf:type,tencent|requireIf:type,ali',
|
||||
'status' => 'require',
|
||||
'username' => 'requireIf:type,smsbao',
|
||||
'url_cn' => 'requireIf:type,smsbao',
|
||||
'url_go' => 'requireIf:type,smsbao',
|
||||
'api_key' => 'requireIf:type,smsbao',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'type.require' => '请选择类型',
|
||||
'sign.require' => '请输入签名',
|
||||
'app_id.requireIf' => '请输入app_id',
|
||||
'app_key.requireIf' => '请输入app_key',
|
||||
'secret_id.requireIf' => '请输入secret_id',
|
||||
'secret_key.requireIf' => '请输入secret_key',
|
||||
'status.require' => '请选择状态',
|
||||
'username.requireIf' => '请输入用户名',
|
||||
'url_cn.requireIf' => '请输入接口域名(国内)',
|
||||
'url_go.requireIf' => '请输入接口域名(国际)',
|
||||
'api_key.requireIf' => '请输入API Key',
|
||||
];
|
||||
|
||||
|
||||
protected function sceneDetail()
|
||||
{
|
||||
return $this->only(['type']);
|
||||
}
|
||||
}
|
||||
100
app/adminapi/validate/setting/LanguagePagValidate.php
Normal file
100
app/adminapi/validate/setting/LanguagePagValidate.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?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\adminapi\validate\setting;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 语言包验证器
|
||||
* Class LanguagePagValidate
|
||||
* @package app\adminapi\validate\setting
|
||||
*/
|
||||
class LanguagePagValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'type' => 'require',
|
||||
'name' => 'require',
|
||||
'value' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'type' => '类型',
|
||||
'name' => '名称',
|
||||
'value' => '值',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return LanguagePagValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/01/14 13:50
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['type','name']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return LanguagePagValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/01/14 13:50
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','type','name']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return LanguagePagValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/01/14 13:50
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return LanguagePagValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/01/14 13:50
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
115
app/adminapi/validate/setting/LanguageValidate.php
Normal file
115
app/adminapi/validate/setting/LanguageValidate.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?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\adminapi\validate\setting;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 语言包验证器
|
||||
* Class LanguageValidate
|
||||
* @package app\adminapi\validate\setting
|
||||
*/
|
||||
class LanguageValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'name' => 'require',
|
||||
'name_loc' => 'require',
|
||||
'symbol' => 'require',
|
||||
'precision' => 'require',
|
||||
'is_show' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'name' => '语言名称',
|
||||
'name_loc' => '语言名称',
|
||||
'symbol' => '语言标识',
|
||||
'precision' => '显示精度',
|
||||
'is_show' => '是否显示',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return LanguageValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/11/30 13:59
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['name','name_loc','symbol','precision','is_show']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return LanguageValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/11/30 13:59
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','name','name_loc','symbol','precision','is_show']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return LanguageValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/11/30 13:59
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return LanguageValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/11/30 13:59
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 更改状态场景
|
||||
* @return ArticleValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 10:18
|
||||
*/
|
||||
public function sceneStatus()
|
||||
{
|
||||
return $this->only(['id', 'is_show']);
|
||||
}
|
||||
|
||||
}
|
||||
38
app/adminapi/validate/setting/OperationLogValidate.php
Normal file
38
app/adminapi/validate/setting/OperationLogValidate.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?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\adminapi\validate\setting;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 代码生成选择表验证
|
||||
* Class OperationLogValidate
|
||||
* @package app\adminapi\validate\setting
|
||||
*/
|
||||
class OperationLogValidate extends BaseValidate
|
||||
{
|
||||
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '参数缺失',
|
||||
];
|
||||
|
||||
}
|
||||
130
app/adminapi/validate/setting/RechargeMethodValidate.php
Normal file
130
app/adminapi/validate/setting/RechargeMethodValidate.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<?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\adminapi\validate\setting;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 充值方式验证器
|
||||
* Class RechargeMethodValidate
|
||||
* @package app\adminapi\validate\setting
|
||||
*/
|
||||
class RechargeMethodValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'lang_id' => 'require',
|
||||
'type' => 'require',
|
||||
'name' => 'require',
|
||||
'rate' => 'require',
|
||||
'is_show' => 'require',
|
||||
|
||||
'money' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'lang_id' => '所属语言ID',
|
||||
'type' => '类型1USDT2扫码3银行卡4在线',
|
||||
'name' => '名称',
|
||||
'rate' => '汇率',
|
||||
'is_show' => '是否显示:1-是.0-否',
|
||||
|
||||
'money' => '请输入常用金额',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return RechargeMethodValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/11/30 15:22
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['lang_id','type','name','rate','is_show']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return RechargeMethodValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/11/30 15:22
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','lang_id','type','name','rate','is_show']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return RechargeMethodValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/11/30 15:22
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return RechargeMethodValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/11/30 15:22
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 更改状态场景
|
||||
* @return ArticleValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 10:18
|
||||
*/
|
||||
public function sceneStatus()
|
||||
{
|
||||
return $this->only(['id', 'is_show']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 常用金额场景
|
||||
* @return RechargeMethodValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/11/30 15:22
|
||||
*/
|
||||
public function sceneMoney()
|
||||
{
|
||||
return $this->only(['money']);
|
||||
}
|
||||
|
||||
}
|
||||
70
app/adminapi/validate/setting/StorageValidate.php
Normal file
70
app/adminapi/validate/setting/StorageValidate.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?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\adminapi\validate\setting;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 存储引擎验证
|
||||
* Class StorageValidate
|
||||
* @package app\adminapi\validate\setting
|
||||
*/
|
||||
class StorageValidate extends BaseValidate
|
||||
{
|
||||
|
||||
protected $rule = [
|
||||
'engine' => 'require',
|
||||
'status' => 'require',
|
||||
];
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置存储引擎参数场景
|
||||
* @return StorageValidate
|
||||
* @author 段誉
|
||||
* @date 2022/4/20 16:18
|
||||
*/
|
||||
public function sceneSetup()
|
||||
{
|
||||
return $this->only(['engine', 'status']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取配置参数信息场景
|
||||
* @return StorageValidate
|
||||
* @author 段誉
|
||||
* @date 2022/4/20 16:18
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['engine']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 切换存储引擎场景
|
||||
* @return StorageValidate
|
||||
* @author 段誉
|
||||
* @date 2022/4/20 16:18
|
||||
*/
|
||||
public function sceneChange()
|
||||
{
|
||||
return $this->only(['engine']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?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\adminapi\validate\setting;
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 交易设置验证
|
||||
* Class TransactionSettingsValidate
|
||||
* @package app\adminapi\validate\setting
|
||||
*/
|
||||
class TransactionSettingsValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'cancel_unpaid_orders' => 'require|in:0,1',
|
||||
'cancel_unpaid_orders_times' => 'requireIf:cancel_unpaid_orders,1|integer|gt:0',
|
||||
'verification_orders' => 'require|in:0,1',
|
||||
'verification_orders_times' => 'requireIf:verification_orders,1|integer|gt:0',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'cancel_unpaid_orders.require' => '请选择系统取消待付款订单方式',
|
||||
'cancel_unpaid_orders.in' => '系统取消待付款订单状态值有误',
|
||||
'cancel_unpaid_orders_times.requireIf' => '系统取消待付款订单时间未填写',
|
||||
'cancel_unpaid_orders_times.integer' => '系统取消待付款订单时间须为整型',
|
||||
'cancel_unpaid_orders_times.gt' => '系统取消待付款订单时间须大于0',
|
||||
|
||||
'verification_orders.require' => '请选择系统自动核销订单方式',
|
||||
'verification_orders.in' => '系统自动核销订单状态值有误',
|
||||
'verification_orders_times.requireIf' => '系统自动核销订单时间未填写',
|
||||
'verification_orders_times.integer' => '系统自动核销订单时间须为整型',
|
||||
'verification_orders_times.gt' => '系统自动核销订单时间须大于0',
|
||||
];
|
||||
|
||||
public function sceneSetConfig()
|
||||
{
|
||||
return $this->only(['cancel_unpaid_orders','cancel_unpaid_orders_times','verification_orders','verification_orders_times']);
|
||||
}
|
||||
}
|
||||
62
app/adminapi/validate/setting/UserConfigValidate.php
Normal file
62
app/adminapi/validate/setting/UserConfigValidate.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?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\adminapi\validate\setting;
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 用户设置验证
|
||||
* Class UserConfigValidate
|
||||
* @package app\adminapi\validate\setting
|
||||
*/
|
||||
class UserConfigValidate extends BaseValidate
|
||||
{
|
||||
|
||||
protected $rule = [
|
||||
'login_way' => 'requireIf:scene,register|array',
|
||||
'coerce_mobile' => 'requireIf:scene,register|in:0,1',
|
||||
'login_agreement' => 'in:0,1',
|
||||
'third_auth' => 'in:0,1',
|
||||
'wechat_auth' => 'in:0,1',
|
||||
'default_avatar' => 'require',
|
||||
'password_pay' => 'require|length:6|integer',
|
||||
];
|
||||
|
||||
|
||||
protected $message = [
|
||||
'default_avatar.require' => '请上传用户默认头像',
|
||||
'login_way.requireIf' => '请选择登录方式',
|
||||
'login_way.array' => '登录方式值错误',
|
||||
'coerce_mobile.requireIf' => '请选择注册强制绑定手机',
|
||||
'coerce_mobile.in' => '注册强制绑定手机值错误',
|
||||
'wechat_auth.in' => '公众号微信授权登录值错误',
|
||||
'third_auth.in' => '第三方登录值错误',
|
||||
'login_agreement.in' => '政策协议值错误',
|
||||
'password_pay.require' => '请输入初始支付密码',
|
||||
'password_pay.length' => '初始支付密码为6位数字',
|
||||
'password_pay.integer' => '初始支付密码为6位数字',
|
||||
];
|
||||
|
||||
//用户设置验证
|
||||
public function sceneUser()
|
||||
{
|
||||
return $this->only(['default_avatar']);
|
||||
}
|
||||
|
||||
//注册验证
|
||||
public function sceneRegister()
|
||||
{
|
||||
return $this->only(['login_way', 'coerce_mobile', 'login_agreement', 'third_auth', 'wechat_auth', 'password_pay']);
|
||||
}
|
||||
}
|
||||
50
app/adminapi/validate/setting/WebSettingValidate.php
Normal file
50
app/adminapi/validate/setting/WebSettingValidate.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?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\adminapi\validate\setting;
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 网站设置验证器
|
||||
* Class WebSettingValidate
|
||||
* @package app\adminapi\validate\setting
|
||||
*/
|
||||
class WebSettingValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'name' => 'require|max:30',
|
||||
'web_favicon' => 'require',
|
||||
'web_logo' => 'require',
|
||||
'login_image' => 'require',
|
||||
'shop_name' => 'require',
|
||||
'shop_logo' => 'require',
|
||||
'pc_logo' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'name.require' => '请填写网站名称',
|
||||
'name.max' => '网站名称最长为12个字符',
|
||||
'web_favicon.require' => '请上传网站图标',
|
||||
'web_logo.require' => '请上传网站logo',
|
||||
'login_image.require' => '请上传登录页广告图',
|
||||
'shop_name.require' => '请填写前台名称',
|
||||
'shop_logo.require' => '请上传前台logo',
|
||||
'pc_logo.require' => '请上传PC端logo',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'website' => ['name', 'web_favicon', 'web_logo', 'login_image', 'shop_name', 'shop_logo', 'pc_logo'],
|
||||
];
|
||||
}
|
||||
98
app/adminapi/validate/tools/EditTableValidate.php
Normal file
98
app/adminapi/validate/tools/EditTableValidate.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?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\adminapi\validate\tools;
|
||||
|
||||
|
||||
use app\common\model\tools\GenerateTable;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 编辑表验证
|
||||
* Class EditTableValidate
|
||||
* @package app\adminapi\validate\tools
|
||||
*/
|
||||
class EditTableValidate extends BaseValidate
|
||||
{
|
||||
|
||||
protected $rule = [
|
||||
'id' => 'require|checkTableData',
|
||||
'table_name' => 'require',
|
||||
'table_comment' => 'require',
|
||||
'template_type' => 'require|in:0,1',
|
||||
'generate_type' => 'require|in:0,1',
|
||||
'module_name' => 'require',
|
||||
'table_column' => 'require|array|checkColumn',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '表id缺失',
|
||||
'table_name.require' => '请填写表名称',
|
||||
'table_comment.require' => '请填写表描述',
|
||||
'template_type.require' => '请选择模板类型',
|
||||
'template_type.in' => '模板类型参数错误',
|
||||
'generate_type.require' => '请选择生成方式',
|
||||
'generate_type.in' => '生成方式类型错误',
|
||||
'module_name.require' => '请填写模块名称',
|
||||
'table_column.require' => '表字段信息缺失',
|
||||
'table_column.array' => '表字段信息类型错误',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 校验当前数据表是否存在
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/6/15 18:58
|
||||
*/
|
||||
protected function checkTableData($value, $rule, $data)
|
||||
{
|
||||
$table = GenerateTable::findOrEmpty($value);
|
||||
if ($table->isEmpty()) {
|
||||
return '信息不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 校验表字段参数
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/6/20 10:42
|
||||
*/
|
||||
protected function checkColumn($value, $rule, $data)
|
||||
{
|
||||
foreach ($value as $item) {
|
||||
if (!isset($item['id'])) {
|
||||
return '表字段id参数缺失';
|
||||
}
|
||||
if (!isset($item['query_type'])) {
|
||||
return '请选择查询方式';
|
||||
}
|
||||
if (!isset($item['view_type'])) {
|
||||
return '请选择显示类型';
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
131
app/adminapi/validate/tools/GenerateTableValidate.php
Normal file
131
app/adminapi/validate/tools/GenerateTableValidate.php
Normal file
@@ -0,0 +1,131 @@
|
||||
<?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\adminapi\validate\tools;
|
||||
|
||||
|
||||
use app\common\model\tools\GenerateTable;
|
||||
use app\common\validate\BaseValidate;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 代码生成选择表验证
|
||||
* Class SelectTableValidate
|
||||
* @package app\adminapi\validate\tools
|
||||
*/
|
||||
class GenerateTableValidate extends BaseValidate
|
||||
{
|
||||
|
||||
protected $rule = [
|
||||
'id' => 'require|checkTableData',
|
||||
'table' => 'require|array|checkTable',
|
||||
'file' => 'require'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '参数缺失',
|
||||
'table.require' => '参数缺失',
|
||||
'table.array' => '参数类型错误',
|
||||
'file.require' => '下载失败',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 选择数据表场景
|
||||
* @return GenerateTableValidate
|
||||
* @author 段誉
|
||||
* @date 2022/6/15 18:58
|
||||
*/
|
||||
public function sceneSelect()
|
||||
{
|
||||
return $this->only(['table']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 需要校验id的场景
|
||||
* @return GenerateTableValidate
|
||||
* @author 段誉
|
||||
* @date 2022/6/15 18:58
|
||||
*/
|
||||
public function sceneId()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 下载场景
|
||||
* @return GenerateTableValidate
|
||||
* @author 段誉
|
||||
* @date 2022/6/24 10:02
|
||||
*/
|
||||
public function sceneDownload()
|
||||
{
|
||||
return $this->only(['file']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 校验选择的数据表信息
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/6/15 18:58
|
||||
*/
|
||||
protected function checkTable($value, $rule, $data)
|
||||
{
|
||||
foreach ($value as $item) {
|
||||
if (!isset($item['name']) || !isset($item['comment'])) {
|
||||
return '参数缺失';
|
||||
}
|
||||
$exist = Db::query("SHOW TABLES LIKE'" . $item['name'] . "'");
|
||||
if (empty($exist)) {
|
||||
return '当前数据库不存在' . $item['name'] . '表';
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 校验当前数据表是否存在
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/6/15 18:58
|
||||
*/
|
||||
protected function checkTableData($value, $rule, $data)
|
||||
{
|
||||
if (!is_array($value)) {
|
||||
$value = [$value];
|
||||
}
|
||||
|
||||
foreach ($value as $item) {
|
||||
$table = GenerateTable::findOrEmpty($item);
|
||||
if ($table->isEmpty()) {
|
||||
return '信息不存在';
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
79
app/adminapi/validate/user/AddUserValidate.php
Normal file
79
app/adminapi/validate/user/AddUserValidate.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?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\adminapi\validate\user;
|
||||
|
||||
|
||||
use app\common\model\user\User;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 注册验证器
|
||||
* Class AddUserValidate
|
||||
* @package app\adminapi\validate\user
|
||||
*/
|
||||
class AddUserValidate extends BaseValidate
|
||||
{
|
||||
|
||||
protected $regex = [
|
||||
// 'register' => '^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]+$',
|
||||
'password' => '/^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)]|[\(\)])+$)([^(0-9a-zA-Z)]|[\(\)]|[a-z]|[A-Z]|[0-9]){6,20}$/'
|
||||
];
|
||||
|
||||
protected $rule = [
|
||||
'channel' => 'require',
|
||||
'account' => 'require|unique:' . User::class . '|checkAccount',
|
||||
'password' => 'require|length:6,20|regex:password',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'channel.require' => '注册来源参数缺失',//注册来源参数缺失
|
||||
'account.require' => '请输入账号',//请输入账号
|
||||
'account.unique' => '账号已存在',//账号已存在
|
||||
'password.require' => '请输入密码',//请输入密码
|
||||
'password.length' => '密码须在6-20位之间',//密码须在6-20位之间
|
||||
'password.regex' => '密码须为字母数字组合',//密码须为字母数字组合
|
||||
];
|
||||
|
||||
/**
|
||||
* @notes 校验注册
|
||||
* @param $buy
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
protected function checkAccount($account, $rule, $data)
|
||||
{
|
||||
$login_way = $data['login_way'];//0邮箱1手机号
|
||||
|
||||
$mobile_pattern = '/^\d{6,20}$/';
|
||||
|
||||
if($login_way == 0){
|
||||
if(!filter_var($data['account'], FILTER_VALIDATE_EMAIL)){
|
||||
return '请输入正确的邮箱地址';
|
||||
}
|
||||
}elseif($login_way == 1){
|
||||
if(!preg_match($mobile_pattern, $data['account'])){
|
||||
return '请输入正确的手机号';
|
||||
}
|
||||
}else{
|
||||
return '参数异常';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
65
app/adminapi/validate/user/AdjustUserMoney.php
Normal file
65
app/adminapi/validate/user/AdjustUserMoney.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?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\adminapi\validate\user;
|
||||
|
||||
use app\common\model\user\User;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 调整用户钱包验证器
|
||||
* Class AdjustUserMoney
|
||||
* @package app\adminapi\validate\user
|
||||
*/
|
||||
class AdjustUserMoney extends BaseValidate
|
||||
{
|
||||
|
||||
protected $rule = [
|
||||
'user_id' => 'require',
|
||||
'action' => 'require|in:1,2,3',
|
||||
'num' => 'require|gt:0|checkMoney',
|
||||
'remark' => 'max:128',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '请选择用户',
|
||||
'action.require' => '请选择调整类型',
|
||||
'action.in' => '调整类型错误',
|
||||
'num.require' => '请输入调整数量',
|
||||
'num.gt' => '调整余额必须大于零',
|
||||
'remark' => '备注不可超过128个符号',
|
||||
];
|
||||
|
||||
|
||||
protected function checkMoney($vaule, $rule, $data)
|
||||
{
|
||||
$user = User::find($data['user_id']);
|
||||
if (empty($user)) {
|
||||
return '用户不存在';
|
||||
}
|
||||
|
||||
if (1 == $data['action'] || 3 == $data['action']) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$surplusMoeny = $user->user_money - floatval($vaule);
|
||||
if ($surplusMoeny < 0) {
|
||||
return '用户可用余额仅剩' . $user->user_money;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
89
app/adminapi/validate/user/UserGroupRuleValidate.php
Normal file
89
app/adminapi/validate/user/UserGroupRuleValidate.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
namespace app\adminapi\validate\user;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 分组规则验证器
|
||||
* Class UserGroupRuleValidate
|
||||
* @package app\adminapi\validate\user
|
||||
*/
|
||||
class UserGroupRuleValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'group_id' => 'require',
|
||||
'num' => 'require',
|
||||
'money_type' => 'require',
|
||||
'commission_type' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'group_id' => '分组',
|
||||
'num' => '第几单',
|
||||
'money_type' => '金额类型1固定值2百分比',
|
||||
'commission_type' => '佣金类型1固定值2百分比',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return UserGroupRuleValidate
|
||||
* @author BD
|
||||
* @date 2024/04/25 01:30
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['num','money_type','commission_type']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return UserGroupRuleValidate
|
||||
* @author BD
|
||||
* @date 2024/04/25 01:30
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','num','money_type','commission_type']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return UserGroupRuleValidate
|
||||
* @author BD
|
||||
* @date 2024/04/25 01:30
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return UserGroupRuleValidate
|
||||
* @author BD
|
||||
* @date 2024/04/25 01:30
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
83
app/adminapi/validate/user/UserGroupValidate.php
Normal file
83
app/adminapi/validate/user/UserGroupValidate.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
namespace app\adminapi\validate\user;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 用户分组验证器
|
||||
* Class UserGroupValidate
|
||||
* @package app\adminapi\validate\user
|
||||
*/
|
||||
class UserGroupValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'name' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'name' => '分组名称',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return UserGroupValidate
|
||||
* @author BD
|
||||
* @date 2024/04/25 01:04
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['name']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return UserGroupValidate
|
||||
* @author BD
|
||||
* @date 2024/04/25 01:04
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','name']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return UserGroupValidate
|
||||
* @author BD
|
||||
* @date 2024/04/25 01:04
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return UserGroupValidate
|
||||
* @author BD
|
||||
* @date 2024/04/25 01:04
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
83
app/adminapi/validate/user/UserInfoValidate.php
Normal file
83
app/adminapi/validate/user/UserInfoValidate.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
namespace app\adminapi\validate\user;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 用户信息验证器
|
||||
* Class UserInfoValidate
|
||||
* @package app\adminapi\validate\user
|
||||
*/
|
||||
class UserInfoValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'user_id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'user_id' => '用户id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return UserInfoValidate
|
||||
* @author BD
|
||||
* @date 2024/06/08 17:51
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['user_id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return UserInfoValidate
|
||||
* @author BD
|
||||
* @date 2024/06/08 17:51
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','user_id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return UserInfoValidate
|
||||
* @author BD
|
||||
* @date 2024/06/08 17:51
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return UserInfoValidate
|
||||
* @author BD
|
||||
* @date 2024/06/08 17:51
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
89
app/adminapi/validate/user/UserKadanValidate.php
Normal file
89
app/adminapi/validate/user/UserKadanValidate.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
namespace app\adminapi\validate\user;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 卡单规则验证器
|
||||
* Class UserKadanValidate
|
||||
* @package app\adminapi\validate\user
|
||||
*/
|
||||
class UserKadanValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'user_id' => 'require',
|
||||
'num' => 'require',
|
||||
'money' => 'require',
|
||||
'commission' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'user_id' => '用户',
|
||||
'num' => '第几单',
|
||||
'money' => '订单金额',
|
||||
'commission' => '佣金',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return UserKadanValidate
|
||||
* @author BD
|
||||
* @date 2024/04/24 17:00
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['user_id','num','money','commission']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return UserKadanValidate
|
||||
* @author BD
|
||||
* @date 2024/04/24 17:00
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','user_id','num','money','commission']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return UserKadanValidate
|
||||
* @author BD
|
||||
* @date 2024/04/24 17:00
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return UserKadanValidate
|
||||
* @author BD
|
||||
* @date 2024/04/24 17:00
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
81
app/adminapi/validate/user/UserMineRecordValidate.php
Normal file
81
app/adminapi/validate/user/UserMineRecordValidate.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
namespace app\adminapi\validate\user;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 挖矿记录验证器
|
||||
* Class UserMineRecordValidate
|
||||
* @package app\adminapi\validate\user
|
||||
*/
|
||||
class UserMineRecordValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return UserMineRecordValidate
|
||||
* @author BD
|
||||
* @date 2025/01/01 15:47
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return UserMineRecordValidate
|
||||
* @author BD
|
||||
* @date 2025/01/01 15:47
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return UserMineRecordValidate
|
||||
* @author BD
|
||||
* @date 2025/01/01 15:47
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return UserMineRecordValidate
|
||||
* @author BD
|
||||
* @date 2025/01/01 15:47
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
91
app/adminapi/validate/user/UserNoticeValidate.php
Normal file
91
app/adminapi/validate/user/UserNoticeValidate.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
namespace app\adminapi\validate\user;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 用户消息验证器
|
||||
* Class UserNoticeValidate
|
||||
* @package app\adminapi\validate\user
|
||||
*/
|
||||
class UserNoticeValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'user_id' => 'require',
|
||||
'title' => 'require',
|
||||
'content' => 'require',
|
||||
'notice_type' => 'require',
|
||||
'langs' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'user_id' => '用户id',
|
||||
'title' => '标题',
|
||||
'content' => '内容',
|
||||
'notice_type' => '消息类型',
|
||||
'langs' => '多语言存储',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return UserNoticeValidate
|
||||
* @author BD
|
||||
* @date 2024/05/26 00:36
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['user_id','title','content','read','notice_type','langs']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return UserNoticeValidate
|
||||
* @author BD
|
||||
* @date 2024/05/26 00:36
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','user_id','title','content','read','notice_type','langs']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return UserNoticeValidate
|
||||
* @author BD
|
||||
* @date 2024/05/26 00:36
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return UserNoticeValidate
|
||||
* @author BD
|
||||
* @date 2024/05/26 00:36
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
53
app/adminapi/validate/user/UserRelationValidate.php
Normal file
53
app/adminapi/validate/user/UserRelationValidate.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?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\adminapi\validate\user;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 用户关系验证器
|
||||
* Class UserRelationValidate
|
||||
* @package app\adminapi\validate\user
|
||||
*/
|
||||
class UserRelationValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'user_id' => 'require',
|
||||
'parent_id' => 'require',
|
||||
'level' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'user_id' => '用户id',
|
||||
'parent_id' => '上级id',
|
||||
'level' => 'level',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
126
app/adminapi/validate/user/UserTronValidate.php
Normal file
126
app/adminapi/validate/user/UserTronValidate.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
namespace app\adminapi\validate\user;
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
use app\common\model\user\UserTron;
|
||||
|
||||
|
||||
/**
|
||||
* 波场钱包验证器
|
||||
* Class UserTronValidate
|
||||
* @package app\adminapi\validate\user
|
||||
*/
|
||||
class UserTronValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'address' => 'require',
|
||||
'key' => 'require',
|
||||
'qrcode' => 'require',
|
||||
'sort' => 'require',
|
||||
'in_addr' => 'require',
|
||||
'num' => 'require|gt:0|checkMoney',
|
||||
'rem_money' => 'require',
|
||||
'min_money' => 'require|gt:0',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'address' => '地址',
|
||||
'key' => '私钥',
|
||||
'qrcode' => '二维码',
|
||||
'sort' => '排序',
|
||||
'in_addr' => '转入地址',
|
||||
'num.require' => '请输入转账金额',
|
||||
'num.gt' => '转账金额必须大于零',
|
||||
'rem_money.require' => '请输入钱包留取金额',
|
||||
'min_money.require' => '请输入最低归集金额',
|
||||
'min_money.gt' => '最低归集金额必须大于零',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return UserTronValidate
|
||||
* @author BD
|
||||
* @date 2024/05/04 23:38
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['address','key','qrcode','sort']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return UserTronValidate
|
||||
* @author BD
|
||||
* @date 2024/05/04 23:38
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','address','key','qrcode','sort']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return UserTronValidate
|
||||
* @author BD
|
||||
* @date 2024/05/04 23:38
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 转账场景
|
||||
* @return UserTronValidate
|
||||
* @author BD
|
||||
* @date 2024/05/04 23:38
|
||||
*/
|
||||
public function sceneTran()
|
||||
{
|
||||
return $this->only(['num','in_addr']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 归集场景
|
||||
* @return UserTronValidate
|
||||
* @author BD
|
||||
* @date 2024/05/04 23:38
|
||||
*/
|
||||
public function sceneTranAll()
|
||||
{
|
||||
return $this->only(['rem_money','min_money','in_addr']);
|
||||
}
|
||||
|
||||
protected function checkMoney($vaule, $rule, $data)
|
||||
{
|
||||
$userTran = UserTron::find($data['id']);
|
||||
if (empty($userTran)) {
|
||||
return '钱包不存在';
|
||||
}
|
||||
|
||||
|
||||
$surplusMoeny = $userTran['money_usdt'] - $data['num'];
|
||||
if ($surplusMoeny < 0) {
|
||||
return '钱包余额不足';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
136
app/adminapi/validate/user/UserValidate.php
Normal file
136
app/adminapi/validate/user/UserValidate.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
namespace app\adminapi\validate\user;
|
||||
|
||||
|
||||
use app\common\model\user\User;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 用户验证
|
||||
* Class UserValidate
|
||||
* @package app\adminapi\validate\user
|
||||
*/
|
||||
class UserValidate extends BaseValidate
|
||||
{
|
||||
protected $regex = [
|
||||
'pwd' => '/^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)]|[\(\)])+$)([^(0-9a-zA-Z)]|[\(\)]|[a-z]|[A-Z]|[0-9]){6,20}$/',
|
||||
'email' => '/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/'
|
||||
];
|
||||
|
||||
protected $rule = [
|
||||
'id' => 'require|checkUser',
|
||||
'field' => 'require|checkField',
|
||||
'value' => 'require',
|
||||
'pwd' => 'require|length:6,20|regex:pwd',
|
||||
'email' => 'require|regex:email',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '请选择用户',
|
||||
'field.require' => '请选择操作',
|
||||
'value.require' => '请输入内容',
|
||||
'pwd.require' => '请输入密码',//请输入密码
|
||||
'pwd.length' => '密码须在6-20位之间',//密码须在6-20位之间
|
||||
'pwd.regex' => '密码须为字母数字组合',//密码须为字母数字组合
|
||||
'email.require' => '请输入邮箱',//请输入邮箱
|
||||
'email.regex' => '请输入正确的邮箱地址',//请输入正确的邮箱地址
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 用户信息校验
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2023/9/22 17:03
|
||||
*/
|
||||
public function checkUser($value, $rule, $data)
|
||||
{
|
||||
$userIds = is_array($value) ? $value : [$value];
|
||||
|
||||
foreach ($userIds as $item) {
|
||||
if (!User::find($item)) {
|
||||
return '用户不存在!';
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 校验是否可更新信息
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author BD
|
||||
* @date 2023/9/22 16:37
|
||||
*/
|
||||
public function checkField($value, $rule, $data)
|
||||
{
|
||||
$allowField = ['account', 'sex', 'mobile', 'real_name'];
|
||||
|
||||
if (!in_array($value, $allowField)) {
|
||||
return '用户信息不允许更新';
|
||||
}
|
||||
|
||||
switch ($value) {
|
||||
case 'account':
|
||||
//验证手机号码是否存在
|
||||
$account = User::where([
|
||||
['id', '<>', $data['id']],
|
||||
['account', '=', $data['value']]
|
||||
])->findOrEmpty();
|
||||
|
||||
if (!$account->isEmpty()) {
|
||||
return '账号已被使用';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'mobile':
|
||||
if (false == $this->validate($data['value'], 'mobile', $data)) {
|
||||
return '手机号码格式错误';
|
||||
}
|
||||
|
||||
//验证手机号码是否存在
|
||||
$mobile = User::where([
|
||||
['id', '<>', $data['id']],
|
||||
['mobile', '=', $data['value']]
|
||||
])->findOrEmpty();
|
||||
|
||||
if (!$mobile->isEmpty()) {
|
||||
return '手机号码已存在';
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 修改密码场景
|
||||
* @return UserValidate
|
||||
* @author BD
|
||||
* @date 2023/9/22 16:35
|
||||
*/
|
||||
public function sceneChangePwd()
|
||||
{
|
||||
return $this->only(['pwd']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 修改邮箱场景
|
||||
* @return UserValidate
|
||||
* @author BD
|
||||
* @date 2023/9/22 16:35
|
||||
*/
|
||||
public function sceneChangeEmail()
|
||||
{
|
||||
return $this->only(['email']);
|
||||
}
|
||||
|
||||
}
|
||||
113
app/adminapi/validate/withdraw/WithdrawBankValidate.php
Normal file
113
app/adminapi/validate/withdraw/WithdrawBankValidate.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?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\adminapi\validate\withdraw;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 可提现银行验证器
|
||||
* Class WithdrawBankValidate
|
||||
* @package app\adminapi\validate\withdraw
|
||||
*/
|
||||
class WithdrawBankValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'lang_id' => 'require',
|
||||
'name' => 'require',
|
||||
'is_show' => 'require',
|
||||
'sort' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'lang_id' => '所属语言',
|
||||
'name' => '银行名称',
|
||||
'is_show' => '是否显示',
|
||||
'sort' => '排序',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return WithdrawBankValidate
|
||||
* @author BD
|
||||
* @date 2024/02/25 12:19
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['lang_id','name','is_show','sort']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return WithdrawBankValidate
|
||||
* @author BD
|
||||
* @date 2024/02/25 12:19
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','lang_id','name','is_show','sort']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return WithdrawBankValidate
|
||||
* @author BD
|
||||
* @date 2024/02/25 12:19
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return WithdrawBankValidate
|
||||
* @author BD
|
||||
* @date 2024/02/25 12:19
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 所有银行场景
|
||||
* @return WithdrawBankValidate
|
||||
* @author BD
|
||||
* @date 2024/02/25 12:19
|
||||
*/
|
||||
public function sceneAllByLang()
|
||||
{
|
||||
return $this->only(['lang_id']);
|
||||
}
|
||||
|
||||
}
|
||||
112
app/adminapi/validate/withdraw/WithdrawMethodValidate.php
Normal file
112
app/adminapi/validate/withdraw/WithdrawMethodValidate.php
Normal file
@@ -0,0 +1,112 @@
|
||||
<?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\adminapi\validate\withdraw;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 提现方式验证器
|
||||
* Class WithdrawMethodValidate
|
||||
* @package app\adminapi\validate\withdraw
|
||||
*/
|
||||
class WithdrawMethodValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'lang_id' => 'require',
|
||||
'type' => 'require',
|
||||
'name' => 'require',
|
||||
'symbol' => 'require',
|
||||
'rate' => 'require',
|
||||
'precision' => 'require',
|
||||
'charge' => 'require',
|
||||
'is_show' => 'require',
|
||||
'sort' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'lang_id' => '所属语言',
|
||||
'type' => '类型',
|
||||
'name' => '名称',
|
||||
'symbol' => '货币符号',
|
||||
'rate' => '汇率',
|
||||
'precision' => '显示精度',
|
||||
'charge' => '手续费',
|
||||
'is_show' => '显示状态',
|
||||
'sort' => '排序',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return WithdrawMethodValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/02/23 14:34
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['lang_id','type','name','symbol','rate','precision','charge','is_show','sort']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return WithdrawMethodValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/02/23 14:34
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','lang_id','type','name','symbol','rate','precision','charge','is_show','sort']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return WithdrawMethodValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/02/23 14:34
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return WithdrawMethodValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/02/23 14:34
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
82
app/adminapi/validate/withdraw/WithdrawWalletValidate.php
Normal file
82
app/adminapi/validate/withdraw/WithdrawWalletValidate.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?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\adminapi\validate\withdraw;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 用户提现钱包验证器
|
||||
* Class WithdrawWalletValidate
|
||||
* @package app\adminapi\validate\withdraw
|
||||
*/
|
||||
class WithdrawWalletValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'lang_id' => 'require',
|
||||
'user_id' => 'require',
|
||||
'method_id' => 'require',
|
||||
'type' => 'require',
|
||||
'account' => 'require',
|
||||
'is_disable' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'lang_id' => '所属语言',
|
||||
'user_id' => '用户id',
|
||||
'method_id' => '提现方式id',
|
||||
'type' => '类型',
|
||||
'account' => '账号',
|
||||
'is_disable' => '是否禁用',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return WithdrawWalletValidate
|
||||
* @author BD
|
||||
* @date 2024/02/26 13:32
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','account','is_disable']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return WithdrawWalletValidate
|
||||
* @author BD
|
||||
* @date 2024/02/26 13:32
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user