提交其他文件
This commit is contained in:
131
app/adminapi/validate/setting/PayConfigValidate.php
Normal file
131
app/adminapi/validate/setting/PayConfigValidate.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\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',
|
||||
'name' => 'require|checkName',
|
||||
'icon' => 'require',
|
||||
'sort' => 'require|number|max:5',
|
||||
'config' => 'checkConfig',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => 'id不能为空',
|
||||
'name.require' => '支付名称不能为空',
|
||||
'icon.require' => '支付图标不能为空',
|
||||
'sort.require' => '排序不能为空',
|
||||
'sort,number' => '排序必须是纯数字',
|
||||
'sort.max' => '排序最大不能超过五位数',
|
||||
'config.require' => '支付参数缺失',
|
||||
];
|
||||
|
||||
public function sceneGet()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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 2023/2/23 16:19
|
||||
*/
|
||||
public function checkConfig($config, $rule, $data)
|
||||
{
|
||||
$result = PayConfig::where('id', $data['id'])->find();
|
||||
if (empty($result)) {
|
||||
return '支付方式不存在';
|
||||
}
|
||||
if ($result['pay_way'] != PayEnum::BALANCE_PAY && !isset($config)) {
|
||||
return '支付配置不能为空';
|
||||
}
|
||||
|
||||
if ($result['pay_way'] == PayEnum::WECHAT_PAY) {
|
||||
if (empty($config['interface_version'])) {
|
||||
return '微信支付接口版本不能为空';
|
||||
}
|
||||
if (empty($config['merchant_type'])) {
|
||||
return '商户类型不能为空';
|
||||
}
|
||||
if (empty($config['mch_id'])) {
|
||||
return '微信支付商户号不能为空';
|
||||
}
|
||||
if (empty($config['pay_sign_key'])) {
|
||||
return '商户API密钥不能为空';
|
||||
}
|
||||
if (empty($config['apiclient_cert'])) {
|
||||
return '微信支付证书不能为空';
|
||||
}
|
||||
if (empty($config['apiclient_key'])) {
|
||||
return '微信支付证书密钥不能为空';
|
||||
}
|
||||
}
|
||||
if ($result['pay_way'] == PayEnum::ALI_PAY) {
|
||||
if (empty($config['mode'])) {
|
||||
return '模式不能为空';
|
||||
}
|
||||
if (empty($config['merchant_type'])) {
|
||||
return '商户类型不能为空';
|
||||
}
|
||||
if (empty($config['app_id'])) {
|
||||
return '应用ID不能为空';
|
||||
}
|
||||
if (empty($config['private_key'])) {
|
||||
return '应用私钥不能为空';
|
||||
}
|
||||
if (empty($config['ali_public_key'])) {
|
||||
return '支付宝公钥不能为空';
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 校验支付名
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2023/2/23 16:19
|
||||
*/
|
||||
public function checkName($value, $rule, $data)
|
||||
{
|
||||
$result = PayConfig::where('name', $value)
|
||||
->where('id', '<>', $data['id'])
|
||||
->findOrEmpty();
|
||||
if (!$result->isEmpty()) {
|
||||
return '支付名称已存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
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']);
|
||||
}
|
||||
}
|
||||
58
app/adminapi/validate/setting/UserConfigValidate.php
Normal file
58
app/adminapi/validate/setting/UserConfigValidate.php
Normal 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', 'login_agreement', 'third_auth', 'wechat_auth']);
|
||||
}
|
||||
}
|
||||
51
app/adminapi/validate/setting/WebSettingValidate.php
Normal file
51
app/adminapi/validate/setting/WebSettingValidate.php
Normal file
@ -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 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'],
|
||||
'siteStatistics' => [''],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user