init commit

This commit is contained in:
2026-03-17 09:56:00 +08:00
commit e2c8ae752d
6827 changed files with 1211784 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力商协会发展
// +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
// +----------------------------------------------------------------------
// | 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
// +----------------------------------------------------------------------
// | Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
// +----------------------------------------------------------------------
namespace app\api\validate\wdsxh;
use think\Validate;
class AppletUserWechat extends Validate
{
/**
* 验证规则
*/
protected $rule = [
'mobile'=>'require|checkMobile',
'nickname'=>'require',
'avatar'=>'require',
];
/**
* 提示消息
*/
protected $message = [
'mobile.require'=>'请输入手机号',
];
/**
* 验证场景
*/
protected $scene = [
'register' => ['mobile'],
];
protected function checkMobile($value,$rule,$data)
{
if (!$value || !\think\Validate::regex($value, "^1\d{10}$")) {
return '手机号格式不正确';
}
return true;
}
}

View File

@@ -0,0 +1,40 @@
<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力中小企业发展
// +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdadmin.cn All rights reserved.
// +----------------------------------------------------------------------
// | Wdadmin系统产品软件并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
// +----------------------------------------------------------------------
// | Author: MY WORLD Team <bd@maiwd.cn> www.wdadmin.cn
// +----------------------------------------------------------------------
namespace app\api\validate\wdsxh;
use think\Validate;
class CompanyGoods extends Validate
{
/**
* 验证规则
*/
protected $rule = [
'name'=>'require',
'images'=>'require',
'content'=>'require',
];
/**
* 提示消息
*/
protected $message = [
'name.require'=>'产品名称不能为空',
'images.require'=>'请选择产品图片',
'content.require'=>'产品介绍不能为空',
];
/**
* 验证场景
*/
protected $scene = [
'add' => ['name','images','content'],
'edit' => ['name','images','content'],
];
}

View File

@@ -0,0 +1,57 @@
<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力商协会发展
// +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
// +----------------------------------------------------------------------
// | 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
// +----------------------------------------------------------------------
// | Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
// +----------------------------------------------------------------------
namespace app\api\validate\wdsxh;
use app\common\library\Sms;
use think\Validate;
class WananchiUserWechat extends Validate
{
/**
* 验证规则
*/
protected $rule = [
'mobile'=>'require|checkMobile',
'captcha'=>'require|checkCaptcha'
];
/**
* 提示消息
*/
protected $message = [
'mobile.require'=>'请输入手机号',
'captcha.require'=>'请输入手机号验证码',
];
/**
* 验证场景
*/
protected $scene = [
'mobile_login' => ['mobile','captcha'],
];
protected function checkMobile($value,$rule,$data)
{
if (!$value || !\think\Validate::regex($value, "^1\d{10}$")) {
return '手机号格式不正确';
}
return true;
}
protected function checkCaptcha($value,$rule,$data)
{
if (!Sms::check($data['mobile'], $value, 'mobilelogin')) {
return '验证码不正确';
}
return true;
}
}

View File

@@ -0,0 +1,84 @@
<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力商协会发展
// +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
// +----------------------------------------------------------------------
// | 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
// +----------------------------------------------------------------------
// | Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
// +----------------------------------------------------------------------
namespace app\api\validate\wdsxh\activity;
use app\api\model\wdsxh\activity\Activity;
use think\Validate;
/**
* Class ActivityApply
* Desc 活动申请校验
* Create on 2024/3/12 10:07
* Create by wangyafang
*/
class ActivityApply extends Validate
{
/**
* 验证规则
*/
protected $rule = [
'activity_id'=>'require|checkActivityExist|checkData',
];
/**
* 提示消息
*/
protected $message = [
'activity_id.require'=>'活动id不能为空',
];
/**
* 验证场景
*/
protected $scene = [
'apply' => ['activity_id'],
];
protected function checkActivityExist($value,$rule,$data)
{
$avtivityObj = (new Activity())->get($value);
if (!$avtivityObj) {
return '活动不存在';
}
return true;
}
protected function checkData($value, $rule, $data)
{
if (isset($data['data']) && !empty($data['data'])) {
$array = $data['data'];
foreach ($array as $row) {
if ($row['required'] == 1 && ($row['value'] === '' || $row['value'] === null)) {
if ($row['type'] == 'select' || $row['type'] == 'checkbox') {
return $row['option'] . '至少选择一个';
} else {
return $row['option'];
}
}
if ($row['field'] == 'email') {
if (!$value || !\think\Validate::is($row['value'], 'email')) {
return '邮箱格式不正确';
}
}
if ($row['field'] == 'mobile') {
if (!$value || !\think\Validate::regex($row['value'], "^1\d{10}$")) {
return '手机号格式不正确';
}
}
}
}
return true;
}
}

View File

@@ -0,0 +1,52 @@
<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力商协会发展
// +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
// +----------------------------------------------------------------------
// | 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
// +----------------------------------------------------------------------
// | Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
// +----------------------------------------------------------------------
/**
* Class Refund
* Desc 活动退款校验
* Create on 2024/3/12 17:30
* Create by wangyafang
*/
namespace app\api\validate\wdsxh\activity;
use think\Validate;
class Refund extends Validate
{
/**
* 验证规则
*/
protected $rule = [
'activity_id'=>'require',
'apply_id'=>'require',
];
/**
* 提示消息
*/
protected $message = [
'activity_id.require'=>'活动id不能为空',
'apply_id.require'=>'活动报名id不能为空',
];
/**
* 验证场景
*/
protected $scene = [
'apply_refund' => ['activity_id','apply_id'],
];
}

View File

@@ -0,0 +1,50 @@
<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力商协会发展
// +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
// +----------------------------------------------------------------------
// | 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
// +----------------------------------------------------------------------
// | Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
// +----------------------------------------------------------------------
namespace app\api\validate\wdsxh\corporate;
use think\Validate;
/**
* Class ActivityApply
* Desc 活动申请校验
* Create on 2024/3/12 10:07
* Create by wangyafang
*/
class Card extends Validate
{
/**
* 验证规则
*/
protected $rule = [
'card_background_image'=>'require',
'share_title'=>'require',
'font_color'=>'require',
'name'=>'require',
'avatar'=>'require',
'image'=>'require',
];
/**
* 提示消息
*/
protected $message = [
'card_background_image.require'=>'请选择名片样式',
'share_title.require'=>'请输入分享标题',
'font_color.require'=>'请选择字体颜色',
'name.require'=>'请填写姓名',
'avatar.require'=>'请上传名片头像',
'image.require'=>'生成图片不能为空',
];
}

View File

@@ -0,0 +1,41 @@
<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力中小企业发展
// +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdadmin.cn All rights reserved.
// +----------------------------------------------------------------------
// | Wdadmin系统产品软件并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
// +----------------------------------------------------------------------
// | Author: MY WORLD Team <bd@maiwd.cn> www.wdadmin.cn
// +----------------------------------------------------------------------
namespace app\api\validate\wdsxh\institution;
use think\Validate;
class InstitutionMemberApply extends Validate
{
/**
* 验证规则
*/
protected $rule = [
'institution_id'=>'require',
'level_id'=>'require',
];
/**
* 提示消息
*/
protected $message = [
'institution_id.require'=>'请选择机构id',
'level_id.require'=>'请选择级别',
];
/**
* 验证场景
*/
protected $scene = [
'submit' => ['institution_id','level_id'],
];
}

View File

@@ -0,0 +1,256 @@
<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力商协会发展
// +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
// +----------------------------------------------------------------------
// | 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
// +----------------------------------------------------------------------
// | Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
// +----------------------------------------------------------------------
namespace app\api\validate\wdsxh\member;
use addons\wdsxh\library\Wxapp;
use think\Validate;
/**
* Class MemberApply
* Desc 入会申请校验
* Create on 2024/3/7 16:06
* Create by wangyafang
*/
class Member extends Validate
{
/**
* 验证规则
*/
protected $rule = [
'type'=>'require',
'data'=>'require|checkData',
];
/**
* 提示消息
*/
protected $message = [
'type.require'=>'请选择入会类型',
'data.require'=>'内容不能为空',
];
/**
* 验证场景
*/
protected $scene = [
'submit_information' => ['type','data'],
];
protected function checkData($value,$rule,$data)
{
//todo 腾讯校验增加开关
$security_text_switch = (new \app\admin\model\wdsxh\Config())->where('id','1')->value('security_text_switch');
$array = $value;
if ($data['type'] == '1') {
foreach ($array as $row) {
if ($row['required'] == 1 && ($row['value'] === '' || $row['value'] === null)) {
if ($row['type'] == 'select' || $row['type'] == 'checkbox') {
return $row['option'] . '至少选择一个';
} else {
return $row['option'];
}
}
if ($row['field'] == 'mobile') {
if (!$value || !\think\Validate::regex($row['value'], "^1\d{10}$")) {
return '手机号格式不正确';
}
$memberApplyId = (new \app\api\model\wdsxh\member\MemberApply())
->where('wechat_id','<>',$data['wechat_id'])
->where('mobile',$row['value'])
->value('id');
if ($memberApplyId) {
return '该手机号已被使用,请更换其他手机号!';
}
}
}
//todo 腾讯校验增加开关
if ($security_text_switch == '1' && isset($data['channel']) && $data['channel'] == 1) {
$check_text = '';
foreach ($data['data'] as $v) {
if (in_array($v['type'],['text','textarea']) && $v['field'] != 'address' && !empty($v['value'])) {
$check_text = $check_text.$v['value'];
}
}
if (!empty($check_text)) {
$openid = wdsxh_get_openid($data['wechat_id'],1);
$result = Wxapp::checkSecurityText($openid,$check_text);
if ($result != 1) {
if ($result == 2) {
return '文本内容输入不合规,请重新输入';
} else {
return 'errcode:'.$result['errcode'].',errmsg:'.$result['errmsg'];
}
}
}
unset($check_text);
}
} elseif ($data['type'] == 2) {
foreach ($array['person'] as $row) {
if ($row['required'] == 1 && ($row['value'] === '' || $row['value'] === null)) {
if ($row['type'] == 'select' || $row['type'] == 'checkbox') {
return $row['option'] . '至少选择一个';
} else {
return $row['option'];
}
}
if ($row['field'] == 'mobile') {
if (!$value || !\think\Validate::regex($row['value'], "^1\d{10}$")) {
return '手机号格式不正确';
}
$memberApplyId = (new \app\api\model\wdsxh\member\MemberApply())
->where('wechat_id','<>',$data['wechat_id'])
->where('mobile',$row['value'])
->value('id');
if ($memberApplyId) {
return '该手机号已被使用,请更换其他手机号!';
}
}
}
//todo 腾讯校验增加开关
if ($security_text_switch == '1' && isset($data['channel']) && $data['channel'] == 1) {
$check_text = '';
foreach ($array['person'] as $v) {
if (in_array($v['type'],['text','textarea']) && $v['field'] != 'address' && !empty($v['value'])) {
$check_text = $check_text.$v['value'];
}
}
if (!empty($check_text)) {
$openid = wdsxh_get_openid($data['wechat_id'],1);
$result = Wxapp::checkSecurityText($openid,$check_text);
if ($result != 1) {
if ($result == 2) {
return '文本内容输入不合规,请重新输入';
} else {
return 'errcode:'.$result['errcode'].',errmsg:'.$result['errmsg'];
}
}
}
unset($check_text);
}
foreach ($array['company'] as $row) {
if ($row['required'] == 1 && ($row['value'] === '' || $row['value'] === null)) {
if ($row['type'] == 'select' || $row['type'] == 'checkbox') {
return $row['option'] . '至少选择一个';
} else {
return $row['option'];
}
}
}
//todo 腾讯校验增加开关
if ($security_text_switch == '1' && isset($data['channel']) && $data['channel'] == 1) {
$check_text = '';
foreach ($array['company'] as $v) {
if (in_array($v['type'],['text','textarea']) && $v['field'] != 'address' && !empty($v['value'])) {
$check_text = $check_text.$v['value'];
}
}
if (!empty($check_text)) {
$openid = wdsxh_get_openid($data['wechat_id'],1);
$result = Wxapp::checkSecurityText($openid,$check_text);
if ($result != 1) {
if ($result == 2) {
return '文本内容输入不合规,请重新输入';
} else {
return 'errcode:'.$result['errcode'].',errmsg:'.$result['errmsg'];
}
}
}
unset($check_text);
}
} else {
foreach ($array['person'] as $row) {
if ($row['required'] == 1 && ($row['value'] === '' || $row['value'] === null)) {
if ($row['type'] == 'select' || $row['type'] == 'checkbox') {
return $row['option'] . '至少选择一个';
} else {
return $row['option'];
}
}
if ($row['field'] == 'mobile') {
if (!$value || !\think\Validate::regex($row['value'], "^1\d{10}$")) {
return '手机号格式不正确';
}
$memberApplyId = (new \app\api\model\wdsxh\member\MemberApply())
->where('wechat_id','<>',$data['wechat_id'])
->where('mobile',$row['value'])
->value('id');
if ($memberApplyId) {
return '该手机号已被使用,请更换其他手机号!';
}
}
}
//todo 腾讯校验增加开关
if ($security_text_switch == '1' && isset($data['channel']) && $data['channel'] == 1) {
$check_text = '';
foreach ($array['person'] as $v) {
if (in_array($v['type'],['text','textarea']) && $v['field'] != 'address' && !empty($v['value'])) {
$check_text = $check_text.$v['value'];
}
}
if (!empty($check_text)) {
$openid = wdsxh_get_openid($data['wechat_id'],1);
$result = Wxapp::checkSecurityText($openid,$check_text);
if ($result != 1) {
if ($result == 2) {
return '文本内容输入不合规,请重新输入';
} else {
return 'errcode:'.$result['errcode'].',errmsg:'.$result['errmsg'];
}
}
}
unset($check_text);
}
foreach ($array['organize'] as $row) {
if ($row['required'] == 1 && ($row['value'] === '' || $row['value'] === null)) {
if ($row['type'] == 'select' || $row['type'] == 'checkbox') {
return $row['option'] . '至少选择一个';
} else {
return $row['option'];
}
}
}
//todo 腾讯校验增加开关
if ($security_text_switch == '1' && isset($data['channel']) && $data['channel'] == 1) {
$check_text = '';
foreach ($array['organize'] as $v) {
if (in_array($v['type'],['text','textarea']) && $v['field'] != 'address' && !empty($v['value'])) {
$check_text = $check_text.$v['value'];
}
}
if (!empty($check_text)) {
$openid = wdsxh_get_openid($data['wechat_id'],1);
$result = Wxapp::checkSecurityText($openid,$check_text);
if ($result != 1) {
if ($result == 2) {
return '文本内容输入不合规,请重新输入';
} else {
return 'errcode:'.$result['errcode'].',errmsg:'.$result['errmsg'];
}
}
}
unset($check_text);
}
}
return true;
}
protected function checkMobile($value,$rule,$data)
{
if (!$value || !\think\Validate::regex($value, "^1\d{10}$")) {
return '手机号格式不正确';
}
return true;
}
}

View File

@@ -0,0 +1,258 @@
<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力商协会发展
// +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
// +----------------------------------------------------------------------
// | 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
// +----------------------------------------------------------------------
// | Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
// +----------------------------------------------------------------------
namespace app\api\validate\wdsxh\member;
use addons\wdsxh\library\Wxapp;
use think\Validate;
/**
* Class MemberApply
* Desc 入会申请校验
* Create on 2024/3/7 16:06
* Create by wangyafang
*/
class MemberApply extends Validate
{
/**
* 验证规则
*/
protected $rule = [
'type'=>'require',
'data'=>'require|checkData',
];
/**
* 提示消息
*/
protected $message = [
'type.require'=>'请选择入会类型',
'data.require'=>'内容不能为空',
];
/**
* 验证场景
*/
protected $scene = [
'submit' => ['type','data'],
];
protected function checkData($value,$rule,$data)
{
//todo 腾讯校验增加开关
$security_text_switch = (new \app\admin\model\wdsxh\Config())->where('id','1')->value('security_text_switch');
$array = $value;
if ($data['type'] == '1') {
foreach ($array as $row) {
//必填项验证
if (((isset($row['apply_show']) && $row['apply_show'] == 1) || !isset($row['apply_show'])) && $row['required'] == 1 && ($row['value'] === '' || $row['value'] === null)) {
if ($row['type'] == 'select' || $row['type'] == 'checkbox') {
return $row['option'] . '至少选择一个';
} else {
return $row['option'];
}
}
if ($row['field'] == 'mobile') {
if (!$value || !\think\Validate::regex($row['value'], "^1\d{10}$")) {
return '手机号格式不正确';
}
$memberApplyId = (new \app\api\model\wdsxh\member\MemberApply())
->where('wechat_id','<>',$data['wechat_id'])
->where('mobile',$row['value'])
->value('id');
if ($memberApplyId) {
return '该手机号已被使用,请更换其他手机号!';
}
}
}
//todo 腾讯校验增加开关
if ($security_text_switch == '1' && isset($data['channel']) && $data['channel'] == 1) {
$check_text = '';
foreach ($data['data'] as $v) {
if (in_array($v['type'],['text','textarea']) && $v['field'] != 'address' && !empty($v['value'])) {
$check_text = $check_text.$v['value'];
}
}
if (!empty($check_text)) {
$openid = wdsxh_get_openid($data['wechat_id'],1);
$result = Wxapp::checkSecurityText($openid,$check_text);
if ($result != 1) {
if ($result == 2) {
return '文本内容输入不合规,请重新输入';
} else {
return 'errcode:'.$result['errcode'].',errmsg:'.$result['errmsg'];
}
}
}
unset($check_text);
}
} elseif ($data['type'] == 2) {
foreach ($array['person'] as $row) {
if (((isset($row['apply_show']) && $row['apply_show'] == 1) || !isset($row['apply_show'])) && $row['required'] == 1 && ($row['value'] === '' || $row['value'] === null)) {
if ($row['type'] == 'select' || $row['type'] == 'checkbox') {
return $row['option'] . '至少选择一个';
} else {
return $row['option'];
}
}
if ($row['field'] == 'mobile') {
if (!$value || !\think\Validate::regex($row['value'], "^1\d{10}$")) {
return '手机号格式不正确';
}
$memberApplyId = (new \app\api\model\wdsxh\member\MemberApply())
->where('wechat_id','<>',$data['wechat_id'])
->where('mobile',$row['value'])
->value('id');
if ($memberApplyId) {
return '该手机号已被使用,请更换其他手机号!';
}
}
}
//todo 腾讯校验增加开关
if ($security_text_switch == '1' && isset($data['channel']) && $data['channel'] == 1) {
$check_text = '';
foreach ($array['person'] as $v) {
if (in_array($v['type'],['text','textarea']) && $v['field'] != 'address' && !empty($v['value'])) {
$check_text = $check_text.$v['value'];
}
}
if (!empty($check_text)) {
$openid = wdsxh_get_openid($data['wechat_id'],1);
$result = Wxapp::checkSecurityText($openid,$check_text);
if ($result != 1) {
if ($result == 2) {
return '文本内容输入不合规,请重新输入';
} else {
return 'errcode:'.$result['errcode'].',errmsg:'.$result['errmsg'];
}
}
}
unset($check_text);
}
foreach ($array['company'] as $row) {
if (((isset($row['apply_show']) && $row['apply_show'] == 1) || !isset($row['apply_show'])) && $row['required'] == 1 && ($row['value'] === '' || $row['value'] === null)) {
if ($row['type'] == 'select' || $row['type'] == 'checkbox') {
return $row['option'] . '至少选择一个';
} else {
return $row['option'];
}
}
}
//todo 腾讯校验增加开关
if ($security_text_switch == '1' && isset($data['channel']) && $data['channel'] == 1) {
$check_text = '';
foreach ($array['company'] as $v) {
if (in_array($v['type'],['text','textarea']) && $v['field'] != 'address' && !empty($v['value'])) {
$check_text = $check_text.$v['value'];
}
}
if (!empty($check_text)) {
$openid = wdsxh_get_openid($data['wechat_id'],1);
$result = Wxapp::checkSecurityText($openid,$check_text);
if ($result != 1) {
if ($result == 2) {
return '文本内容输入不合规,请重新输入';
} else {
return 'errcode:'.$result['errcode'].',errmsg:'.$result['errmsg'];
}
}
}
unset($check_text);
}
} else {
foreach ($array['person'] as $row) {
if (((isset($row['apply_show']) && $row['apply_show'] == 1) || !isset($row['apply_show'])) && $row['required'] == 1 && ($row['value'] === '' || $row['value'] === null)) {
if ($row['type'] == 'select' || $row['type'] == 'checkbox') {
return $row['option'] . '至少选择一个';
} else {
return $row['option'];
}
}
if ($row['field'] == 'mobile') {
if (!$value || !\think\Validate::regex($row['value'], "^1\d{10}$")) {
return '手机号格式不正确';
}
$memberApplyId = (new \app\api\model\wdsxh\member\MemberApply())
->where('wechat_id','<>',$data['wechat_id'])
->where('mobile',$row['value'])
->value('id');
if ($memberApplyId) {
return '该手机号已被使用,请更换其他手机号!';
}
}
}
//todo 腾讯校验增加开关
if ($security_text_switch == '1' && isset($data['channel']) && $data['channel'] == 1) {
$check_text = '';
foreach ($array['person'] as $v) {
if (in_array($v['type'],['text','textarea']) && $v['field'] != 'address' && !empty($v['value'])) {
$check_text = $check_text.$v['value'];
}
}
if (!empty($check_text)) {
$openid = wdsxh_get_openid($data['wechat_id'],1);
$result = Wxapp::checkSecurityText($openid,$check_text);
if ($result != 1) {
if ($result == 2) {
return '文本内容输入不合规,请重新输入';
} else {
return 'errcode:'.$result['errcode'].',errmsg:'.$result['errmsg'];
}
}
}
unset($check_text);
}
foreach ($array['organize'] as $row) {
if (((isset($row['apply_show']) && $row['apply_show'] == 1) || !isset($row['apply_show'])) && $row['required'] == 1 && ($row['value'] === '' || $row['value'] === null)) {
if ($row['type'] == 'select' || $row['type'] == 'checkbox') {
return $row['option'] . '至少选择一个';
} else {
return $row['option'];
}
}
}
//todo 腾讯校验增加开关
if ($security_text_switch == '1' && isset($data['channel']) && $data['channel'] == 1) {
$check_text = '';
foreach ($array['organize'] as $v) {
if (in_array($v['type'],['text','textarea']) && $v['field'] != 'address' && !empty($v['value'])) {
$check_text = $check_text.$v['value'];
}
}
if (!empty($check_text)) {
$openid = wdsxh_get_openid($data['wechat_id'],1);
$result = Wxapp::checkSecurityText($openid,$check_text);
if ($result != 1) {
if ($result == 2) {
return '文本内容输入不合规,请重新输入';
} else {
return 'errcode:'.$result['errcode'].',errmsg:'.$result['errmsg'];
}
}
}
unset($check_text);
}
}
return true;
}
protected function checkMobile($value,$rule,$data)
{
if (!$value || !\think\Validate::regex($value, "^1\d{10}$")) {
return '手机号格式不正确';
}
return true;
}
}

View File

@@ -0,0 +1,39 @@
<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力中小企业发展
// +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdadmin.cn All rights reserved.
// +----------------------------------------------------------------------
// | Wdadmin系统产品软件并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
// +----------------------------------------------------------------------
// | Author: MY WORLD Team <bd@maiwd.cn> www.wdadmin.cn
// +----------------------------------------------------------------------
namespace app\api\validate\wdsxh\points;
use think\Validate;
class Order extends Validate
{
/**
* 验证规则
*/
protected $rule = [
'goods_id'=>'require',
'address_id'=>'require',
'number'=>'require',
];
/**
* 提示消息
*/
protected $message = [
'goods_id.require'=>'商品id不能为空',
'address_id.require'=>'请选择地址',
'number.require'=>'兑换数量不能为空',
];
/**
* 验证场景
*/
protected $scene = [
'submitSettlement' => ['goods_id','address_id','number'],
];
}