Compare commits
No commits in common. "51c3ff56dabf07670ff031c41c973309f75087b9" and "2c9ea13f99735400f75866c13732d2982e225948" have entirely different histories.
51c3ff56da
...
2c9ea13f99
|
@ -16,7 +16,6 @@ namespace app\api\validate;
|
||||||
|
|
||||||
use app\common\enum\notice\NoticeEnum;
|
use app\common\enum\notice\NoticeEnum;
|
||||||
use app\common\model\user\User;
|
use app\common\model\user\User;
|
||||||
use app\common\service\JsonService;
|
|
||||||
use app\common\service\sms\SmsDriver;
|
use app\common\service\sms\SmsDriver;
|
||||||
use app\common\validate\BaseValidate;
|
use app\common\validate\BaseValidate;
|
||||||
|
|
||||||
|
@ -49,31 +48,4 @@ class RegisterValidate extends BaseValidate
|
||||||
'password_confirm.require' => '请确认密码',
|
'password_confirm.require' => '请确认密码',
|
||||||
'password_confirm.confirm' => '两次输入的密码不一致'
|
'password_confirm.confirm' => '两次输入的密码不一致'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function goCheck($scene = null, array $validateData = []): array
|
|
||||||
{
|
|
||||||
//接收参数
|
|
||||||
if ($this->method == 'GET') {
|
|
||||||
$params = request()->get();
|
|
||||||
} else {
|
|
||||||
$params = request()->post();
|
|
||||||
}
|
|
||||||
//合并验证参数
|
|
||||||
$params = array_merge($params, $validateData);
|
|
||||||
|
|
||||||
//场景
|
|
||||||
if ($scene) {
|
|
||||||
$result = $this->scene($scene)->check($params);
|
|
||||||
} else {
|
|
||||||
$result = $this->check($params);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$result) {
|
|
||||||
$exception = is_array($this->error) ? implode(';', $this->error) : $this->error;
|
|
||||||
$data = $exception == '手机号已存在' ? ['has_register'=>1] : [];
|
|
||||||
JsonService::throw($exception,$data);
|
|
||||||
}
|
|
||||||
// 3.成功返回数据
|
|
||||||
return $params;
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue