初始版本
This commit is contained in:
100
server/app/adminapi/validate/setting/AdminValidate.php
Executable file
100
server/app/adminapi/validate/setting/AdminValidate.php
Executable file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\setting;
|
||||
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\validate\BaseValidate;
|
||||
use think\facade\Config;
|
||||
|
||||
class AdminValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'admin_id' => 'require',
|
||||
'avatar' => 'require',
|
||||
'name' => 'require',
|
||||
'account' => 'require|checkAccount',
|
||||
'password' => 'length:6,32|checkPassword',
|
||||
'new_password' => 'requireWith:password|length:6,32',
|
||||
'confirm_password' => 'requireWith:password|confirm:new_password',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'admin_id.require' => '参数错误',
|
||||
'avatar.require' => '请选择头像',
|
||||
'account.require' => '请输入账号',
|
||||
'name.require' => '请输入名称',
|
||||
'password.length' => '当前密码长度须在6-32位字符',
|
||||
'new_password.requireWith' => '修改密码时新的密码必填',
|
||||
'new_password.length' => '新的密码长度须在6-32位字符',
|
||||
'confirm_password.requireWith' => '修改密码时确认密码必填',
|
||||
'confirm_password.confirm' => '确认密码与新密码不匹配',
|
||||
];
|
||||
|
||||
|
||||
public function sceneSetAdmin()
|
||||
{
|
||||
return $this->only(['admin_id','avatar','account','name','password','new_password','confirm_password']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 检验账号是否被占用
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author ljj
|
||||
* @date 2022/4/18 2:45 下午
|
||||
*/
|
||||
public function checkAccount($value, $rule, $data)
|
||||
{
|
||||
$where[] = ['account', '=', $value];
|
||||
$where[] = ['id', '<>', $data['admin_id']];
|
||||
$admin = Admin::where($where)->findOrEmpty();
|
||||
if (!$admin->isEmpty()) {
|
||||
return '账号已被占用';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 检验当前密码是否正确
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author ljj
|
||||
* @date 2022/4/18 3:05 下午
|
||||
*/
|
||||
public function checkPassword($value, $rule, $data)
|
||||
{
|
||||
$passwordSalt = Config::get('project.unique_identification');
|
||||
$password = create_password($value, $passwordSalt);
|
||||
$where[] = ['password', '=', $password];
|
||||
$where[] = ['id', '=', $data['admin_id']];
|
||||
$admin = Admin::where($where)->findOrEmpty();
|
||||
if ($admin->isEmpty()) {
|
||||
return '当前密码不正确';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
154
server/app/adminapi/validate/setting/CityValidate.php
Executable file
154
server/app/adminapi/validate/setting/CityValidate.php
Executable file
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\setting;
|
||||
|
||||
|
||||
use app\common\model\city\City;
|
||||
use app\common\model\Region;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
class CityValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require|checkId',
|
||||
'city_id' => 'require|checkCity',
|
||||
'taxi' => 'require|in:0,1|checkTaxi',
|
||||
'bus' => 'require|in:0,1|checkBus',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '参数错误',
|
||||
'city_id.require' => '请选择城市',
|
||||
'taxi.require' => '请选择滴滴/出租状态',
|
||||
'taxi.in' => '滴滴/出租状态错误',
|
||||
'bus.require' => '请选择公交/地铁状态',
|
||||
'bus.in' => '公交/地铁状态错误',
|
||||
];
|
||||
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove(['id'=>true]);
|
||||
}
|
||||
|
||||
|
||||
public function sceneId()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 检验ID
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author ljj
|
||||
* @date 2022/2/8 4:32 下午
|
||||
*/
|
||||
public function checkId($value,$rule,$data)
|
||||
{
|
||||
|
||||
$result = City::where('id',$value)->findOrEmpty();
|
||||
if ($result->isEmpty()) {
|
||||
return '数据不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 检验名称
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author ljj
|
||||
* @date 2022/2/8 4:36 下午
|
||||
*/
|
||||
public function checkCity($value,$rule,$data)
|
||||
{
|
||||
$cityWhere[] = ['city_id','=',$value];
|
||||
if(isset($data['id'])){
|
||||
$cityWhere[] = ['id','<>',$data['id']];
|
||||
}
|
||||
$city = City::where($cityWhere)->findOrEmpty();
|
||||
if(!$city->isEmpty()){
|
||||
return '该城市已添加';
|
||||
}
|
||||
$city = Region::where(['id'=>$value])->findOrEmpty();
|
||||
if($city->isEmpty()){
|
||||
return '城市不存在,请重新选择';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 验证出租车价格
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return string|true
|
||||
* @author cjhao
|
||||
* @date 2024/8/27 13:14
|
||||
*/
|
||||
public function checkTaxi($value,$rule,$data)
|
||||
{
|
||||
if(!$data['taxi']){
|
||||
return true;
|
||||
}
|
||||
if('' == $data['start_km'] && $data['start_km'] < 0){
|
||||
return '请输入起步里程数';
|
||||
}
|
||||
if( '' == $data['start_price'] && $data['start_price'] < 0){
|
||||
return '请输入起步价格';
|
||||
}
|
||||
if('' == $data['continue_price'] && $data['continue_price'] < 0){
|
||||
return '请输入每增加1公里价格';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 验证出租车价格
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return string|true
|
||||
* @author cjhao
|
||||
* @date 2024/8/27 13:14
|
||||
*/
|
||||
public function checkBus($value,$rule,$data)
|
||||
{
|
||||
if(!$data['bus']){
|
||||
return true;
|
||||
}
|
||||
if('' == $data['bus_start_time']){
|
||||
return '请输入公交/地铁开启时间';
|
||||
}
|
||||
if( '' == $data['bus_end_time'] ){
|
||||
return '请输入公交/地铁结束时间';
|
||||
}
|
||||
if('' == $data['bus_fare'] && $data['continue_price'] < 0){
|
||||
return '请输入固定车费';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
82
server/app/adminapi/validate/setting/MapKeyValidate.php
Executable file
82
server/app/adminapi/validate/setting/MapKeyValidate.php
Executable file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\setting;
|
||||
|
||||
use app\common\enum\MapKeyEnum;
|
||||
use app\common\model\MapKey;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
class MapKeyValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'key' => 'require|checkKey',
|
||||
'type' => 'require|in:'.MapKeyEnum::TYPE_TENCENT,
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '参数错误',
|
||||
'key.require' => '请输入key',
|
||||
'type.require' => '请选择类型',
|
||||
'type.in' => '类型值错误',
|
||||
];
|
||||
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['key','type']);
|
||||
}
|
||||
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','key','type']);
|
||||
}
|
||||
|
||||
public function sceneDel()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 校验key
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return string|true
|
||||
* @author ljj
|
||||
* @date 2024/11/5 下午2:04
|
||||
*/
|
||||
public function checkKey($value,$rule,$data)
|
||||
{
|
||||
$where[] = ['key','=',$value];
|
||||
if (isset($data['id'])) {
|
||||
$where[] = ['id','<>',$data['id']];
|
||||
}
|
||||
$result = MapKey::where($where)->findOrEmpty();
|
||||
if (!$result->isEmpty()) {
|
||||
return 'key已存在,请重新输入';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
127
server/app/adminapi/validate/setting/PayConfigValidate.php
Executable file
127
server/app/adminapi/validate/setting/PayConfigValidate.php
Executable file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\setting;
|
||||
|
||||
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\model\pay\PayConfig;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
class PayConfigValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require|checkId',
|
||||
'name' => 'require|checkName',
|
||||
'image' => 'require',
|
||||
'sort' => 'require|number|max:5',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '参数错误',
|
||||
'name.require' => '支付名称不能为空',
|
||||
'image.require' => '支付图标不能为空',
|
||||
'sort.require' => '排序不能为空',
|
||||
'sort,number' => '排序必须是纯数字',
|
||||
'sort.max' => '排序最大不能超过五位数',
|
||||
];
|
||||
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','name','image','sort']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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 ljj
|
||||
* @date 2022/2/15 6:09 下午
|
||||
*/
|
||||
public function checkId($value,$rule,$data)
|
||||
{
|
||||
$result = PayConfig::where('id',$value)->find();
|
||||
if (empty($result)) {
|
||||
return '支付方式不存在';
|
||||
}
|
||||
if ($result['pay_way'] == PayEnum::WECHAT_PAY) {
|
||||
if (!isset($data['interface_version']) || empty($data['interface_version'])) {
|
||||
return '微信支付接口版本不能为空';
|
||||
}
|
||||
if (!isset($data['merchant_type']) || empty($data['merchant_type'])) {
|
||||
return '商户类型不能为空';
|
||||
}
|
||||
if (!isset($data['mch_id']) || empty($data['mch_id'])) {
|
||||
return '微信支付商户号不能为空';
|
||||
}
|
||||
if (!isset($data['pay_sign_key']) || empty($data['pay_sign_key'])) {
|
||||
return '商户API密钥不能为空';
|
||||
}
|
||||
if (!isset($data['apiclient_cert']) || empty($data['apiclient_cert'])) {
|
||||
return '微信支付证书不能为空';
|
||||
}
|
||||
if (!isset($data['apiclient_key']) || empty($data['apiclient_key'])) {
|
||||
return '微信支付证书密钥不能为空';
|
||||
}
|
||||
}
|
||||
if ($result['pay_way'] == PayEnum::ALI_PAY) {
|
||||
// if (!isset($data['mode']) || empty($data['mode'])) {
|
||||
// return '模式不能为空';
|
||||
// }
|
||||
if (!isset($data['merchant_type']) || empty($data['merchant_type'])) {
|
||||
return '商户类型不能为空';
|
||||
}
|
||||
if (!isset($data['app_id']) || empty($data['app_id'])) {
|
||||
return '应用ID不能为空';
|
||||
}
|
||||
if (!isset($data['private_key']) || empty($data['private_key'])) {
|
||||
return '应用私钥不能为空';
|
||||
}
|
||||
if (!isset($data['ali_public_key']) || empty($data['ali_public_key'])) {
|
||||
return '支付宝公钥不能为空';
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 检查支付名称是否已存在
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author ljj
|
||||
* @date 2022/2/15 6:09 下午
|
||||
*/
|
||||
public function checkName($value,$rule,$data)
|
||||
{
|
||||
$result = PayConfig::where('name', $value)->where('id','<>', $data['id'])->findOrEmpty();
|
||||
if (!$result->isEmpty()) {
|
||||
return '支付名称已存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
70
server/app/adminapi/validate/setting/StorageValidate.php
Executable file
70
server/app/adminapi/validate/setting/StorageValidate.php
Executable 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']);
|
||||
}
|
||||
}
|
||||
28
server/app/adminapi/validate/setting/TextValidate.php
Executable file
28
server/app/adminapi/validate/setting/TextValidate.php
Executable file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
namespace app\adminapi\validate\setting;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
class TextValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'title' => 'require',
|
||||
'content' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '请选择文本',
|
||||
'title.require' => '请输入标题',
|
||||
'content.require' => '请输入内容'
|
||||
];
|
||||
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove(['id'=>true]);
|
||||
}
|
||||
|
||||
public function sceneId()
|
||||
{
|
||||
return $this->only(['id'=>'require']);
|
||||
}
|
||||
}
|
||||
56
server/app/adminapi/validate/setting/TransactionSettingsValidate.php
Executable file
56
server/app/adminapi/validate/setting/TransactionSettingsValidate.php
Executable file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\setting;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
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',
|
||||
'is_auth_dispatch' => 'require|in:0,1',
|
||||
];
|
||||
|
||||
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',
|
||||
|
||||
'is_auth_dispatch.require' => '请选择是否系统随机派单',
|
||||
'is_auth_dispatch.in' => '系统随机派单状态值有误',
|
||||
];
|
||||
|
||||
public function sceneSetConfig()
|
||||
{
|
||||
return $this->only(['cancel_unpaid_orders','cancel_unpaid_orders_times','verification_orders','verification_orders_times','is_auth_dispatch']);
|
||||
}
|
||||
}
|
||||
58
server/app/adminapi/validate/setting/UserConfigValidate.php
Executable file
58
server/app/adminapi/validate/setting/UserConfigValidate.php
Executable file
@@ -0,0 +1,58 @@
|
||||
<?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',
|
||||
];
|
||||
|
||||
|
||||
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' => '政策协议值错误',
|
||||
];
|
||||
|
||||
//用户设置验证
|
||||
public function sceneUser()
|
||||
{
|
||||
return $this->only(['default_avatar']);
|
||||
}
|
||||
|
||||
//注册验证
|
||||
public function sceneRegister()
|
||||
{
|
||||
return $this->only(['login_way', 'coerce_mobile', 'third_auth', 'wechat_auth']);
|
||||
}
|
||||
}
|
||||
85
server/app/adminapi/validate/setting/WebSettingValidate.php
Executable file
85
server/app/adminapi/validate/setting/WebSettingValidate.php
Executable file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\setting;
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
use WpOrg\Requests\Requests;
|
||||
|
||||
/**
|
||||
* 网站设置验证器
|
||||
* 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|max:30',
|
||||
'shop_logo' => 'require',
|
||||
'document_status' => 'require|in:0,1|checkDocumentStatus',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'name.require' => '请填写网站名称',
|
||||
'name.max' => '网站名称最长为30个字符',
|
||||
'web_favicon.require' => '请上传网站图标',
|
||||
'web_logo.require' => '请上传网站logo',
|
||||
'login_image.require' => '请上传登录页广告图',
|
||||
'shop_name.require' => '请填写商城名称',
|
||||
'shop_name.max' => '商城名称最长为30个字符',
|
||||
'shop_logo.require' => '请上传商城logo',
|
||||
'document_status.require' => '请选择文档信息开关',
|
||||
'document_status.in' => '文档信息值错误',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'website' => ['name', 'web_favicon', 'web_logo', 'login_image','shop_name','shop_logo','document_status'],
|
||||
];
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @notes 校验产品授权
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author ljj
|
||||
* @date 2023/5/16 11:25 上午]
|
||||
*/
|
||||
public function checkDocumentStatus($value,$rule,$data)
|
||||
{
|
||||
if ($value == 0) {
|
||||
$check_domain = config('project.check_domain');
|
||||
$product_code = config('project.product_code');
|
||||
$domain = $_SERVER['HTTP_HOST'];
|
||||
$result = Requests::get($check_domain.'/api/version/productAuth?code='.$product_code.'&domain='.$domain);
|
||||
$result = json_decode($result->body,true);
|
||||
if (!$result['data']['result']) {
|
||||
return '产品未授权,要去官网授权才能操作';
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
101
server/app/adminapi/validate/setting/upgrade/UpgradeValidate.php
Executable file
101
server/app/adminapi/validate/setting/upgrade/UpgradeValidate.php
Executable file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\setting\upgrade;
|
||||
|
||||
use app\adminapi\logic\setting\system\UpgradeLogic;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 系统更新
|
||||
* Class UpgradeValidate
|
||||
* @package app\adminapi\validate
|
||||
*/
|
||||
class UpgradeValidate extends BaseValidate
|
||||
{
|
||||
|
||||
protected $rule = [
|
||||
'id' => 'require|checkIsAbleUpgrade',
|
||||
'update_type' => 'require|eg:1'
|
||||
];
|
||||
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '参数缺失',
|
||||
'update_type.require' => '参数缺失',
|
||||
'update_type.eg' => '更新类型错误',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 检查是否可以更新
|
||||
* @param $value
|
||||
* @param $reule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2021/8/14 16:22
|
||||
*/
|
||||
protected function checkIsAbleUpgrade($value, $reule, $data)
|
||||
{
|
||||
//本地更新版本号
|
||||
$localVersionData = local_version();
|
||||
$localVersionNo = $localVersionData['version'];
|
||||
|
||||
|
||||
//目标更新版本信息
|
||||
$targetVersionData = UpgradeLogic::getVersionDataById($data['id']);
|
||||
|
||||
if (empty($targetVersionData)) {
|
||||
return '未获取到对应版本信息';
|
||||
}
|
||||
|
||||
//目标更新的版本号
|
||||
$targetVersionNo = $targetVersionData['version_no'];
|
||||
|
||||
|
||||
//本地版本需要小于目标更新版本
|
||||
if ($localVersionNo > $targetVersionNo) {
|
||||
return '当前系统无法升级到该版本,请重新选择更新版本。';
|
||||
}
|
||||
|
||||
//获取远程列表
|
||||
$remoteData = UpgradeLogic::getRemoteVersion()['lists'] ?? [];
|
||||
if (empty($remoteData)) {
|
||||
return '获取更新数据失败';
|
||||
}
|
||||
|
||||
//是否满足升级
|
||||
foreach ($remoteData as $k => $item) {
|
||||
if ($item['version_no'] != $localVersionNo) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (empty($remoteData[$k - 1])) {
|
||||
return '已为最新版本';
|
||||
}
|
||||
|
||||
if ($remoteData[$k - 1]['version_no'] != $targetVersionNo) {
|
||||
return '当前系统无法升级到该版本,请重新选择更新版本。';
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
65
server/app/adminapi/validate/setting/upgrade/downloadPkgValidate.php
Executable file
65
server/app/adminapi/validate/setting/upgrade/downloadPkgValidate.php
Executable file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\setting\upgrade;
|
||||
|
||||
|
||||
use app\adminapi\logic\setting\system\UpgradeLogic;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 系统更新-获取更新包链接
|
||||
* Class UpgradeValidate
|
||||
* @package app\adminapi\validate
|
||||
*/
|
||||
class downloadPkgValidate extends BaseValidate
|
||||
{
|
||||
|
||||
protected $rule = [
|
||||
'id' => 'require|checkVersionData',
|
||||
'update_type' => 'require'
|
||||
];
|
||||
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '参数缺失',
|
||||
'update_type.require' => '参数缺失',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 验证版本信息
|
||||
* @param $value
|
||||
* @param $reule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2021/10/9 15:05
|
||||
*/
|
||||
protected function checkVersionData($value, $reule, $data)
|
||||
{
|
||||
//目标更新版本信息
|
||||
$targetVersionData = UpgradeLogic::getVersionDataById($value);
|
||||
|
||||
if (empty($targetVersionData)) {
|
||||
return '未获取到对应版本信息';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user