初始版本
This commit is contained in:
190
server/app/coachapi/validate/CoachValidate.php
Executable file
190
server/app/coachapi/validate/CoachValidate.php
Executable file
@@ -0,0 +1,190 @@
|
||||
<?php
|
||||
namespace app\coachapi\validate;
|
||||
use app\adminapi\logic\coach\CoachLogic;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\coach\CoachUser;
|
||||
use app\common\model\skill\Skill;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 技师验证类
|
||||
* Class CoachValidate
|
||||
* @package app\adminapi\validate\coach
|
||||
*/
|
||||
class CoachValidate extends BaseValidate
|
||||
{
|
||||
|
||||
protected $rule = [
|
||||
'name' => 'require|max:64',
|
||||
'gender' => 'require|in:1,2',
|
||||
'age' => 'require',
|
||||
'id_card' => 'require|idCard',
|
||||
'education' => 'require',
|
||||
'nation' => 'require',
|
||||
'province_id' => 'require',
|
||||
'city_id' => 'require',
|
||||
// 'region_id' => 'require',
|
||||
'address_detail' => 'require',
|
||||
'skill_id' => 'require|checkSkill',
|
||||
'goods_ids' => 'require|array|checkGoods',
|
||||
'id_card_back' => 'require',
|
||||
'id_card_front' => 'require',
|
||||
'portrait_shooting' => 'require',
|
||||
// 'work_photo' => 'require',
|
||||
// 'certification' => 'require',
|
||||
// 'health_certificate'=> 'require',
|
||||
// 'life_photo' => 'require|array',
|
||||
'work_status' => 'require|in:0,1',
|
||||
'server_status' => 'require|in:0,1',
|
||||
'longitude' => 'require',
|
||||
'latitude' => 'require',
|
||||
|
||||
// 'field' => 'require|checkField',
|
||||
// 'value' => 'require',
|
||||
//
|
||||
// 'mobile' => 'require|mobile',
|
||||
// 'code' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '请选择技师',
|
||||
'name.require' => '请输入名称',
|
||||
'name.max' => '名称不能超过64个字符',
|
||||
'gender.require' => '请输入性别',
|
||||
'gender.in' => '性别错误',
|
||||
'mobile.require' => '请输入联系电话',
|
||||
'mobile.mobile' => '联系电话格式错误',
|
||||
'id_card.require' => '请输入身份证',
|
||||
'id_card.idCard' => '身份证格式错误',
|
||||
'education.require' => '请输入学历',
|
||||
'nation.require' => '请输入民族',
|
||||
'province_id.require' => '请选择省份',
|
||||
'city_id.require' => '请选择城市',
|
||||
'region_id.require' => '请选择地区',
|
||||
'address_detail.require' => '请输入详情地址',
|
||||
'skill_id.require' => '请选择技能',
|
||||
'goods_ids.require' => '请选择服务',
|
||||
'goods_ids.array' => '服务数据错误',
|
||||
'id_card_back.require' => '请上传身份证人像照',
|
||||
'id_card_front,require' => '请上传身份证国徽照',
|
||||
'portrait_shooting,require' => '请上传人像实拍照',
|
||||
'work_photo.require' => '请上传工作照',
|
||||
'work_status.require' => '请选择工作状态',
|
||||
'work_status.in' => '工作状态错误',
|
||||
'server_status.require' => '请选择服务状态',
|
||||
'server_status.in' => '服务状态错误',
|
||||
'longitude.require' => '请在地图上标记位置',
|
||||
'latitude.require' => '请在地图上标记位置',
|
||||
|
||||
'field.require' => '参数缺失',
|
||||
'value.require' => '值不存在',
|
||||
|
||||
'code.require' => '参数缺失',
|
||||
];
|
||||
public function sceneId()
|
||||
{
|
||||
return $this->only(['id'=>true]);
|
||||
}
|
||||
public function sceneApply(){
|
||||
return $this->remove(['field'=>true,'value'=>true,'code'=>true]);
|
||||
}
|
||||
public function sceneUpdate(){
|
||||
return $this->remove(['work_status'=>true,'server_status'=>true,'field'=>true,'value'=>true,'mobile'=>true,'code'=>true]);
|
||||
}
|
||||
|
||||
public function sceneSetPersonalData()
|
||||
{
|
||||
return $this->only(['field','value']);
|
||||
}
|
||||
|
||||
public function sceneBindMobile()
|
||||
{
|
||||
return $this->only(['mobile', 'code']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 验证技能
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return string|true
|
||||
* @author cjhao
|
||||
* @date 2024/8/20 17:44
|
||||
*/
|
||||
public function checkSkill($value,$rule,$data)
|
||||
{
|
||||
$skill = Skill::where(['id'=>$value])->findOrEmpty();
|
||||
if($skill->isEmpty()){
|
||||
return '服务技能不存在,请重新刷新';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return string|true
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author cjhao
|
||||
* @date 2024/8/20 18:15
|
||||
*/
|
||||
public function checkGoods($value,$rule,$data)
|
||||
{
|
||||
$shopId = 0;
|
||||
$coachId = $data['coach_id'] ?? $data['id'];
|
||||
if($coachId){
|
||||
$shopId = Coach::where(['id'=>$coachId])->value('shop_id') ?: 0;
|
||||
}
|
||||
$skillLists = (new CoachLogic())->skillLists($shopId);
|
||||
$skillLists = array_column($skillLists,null,'id');
|
||||
$goodsLists = $skillLists[$data['skill_id']]['goods_list'] ?? [];
|
||||
if(empty($goodsLists)){
|
||||
return '请选择服务';
|
||||
}
|
||||
$goodsIds = array_column($goodsLists,'id');
|
||||
foreach ($value as $id) {
|
||||
if(!in_array($id,$goodsIds)){
|
||||
return '服务数据错误,请刷新技能重新选择';
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 校验设置个人资料
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return string|true
|
||||
* @author ljj
|
||||
* @date 2024/12/3 下午3:59
|
||||
*/
|
||||
protected function checkField($value,$rule,$data)
|
||||
{
|
||||
$allowField = ['gender','introduction'];
|
||||
if(!in_array($value,$allowField)){
|
||||
return '参数错误';
|
||||
}
|
||||
switch ($value) {
|
||||
case 'mobile':
|
||||
$staff = Coach::where([
|
||||
['mobile', '=', $data['value']],
|
||||
['id', '<>', $data['coach_id']]
|
||||
])->findOrEmpty();
|
||||
if(!$staff->isEmpty()) {
|
||||
return '手机号已被绑定';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
157
server/app/coachapi/validate/LoginAccountValidate.php
Executable file
157
server/app/coachapi/validate/LoginAccountValidate.php
Executable file
@@ -0,0 +1,157 @@
|
||||
<?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\coachapi\validate;
|
||||
|
||||
use app\common\cache\CoachUserAccountSafeCache;
|
||||
use app\common\enum\coach\CoachUserTerminalEnum;
|
||||
use app\common\enum\LoginEnum;
|
||||
use app\common\enum\notice\NoticeEnum;
|
||||
use app\common\enum\YesNoEnum;
|
||||
use app\common\model\coach\CoachUser;
|
||||
use app\common\service\sms\SmsDriver;
|
||||
use app\common\validate\BaseValidate;
|
||||
use think\facade\Config;
|
||||
|
||||
/**
|
||||
* 账号密码登录校验
|
||||
* Class LoginValidate
|
||||
* @package app\coachapi\validate
|
||||
*/
|
||||
class LoginAccountValidate extends BaseValidate
|
||||
{
|
||||
|
||||
protected $rule = [
|
||||
'terminal' => 'require|in:' . CoachUserTerminalEnum::WECHAT_MMP . ',' . CoachUserTerminalEnum::WECHAT_OA . ','
|
||||
. CoachUserTerminalEnum::H5 . ',' . CoachUserTerminalEnum::PC . ',' . CoachUserTerminalEnum::IOS .
|
||||
',' . CoachUserTerminalEnum::ANDROID,
|
||||
'scene' => 'require|in:' . LoginEnum::ACCOUNT_PASSWORD . ',' . LoginEnum::MOBILE_CAPTCHA .'|checkConfig',
|
||||
'account' => 'require',
|
||||
];
|
||||
|
||||
|
||||
protected $message = [
|
||||
'terminal.require' => '终端参数缺失',
|
||||
'terminal.in' => '终端参数状态值不正确',
|
||||
'scene.require' => '场景不能为空',
|
||||
'scene.in' => '场景值错误',
|
||||
'account.require' => '请输入账号',
|
||||
'password.require' => '请输入密码',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 登录场景相关校验
|
||||
* @param $scene
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/9/15 14:37
|
||||
*/
|
||||
public function checkConfig($scene, $rule, $data)
|
||||
{
|
||||
// $config = ConfigService::get('login', 'login_way', config('project.login.login_way'));
|
||||
// if (!in_array($scene, $config)) {
|
||||
// return '不支持的登录方式';
|
||||
// }
|
||||
// 账号密码登录
|
||||
if (LoginEnum::ACCOUNT_PASSWORD == $scene) {
|
||||
if (!isset($data['password'])) {
|
||||
return '请输入密码';
|
||||
}
|
||||
return $this->checkPassword($data['password'], [], $data);
|
||||
}
|
||||
// 手机验证码登录
|
||||
if (LoginEnum::MOBILE_CAPTCHA == $scene) {
|
||||
if (!isset($data['code'])) {
|
||||
return '请输入手机验证码';
|
||||
}
|
||||
return $this->checkCode($data['code'], [], $data);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 登录密码校验
|
||||
* @param $password
|
||||
* @param $other
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author 段誉
|
||||
* @date 2022/9/15 14:39
|
||||
*/
|
||||
public function checkPassword($password, $other, $data)
|
||||
{
|
||||
//账号安全机制,连续输错后锁定,防止账号密码暴力破解
|
||||
$coachUserAccountSafeCache = new CoachUserAccountSafeCache();
|
||||
if (!$coachUserAccountSafeCache->isSafe()) {
|
||||
return '密码连续' . $coachUserAccountSafeCache->count . '次输入错误,请' . $coachUserAccountSafeCache->minute . '分钟后重试';
|
||||
}
|
||||
|
||||
$where = [];
|
||||
if ($data['scene'] == LoginEnum::ACCOUNT_PASSWORD) {
|
||||
// 手机号密码登录
|
||||
$where = ['account' => $data['account']];
|
||||
}
|
||||
|
||||
$coachUserInfo = CoachUser::where($where)
|
||||
->field(['password'])
|
||||
->findOrEmpty();
|
||||
if ($coachUserInfo->isEmpty()) {
|
||||
return '用户不存在';
|
||||
}
|
||||
|
||||
// if ($coachUserInfo['is_disable'] === YesNoEnum::YES) {
|
||||
// return '用户已禁用';
|
||||
// }
|
||||
|
||||
if (empty($coachUserInfo['password'])) {
|
||||
$coachUserAccountSafeCache->record();
|
||||
return '用户不存在';
|
||||
}
|
||||
|
||||
$passwordSalt = Config::get('project.unique_identification');
|
||||
if ($coachUserInfo['password'] !== create_password($password, $passwordSalt)) {
|
||||
$coachUserAccountSafeCache->record();
|
||||
return '密码错误';
|
||||
}
|
||||
|
||||
$coachUserAccountSafeCache->relieve();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 校验验证码
|
||||
* @param $code
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author Tab
|
||||
* @date 2021/8/25 15:43
|
||||
*/
|
||||
public function checkCode($code, $rule, $data)
|
||||
{
|
||||
$smsDriver = new SmsDriver();
|
||||
$result = $smsDriver->verify($data['account'], $code, NoticeEnum::LOGIN_CAPTCHA_STAFF);
|
||||
if ($result) {
|
||||
return true;
|
||||
}
|
||||
return '验证码错误';
|
||||
}
|
||||
}
|
||||
36
server/app/coachapi/validate/OrderValidate.php
Executable file
36
server/app/coachapi/validate/OrderValidate.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?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\coachapi\validate;
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 订单逻辑验证类
|
||||
* Class OrderValidate
|
||||
* @package app\coachapi\validate
|
||||
*/
|
||||
class OrderValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '订单id缺少'
|
||||
];
|
||||
|
||||
|
||||
|
||||
}
|
||||
83
server/app/coachapi/validate/PasswordValidate.php
Executable file
83
server/app/coachapi/validate/PasswordValidate.php
Executable file
@@ -0,0 +1,83 @@
|
||||
<?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\coachapi\validate;
|
||||
|
||||
use app\common\model\coach\CoachUser;
|
||||
use app\common\validate\BaseValidate;
|
||||
use think\facade\Config;
|
||||
|
||||
/**
|
||||
* 密码校验
|
||||
* Class PasswordValidate
|
||||
* @package app\api\validate
|
||||
*/
|
||||
class PasswordValidate extends BaseValidate
|
||||
{
|
||||
|
||||
protected $rule = [
|
||||
'mobile' => 'require|mobile',
|
||||
'code' => 'require',
|
||||
'password' => 'require|length:6,20|alphaNum',
|
||||
'password_confirm' => 'require|confirm',
|
||||
'old_password' => 'require|checkPassword'
|
||||
];
|
||||
|
||||
|
||||
protected $message = [
|
||||
'mobile.require' => '请输入手机号',
|
||||
'mobile.mobile' => '请输入正确手机号',
|
||||
'code.require' => '请填写验证码',
|
||||
'password.require' => '请输入密码',
|
||||
'password.length' => '密码须在6-25位之间',
|
||||
'password.alphaNum' => '密码须为字母数字组合',
|
||||
'password_confirm.require' => '请确认密码',
|
||||
'password_confirm.confirm' => '两次输入的密码不一致',
|
||||
'old_password.require' => '请输入原密码'
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 重置登录密码
|
||||
* @return PasswordValidate
|
||||
* @author 段誉
|
||||
* @date 2022/9/16 18:11
|
||||
*/
|
||||
public function sceneResetPassword()
|
||||
{
|
||||
return $this->only(['mobile', 'code', 'password']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 修改密码场景
|
||||
* @return PasswordValidate
|
||||
* @author 段誉
|
||||
* @date 2022/9/20 19:14
|
||||
*/
|
||||
public function sceneChangePassword()
|
||||
{
|
||||
return $this->only(['password', 'password_confirm','old_password']);
|
||||
}
|
||||
|
||||
public function checkPassword($value,$rule,$data)
|
||||
{
|
||||
$passwordSalt = Config::get('project.unique_identification');
|
||||
$coachUserInfo = CoachUser::where(['id'=>$data['coach_info']['coach_user_id']])->findOrEmpty();
|
||||
if ($coachUserInfo['password'] !== create_password($value, $passwordSalt)) {
|
||||
return '原密码错误';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
119
server/app/coachapi/validate/PayValidate.php
Executable file
119
server/app/coachapi/validate/PayValidate.php
Executable file
@@ -0,0 +1,119 @@
|
||||
<?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\coachapi\validate;
|
||||
|
||||
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\model\deposit\DepositOrder;
|
||||
use app\common\model\order\Order;
|
||||
use app\common\model\order\OrderAppend;
|
||||
use app\common\model\order\OrderGap;
|
||||
use app\common\model\RechargeOrder;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
class PayValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'from' => 'require',
|
||||
'pay_way' => 'require|in:' . PayEnum::BALANCE_PAY . ',' . PayEnum::WECHAT_PAY . ',' . PayEnum::ALI_PAY,
|
||||
'order_id' => 'require|checkOrderId',
|
||||
'scene' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'from.require' => '参数缺失',
|
||||
'pay_way.require' => '支付方式参数缺失',
|
||||
'pay_way.in' => '支付方式参数错误',
|
||||
'order_id.require' => '订单参数缺失',
|
||||
'scene.require' => '场景参数缺失',
|
||||
];
|
||||
|
||||
public function scenePayway()
|
||||
{
|
||||
return $this->only(['scene']);
|
||||
}
|
||||
|
||||
public function scenePrepay()
|
||||
{
|
||||
return $this->only(['from', 'pay_way', 'order_id'])
|
||||
->append('order_id','checkOrder');
|
||||
}
|
||||
|
||||
public function sceneGetPayResult()
|
||||
{
|
||||
return $this->only(['from', 'order_id'])
|
||||
->remove('order_id','checkOrderId');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 检验订单id
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author ljj
|
||||
* @date 2022/2/28 5:58 下午
|
||||
*/
|
||||
public function checkOrderId($value,$rule,$data)
|
||||
{
|
||||
switch ($data['from']) {
|
||||
case 'deposit':
|
||||
$result = DepositOrder::where('id',$value)->findOrEmpty()->toArray();
|
||||
break;
|
||||
default :
|
||||
$result = [];
|
||||
}
|
||||
if (empty($result)) {
|
||||
return '订单不存在';
|
||||
}
|
||||
if ($result['pay_status'] == PayEnum::ISPAID) {
|
||||
return '订单已支付';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 检验订单状态
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
* @author ljj
|
||||
* @date 2022/2/28 6:02 下午
|
||||
*/
|
||||
public function checkOrder($value,$rule,$data)
|
||||
{
|
||||
switch ($data['from']) {
|
||||
case 'deposit':
|
||||
$result = DepositOrder::where('id',$value)->findOrEmpty()->toArray();
|
||||
// if ($result['order_status'] == OrderEnum::ORDER_STATUS_CLOSE) {
|
||||
// return '订单已关闭';
|
||||
// }
|
||||
if ($result['pay_status'] == PayEnum::ISPAID) {
|
||||
return '订单已支付';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
47
server/app/coachapi/validate/RegisterValidate.php
Executable file
47
server/app/coachapi/validate/RegisterValidate.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?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\coachapi\validate;
|
||||
|
||||
|
||||
use app\common\model\coach\CoachUser;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 注册验证器
|
||||
* Class RegisterValidate
|
||||
* @package app\api\validate
|
||||
*/
|
||||
class RegisterValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
// 'channel' => 'require',
|
||||
'account' => 'require|alphaNum|length:3,12|unique:' . CoachUser::class,
|
||||
'password' => 'require|length:6,20|alphaNum',
|
||||
// 'password_confirm' => 'require|confirm'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'channel.require' => '注册来源参数缺失',
|
||||
'account.require' => '请输入账号',
|
||||
'account.alphaNum' => '账号须为字母数字组合',
|
||||
'account.length' => '账号须为3-12位之间',
|
||||
'account.unique' => '账号已存在',
|
||||
'password.require' => '请输入密码',
|
||||
'password.length' => '密码须在6-20位之间',
|
||||
'password.alphaNum' => '密码须为字母数字组合',
|
||||
// 'password_confirm.require' => '请确认密码',
|
||||
// 'password_confirm.confirm' => '两次输入的密码不一致'
|
||||
];
|
||||
|
||||
}
|
||||
51
server/app/coachapi/validate/SendSmsValidate.php
Executable file
51
server/app/coachapi/validate/SendSmsValidate.php
Executable 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\coachapi\validate;
|
||||
|
||||
|
||||
use app\common\enum\notice\NoticeEnum;
|
||||
use app\common\enum\SmsEnum;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 短信验证
|
||||
* Class SmsValidate
|
||||
* @package app\api\validate
|
||||
*/
|
||||
class SendSmsValidate extends BaseValidate
|
||||
{
|
||||
|
||||
protected $rule = [
|
||||
'mobile' => 'require|mobile',
|
||||
'scene' => 'require|checkScene',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'mobile.require' => '请输入手机号',
|
||||
'mobile.mobile' => '请输入正确手机号',
|
||||
'scene.require' => '请输入场景值',
|
||||
'scene.in' => '场景值错误',
|
||||
];
|
||||
|
||||
public function checkScene($value)
|
||||
{
|
||||
$scene = NoticeEnum::getSceneByCoachTag($value);
|
||||
if(empty($scene)){
|
||||
return '场景值错误';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
40
server/app/coachapi/validate/WechatValidate.php
Executable file
40
server/app/coachapi/validate/WechatValidate.php
Executable file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | LikeShop有特色的全开源社交分销电商系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 商业用途务必购买系统授权,以免引起不必要的法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | 微信公众号:好象科技
|
||||
// | 访问官网:http://www.likemarket.net
|
||||
// | 访问社区:http://bbs.likemarket.net
|
||||
// | 访问手册:http://doc.likemarket.net
|
||||
// | 好象科技开发团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: LikeShopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\coachapi\validate;
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 微信验证器
|
||||
* Class WechatValidate
|
||||
* @package app\api\validate
|
||||
*/
|
||||
class WechatValidate extends BaseValidate
|
||||
{
|
||||
public $rule = [
|
||||
'url' => 'require'
|
||||
];
|
||||
|
||||
public $message = [
|
||||
'url.require' => '请提供url'
|
||||
];
|
||||
|
||||
public function sceneJsConfig()
|
||||
{
|
||||
return $this->only(['url']);
|
||||
}
|
||||
}
|
||||
25
server/app/coachapi/validate/WithdrawalApplyValidate.php
Executable file
25
server/app/coachapi/validate/WithdrawalApplyValidate.php
Executable file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace app\coachapi\validate;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 提现审核列验证器
|
||||
* Class WithdrawalApplyValidate
|
||||
* @package app\coachapi\validate
|
||||
*/
|
||||
class WithdrawalApplyValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'money' => 'require',
|
||||
'apply_type' => 'require|in:1,2,3'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'money.require' => '请输入金额',
|
||||
'apply_type.require' => '请选择提现方式',
|
||||
'apply_type.in' => '提现方式错误'
|
||||
];
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user