first commit

This commit is contained in:
2020-08-06 15:26:41 +08:00
commit 8c0aa3edc1
1416 changed files with 238374 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
<?php
// +------------------------------------------------+
// |http://www.cjango.com |
// +------------------------------------------------+
// | 修复BUG不是一朝一夕的事情等我喝醉了再说吧 |
// +------------------------------------------------+
// | Author: 小陈叔叔 <Jason.Chen> |
// +------------------------------------------------+
namespace app\common\validate;
use think\Db;
use think\Validate;
use tools\Verify;
class Sms extends Validate
{
/**
* 验证规则
* @var array
*/
protected $rule = [
'mobile' => 'require|checkMobile:|checkTimes:',
'code' => 'require|length:4,6',
];
/**
* 错误提示消息
* @var array
*/
protected $message = [
'mobile.require' => '手机号码 必须填写',
'mobile.checkMobile' => '手机号码 格式有误',
'code.require' => '验证码 必须填写',
'code.length' => '验证码 长度有误',
];
protected $scene = [
];
protected function checkTimes($value)
{
if (time() - Db::name('Sms')->where('mobile', $value)->order('id desc')->value('create_time') < 60) {
return '发送频率过快';
} else {
return true;
}
}
protected function checkMobile($value)
{
return Verify::isMobilePhone($value);
}
}