chore: 重写初始提交(清空历史,整理后全量提交)

This commit is contained in:
ywxapp
2026-08-16 16:54:14 +08:00
commit 6c1a106bc1
1808 changed files with 238144 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace app\backend\validate;
use think\Validate;
class Ad extends Validate
{
protected $rule = [
'title' => 'require|max:200',
'type' => 'in:1,2,3',
'position' => 'in:home_top,home_side,popup,list_bottom,home_bottom,content_top,content_bottom,sidebar,float',
'content' => 'require',
'url' => 'max:255',
'image' => 'max:255',
'sort' => 'number',
'status' => 'in:0,1',
];
protected $message = [
];
protected $scene = [
'add' => ['title', 'type', 'position', 'content', 'url', 'image', 'sort', 'status'],
'edit' => ['title', 'type', 'position', 'content', 'url', 'image', 'sort', 'status'],
];
}
+60
View File
@@ -0,0 +1,60 @@
<?php
/*
* @Author: YwxApp <ywx@ywxapp.cn>
* @Date: 2026-04-29 02:32:33
* @LastEditors: YwxApp <ywx@ywxapp.cn>
* @LastEditTime: 2026-07-21 23:27:10
* @Description:
* @FilePath: \ywxapp_dev\app\backend\validate\Admin.php
* @CustomString: Copyright (c) 2026 YwxApp
*/
declare (strict_types = 1);
namespace app\backend\validate;
use think\Validate;
/**
* Admin 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class Admin extends Validate
{
protected $rule = [
'account' => 'require|min:5|max:20',
'nickname' => 'require|min:2|max:20',
'password' => 'require|min:6|max:20',
'confirmpass' => 'require|confirm:password',
'email' => 'require|email',
'mobile' => 'require|mobile',
//'status' => 'require|in:0,1',
];
protected $message = [
'account.require' => '用户名不能为空',
'account.min' => '用户名长度不能少于3个字符',
'account.max' => '用户名长度不能超过20个字符',
'nickname.require' => '昵称不能为空',
'nickname.min' => '昵称长度不能少于2个字符',
'nickname.max' => '昵称长度不能超过20个字符',
'password.require' => '密码不能为空',
'password.min' => '密码长度不能少于6个字符',
'password.max' => '密码长度不能超过20个字符',
'confirmpass.require' => '确认密码不能为空',
'confirmpass.confirm' => '两次输入的密码不一致',
'email.require' => '邮箱不能为空',
'email.email' => '邮箱格式不正确',
'mobile.require' => '电话不能为空',
'mobile.mobile' => '电话格式不正确',
//'status.require' => '状态不能为空',
//'status.in' => '状态值不正确',
];
// 更新场景
public function sceneUpdate()
{
return $this->remove('password', 'require');
}
}
+43
View File
@@ -0,0 +1,43 @@
<?php
/*
* @Author: YwxApp <ywx@ywxapp.cn>
* @Date: 2026-04-29 02:32:33
* @LastEditors: YwxApp <ywx@ywxapp.cn>
* @LastEditTime: 2026-07-21 23:27:10
* @Description:
* @FilePath: \ywxapp_dev\app\backend\validate\Admin.php
* @CustomString: Copyright (c) 2026 YwxApp
*/
declare (strict_types = 1);
namespace app\backend\validate;
use think\Validate;
/**
* AdminPermission 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class AdminPermission extends Validate
{
/**
* 定义验证规则
* 格式:'字段名' => ['规则1','规则2'...]
*
* @var array
*/
protected $rule = [
'title' => 'require',
'name' => 'require|unique:permission,name',
'type' => 'in:1,2,3',
];
/**
* 定义错误信息
* 格式:'字段名.规则名' => '错误信息'
*
* @var array
*/
protected $message = [];
}
+39
View File
@@ -0,0 +1,39 @@
<?php
/*
* @Author: YwxApp <ywx@ywxapp.cn>
* @Date: 2026-04-29 02:32:33
* @LastEditors: YwxApp <ywx@ywxapp.cn>
* @LastEditTime: 2026-07-21 23:27:10
* @Description:
* @FilePath: \ywxapp_dev\app\backend\validate\Admin.php
* @CustomString: Copyright (c) 2026 YwxApp
*/
declare (strict_types = 1);
namespace app\backend\validate;
use think\Validate;
/**
* AdminProfile 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class AdminProfile extends Validate
{
/**
* 定义验证规则
* 格式:'字段名' => ['规则1','规则2'...]
*
* @var array
*/
protected $rule = [];
/**
* 定义错误信息
* 格式:'字段名.规则名' => '错误信息'
*
* @var array
*/
protected $message = [];
}
+37
View File
@@ -0,0 +1,37 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace app\backend\validate;
use think\Validate;
/**
* AdminRole 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class AdminRole extends Validate
{
/**
* 定义验证规则
* 格式:'字段名' => ['规则1','规则2'...]
*
* @var array
*/
protected $rule = [];
/**
* 定义错误信息
* 格式:'字段名.规则名' => '错误信息'
*
* @var array
*/
protected $message = [];
}
+25
View File
@@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
namespace app\backend\validate;
use think\Validate;
class Card extends Validate
{
protected $rule = [
'cardno' => 'require|max:100',
'password' => 'require|max:100',
'amount' => 'float',
'status' => 'in:0,1,2',
'use_time' => 'number',
'sort' => 'number',
];
protected $message = [
];
protected $scene = [
'add' => ['cardno', 'password', 'amount', 'status', 'use_time', 'sort'],
'edit' => ['cardno', 'password', 'amount', 'status', 'use_time', 'sort'],
];
}
+23
View File
@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace app\backend\validate;
use think\Validate;
class Help extends Validate
{
protected $rule = [
'title' => 'require|max:200',
'content' => 'require',
'sort' => 'number',
'status' => 'in:0,1',
];
protected $message = [
];
protected $scene = [
'add' => ['title', 'content', 'sort', 'status'],
'edit' => ['title', 'content', 'sort', 'status'],
];
}
+44
View File
@@ -0,0 +1,44 @@
<?php
/*
* @Author: YwxApp <ywx@ywxapp.cn>
* @Date: 2026-04-29 02:32:33
* @LastEditors: YwxApp <ywx@ywxapp.cn>
* @LastEditTime: 2026-07-23 00:00:00
* @Description: 友情链接验证器
* @FilePath: \ywxapp_dev\app\backend\validate\Links.php
* @CustomString: Copyright (c) 2026 YwxApp
*/
declare (strict_types = 1);
namespace app\backend\validate;
use think\Validate;
class Links extends Validate
{
protected $rule = [
'title' => 'require|max:255',
'url' => 'require|url|max:255',
'logo' => 'max:255',
'description' => 'max:500',
'sort' => 'integer',
'status' => 'in:0,1',
];
protected $message = [
'title.require' => '网站标题不能为空',
'title.max' => '网站标题过长',
'url.require' => '链接地址不能为空',
'url.url' => '链接地址格式不正确',
'url.max' => '链接地址过长',
'logo.max' => 'Logo 地址过长',
'description.max' => '网站描述过长',
'sort.integer' => '排序必须为整数',
'status.in' => '状态值非法',
];
// 仅保存/完整编辑时校验标题与链接;状态开关不需要
protected $scene = [
'save' => ['title', 'url', 'logo', 'description', 'sort', 'status'],
];
}
+47
View File
@@ -0,0 +1,47 @@
<?php
/*
* @Author: YwxApp <ywx@ywxapp.cn>
* @Date: 2026-04-29 02:32:33
* @LastEditors: YwxApp <ywx@ywxapp.cn>
* @LastEditTime: 2026-07-21 23:27:10
* @Description:
* @FilePath: \ywxapp_dev\app\backend\validate\Admin.php
* @CustomString: Copyright (c) 2026 YwxApp
*/
declare (strict_types = 1);
namespace app\backend\validate;
use think\Validate;
/**
* Login 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class Login extends Validate
{
/**
* 定义验证规则
* 格式:'字段名' => ['规则1','规则2'...]
*
* @var array
*/
protected $rule = [
'username|用户名' => 'require|max:25',
'password|密码' => 'require',
'captcha|验证码' => 'require|captcha',
];
/**
* 定义错误信息
* 格式:'字段名.规则名' => '错误信息'
*
* @var array
*/
protected $message = [
'username.require' => '请输入用户名',
'username.max' => '名称最多不能超过25个字符',
'password.require' => '密码错误',
];
}
+23
View File
@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace app\backend\validate;
use think\Validate;
class Medal extends Validate
{
protected $rule = [
'title' => 'require|max:200',
'image' => 'max:255',
'sort' => 'number',
'status' => 'in:0,1',
];
protected $message = [
];
protected $scene = [
'add' => ['title', 'image', 'description', 'sort', 'status'],
'edit' => ['title', 'image', 'description', 'sort', 'status'],
];
}
+31
View File
@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace app\backend\validate;
use think\Validate;
class Notice extends Validate
{
protected $rule = [
'title' => 'require|max:200',
'content' => 'require',
'author' => 'max:50',
'type' => 'in:1,2,3,4',
'is_top' => 'in:0,1',
'start_time' => 'integer',
'end_time' => 'integer',
'sort' => 'number',
'status' => 'in:0,1',
];
protected $message = [
'title.require' => '请输入公告标题',
'content.require' => '请输入公告内容',
'type.in' => '公告类型不正确',
];
protected $scene = [
'add' => ['title', 'content', 'author', 'type', 'is_top', 'start_time', 'end_time', 'sort', 'status'],
'edit' => ['title', 'content', 'author', 'type', 'is_top', 'start_time', 'end_time', 'sort', 'status'],
];
}
+24
View File
@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace app\backend\validate;
use think\Validate;
class Prop extends Validate
{
protected $rule = [
'title' => 'require|max:200',
'icon' => 'max:255',
'price' => 'float',
'sort' => 'number',
'status' => 'in:0,1',
];
protected $message = [
];
protected $scene = [
'add' => ['title', 'icon', 'price', 'description', 'sort', 'status'],
'edit' => ['title', 'icon', 'price', 'description', 'sort', 'status'],
];
}
+50
View File
@@ -0,0 +1,50 @@
<?php
/*
* @Author: YwxApp <ywx@ywxapp.cn>
* @Date: 2026-04-29 02:32:33
* @LastEditors: YwxApp <ywx@ywxapp.cn>
* @LastEditTime: 2026-07-21 23:27:10
* @Description:
* @FilePath: \ywxapp_dev\app\backend\validate\Admin.php
* @CustomString: Copyright (c) 2026 YwxApp
*/
declare (strict_types = 1);
namespace app\backend\validate;
use think\Validate;
/**
* Role 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class Role extends Validate
{
protected $rule = [
'name' => 'require|min:2|max:50',
'code' => 'require|min:2|max:50|alphaDash',
'description' => 'max:255',
'status' => 'require|in:0,1',
];
protected $message = [
'name.require' => '角色名称不能为空',
'name.min' => '角色名称长度不能少于2个字符',
'name.max' => '角色名称长度不能超过50个字符',
'code.require' => '角色编码不能为空',
'code.min' => '角色编码长度不能少于2个字符',
'code.max' => '角色编码长度不能超过50个字符',
'code.alphaDash' => '角色编码只能包含字母、数字、下划线和破折号',
'description.max' => '角色描述长度不能超过255个字符',
'status.require' => '状态不能为空',
'status.in' => '状态值不正确',
];
// 更新场景
public function sceneUpdate()
{
return $this->append('id', 'require|number');
}
}
+32
View File
@@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace app\backend\validate;
use think\Validate;
class Score extends Validate
{
protected $rule = [
'name' => 'require|max:100',
'action' => 'max:50',
'type' => 'require|in:1,2',
'value' => 'require|integer|gt:0',
'sort' => 'number',
'status' => 'in:0,1',
];
protected $message = [
'name.require' => '请输入规则名称',
'name.max' => '规则名称最多100个字符',
'type.require' => '请选择规则类型',
'type.in' => '规则类型只能是获取或消费',
'value.require' => '请输入变动值',
'value.integer' => '变动值必须是整数',
'value.gt' => '变动值必须大于0',
];
protected $scene = [
'add' => ['name', 'action', 'type', 'value', 'sort', 'status'],
'edit' => ['name', 'action', 'type', 'value', 'sort', 'status'],
];
}
+24
View File
@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace app\backend\validate;
use think\Validate;
class Shop extends Validate
{
protected $rule = [
'title' => 'require|max:200',
'price' => 'float',
'stock' => 'number',
'sort' => 'number',
'status' => 'in:0,1',
];
protected $message = [
];
protected $scene = [
'add' => ['title', 'price', 'stock', 'description', 'sort', 'status'],
'edit' => ['title', 'price', 'stock', 'description', 'sort', 'status'],
];
}
+24
View File
@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace app\backend\validate;
use think\Validate;
class Sms extends Validate
{
protected $rule = [
'title' => 'require|max:200',
'code' => 'require|max:50',
'content' => 'require',
'sort' => 'number',
'status' => 'in:0,1',
];
protected $message = [
];
protected $scene = [
'add' => ['title', 'code', 'content', 'sort', 'status'],
'edit' => ['title', 'code', 'content', 'sort', 'status'],
];
}
+24
View File
@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace app\backend\validate;
use think\Validate;
class Task extends Validate
{
protected $rule = [
'title' => 'require|max:200',
'reward_type' => 'in:1,2,3',
'reward_num' => 'number',
'sort' => 'number',
'status' => 'in:0,1',
];
protected $message = [
];
protected $scene = [
'add' => ['title', 'description', 'reward_type', 'reward_num', 'sort', 'status'],
'edit' => ['title', 'description', 'reward_type', 'reward_num', 'sort', 'status'],
];
}
+58
View File
@@ -0,0 +1,58 @@
<?php
/*
* @Author: YwxApp <ywx@ywxapp.cn>
* @Date: 2026-04-29 02:32:33
* @LastEditors: YwxApp <ywx@ywxapp.cn>
* @LastEditTime: 2026-07-21 23:27:10
* @Description:
* @FilePath: \ywxapp_dev\app\backend\validate\Admin.php
* @CustomString: Copyright (c) 2026 YwxApp
*/
declare (strict_types = 1);
namespace app\backend\validate;
use think\Validate;
/**
* User 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class User extends Validate
{
protected $rule = [
'username' => 'require|min:3|max:20',
'nickname' => 'require|min:2|max:20',
'password' => 'require|min:6|max:20',
'email' => 'require|email',
'phone' => 'require|mobile',
'status' => 'require|in:0,1',
'roleIds' => 'array',
];
protected $message = [
'username.require' => '用户名不能为空',
'username.min' => '用户名长度不能少于3个字符',
'username.max' => '用户名长度不能超过20个字符',
'nickname.require' => '昵称不能为空',
'nickname.min' => '昵称长度不能少于2个字符',
'nickname.max' => '昵称长度不能超过20个字符',
'password.require' => '密码不能为空',
'password.min' => '密码长度不能少于6个字符',
'password.max' => '密码长度不能超过20个字符',
'email.require' => '邮箱不能为空',
'email.email' => '邮箱格式不正确',
'phone.require' => '电话不能为空',
'phone.mobile' => '电话格式不正确',
'status.require' => '状态不能为空',
'status.in' => '状态值不正确',
];
// 更新场景
public function sceneUpdate()
{
return $this->remove('password', 'require');
}
}
+57
View File
@@ -0,0 +1,57 @@
<?php
/*
* @Author: YwxApp <ywx@ywxapp.cn>
* @Date: 2026-04-29 02:32:33
* @LastEditors: YwxApp <ywx@ywxapp.cn>
* @LastEditTime: 2026-07-21 23:27:10
* @Description:
* @FilePath: \ywxapp_dev\app\backend\validate\Admin.php
* @CustomString: Copyright (c) 2026 YwxApp
*/
declare (strict_types = 1);
namespace app\backend\validate;
use think\Validate;
/**
* UserRule 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class UserRule extends Validate
{
/**
* 定义验证规则
* 格式:'字段名' => ['规则1','规则2'...]
*
* @var array
*/
protected $rule = [
'module' => 'require|max:25',
'name' => 'unique:user_rule',
'pid' => 'require|number',
'sort' => 'require|number',
'status' => 'require|number',
'title' => 'require|max:25',
'type' => 'require|number',
];
/**
* 定义错误信息
* 格式:'字段名.规则名' => '错误信息'
*
* @var array
*/
protected $message = [
'name.require' => '名称必须',
'name.max' => '名称最多不能超过25个字符',
'module.require' => '年龄必须是数字',
];
public function sceneEdit()
{
return $this->append('id', 'number');
}
}