rabin 3 месяцев назад
Родитель
Сommit
caa74ad412
6 измененных файлов с 13 добавлено и 13 удалено
  1. 1 1
      api/Task.php
  2. 1 1
      lib/Method/Email.php
  3. 1 1
      lib/Method/Sms.php
  4. 3 3
      lib/Template.php
  5. 6 6
      lib/Type/Code.php
  6. 1 1
      lib/Type/Notify.php

+ 1 - 1
api/Task.php

@@ -7,7 +7,7 @@ class Task
     {
         # 删除1个月前的数据
         list($start, $end) = Date::month(1);
-        $where['cdate'] = array('<=', $end);
+        $where['cdate'] = ['<=', $end];
         Dever::db('code', 'sms')->delete($where);
         Dever::db('notify', 'sms')->delete($where);
     }

+ 1 - 1
lib/Method/Email.php

@@ -13,7 +13,7 @@ class Email
         if (empty($account['email'])) {
             Dever::error('账户不存在');
         }
-        $this->config = Dever::db('template_email', 'msg')->find(array('template_id' => $template_id));
+        $this->config = Dever::db('template_email', 'msg')->find(['template_id' => $template_id]);
         if (!$this->config) {
             Dever::error('邮件配置不存在');
         }

+ 1 - 1
lib/Method/Sms.php

@@ -10,7 +10,7 @@ class Sms
         if (empty($account['mobile'])) {
             Dever::error('账户不存在');
         }
-        $this->config = Dever::db('template_sms', 'msg')->find(array('template_id' => $template_id));
+        $this->config = Dever::db('template_sms', 'msg')->find(['template_id' => $template_id]);
         if (!$this->config) {
             Dever::error('短信配置不存在');
         }

+ 3 - 3
lib/Template.php

@@ -3,9 +3,9 @@ use Dever;
 class Template
 {
     # 发送消息
-    public function send($template, $account, $param = array())
+    public function send($template, $account, $param = [])
     {
-        $template = Dever::db('template', 'msg')->find(array('key' => $template));
+        $template = Dever::db('template', 'msg')->find(['key' => $template]);
         if (!$template) {
             Dever::error('消息模板不存在');
         }
@@ -21,7 +21,7 @@ class Template
     # 验证码检查
     public function check($template, $account, $code, $update = 1)
     {
-        $template = Dever::db('template', 'msg')->find(array('key' => $template));
+        $template = Dever::db('template', 'msg')->find(['key' => $template]);
         if (!$template) {
             Dever::error('消息模板不存在');
         }

+ 6 - 6
lib/Type/Code.php

@@ -4,9 +4,9 @@ class Code
 {
     private $config;
     # 发送验证码
-    public function send($template, $account, $param = array())
+    public function send($template, $account, $param = [])
     {
-        $this->config = Dever::db('template_code', 'msg')->find(array('template_id' => $template['id']));
+        $this->config = Dever::db('template_code', 'msg')->find(['template_id' => $template['id']]);
         if (!$this->config) {
             Dever::error('验证码未配置');
         }
@@ -21,7 +21,7 @@ class Code
             $data['account'] = $handle->init($template['id'], $account);
             $this->valid($data);
             if ($template['status'] == 1) {
-                $data['record'] = $handle->send($template['content'], array('code' => $code));
+                $data['record'] = $handle->send($template['content'], ['code' => $code]);
             }
             $data['code'] = $code;
             $data['status'] = 1;
@@ -37,10 +37,10 @@ class Code
     # 检测并使用验证码
     public function check($template_id, $account, $code, $update = 1)
     {
-        $info = Dever::db('code', 'msg')->find(array('template_id' => $template_id, 'account' => $account), array('order' => 'cdate desc'));
+        $info = Dever::db('code', 'msg')->find(['template_id' => $template_id, 'account' => $account], ['order' => 'cdate desc']);
         if ($info && $info['status'] == 1 && $code == $info['code']) {
             if ($update == 1) {
-                Dever::db('code', 'msg')->update($info['id'], array('status' => 2));
+                Dever::db('code', 'msg')->update($info['id'], ['status' => 2]);
             }
             return true;
         }
@@ -61,7 +61,7 @@ class Code
             if (DEVER_TIME - $this->config['cdate'] < $this->config['interval']) {
                 Dever::error('请不要在'.$this->config['interval'].'秒之内申请多次验证码,请您稍后再试');
             } elseif (Dever::db('code', 'msg')->count($where) >= $this->config['total']) {
-                Dever::alert('很抱歉,您已经申请获取验证码超过' . $this->config['total'] . '次,今天您已经无法获取验证码了,请您明天再来');
+                Dever::error('很抱歉,您已经申请获取验证码超过' . $this->config['total'] . '次,今天您已经无法获取验证码了,请您明天再来');
             }
         }
     }

+ 1 - 1
lib/Type/Notify.php

@@ -3,7 +3,7 @@ use Dever;
 class Notify
 {
     # 发送通知
-    public function send($template, $account, $param = array())
+    public function send($template, $account, $param = [])
     {
         if ($template['content']) {
             $template['content'] = \Dever\Helper\Str::val($template['content'], $param);