|
@@ -31,6 +31,14 @@ class Sms extends Api
|
|
|
if (!$mobile || !\think\Validate::regex($mobile, "^1\d{10}$")) {
|
|
|
$this->error(__('手机号不正确'));
|
|
|
}
|
|
|
+
|
|
|
+ if(!$this->apiLimit(60,10,request()->ip())){
|
|
|
+ $this->error('当前发送人数过多,请稍后再试');
|
|
|
+ };
|
|
|
+ if(!$this->apiLimit(3600,10,$mobile)){
|
|
|
+ $this->error('您的手机号发送频繁,请稍后再试');
|
|
|
+ };
|
|
|
+
|
|
|
$last = Smslib::get($mobile, $event);
|
|
|
if ($last && time() - $last['createtime'] < 60) {
|
|
|
$this->error(__('发送频繁,请稍后再试'));
|