xxxrrrdddd 3 years ago
parent
commit
7d9f09959f

+ 2 - 0
application/api/controller/MobileController.php

@@ -6,6 +6,7 @@ use app\common\controller\UserApi;
 use app\common\library\MobileConstant;
 use app\common\model\Area;
 use app\common\model\Mobile;
+use app\common\service\SmsSend;
 use think\Db;
 use think\db\Query;
 
@@ -179,6 +180,7 @@ class MobileController extends UserApi
         $mobile=Mobile::findOrFail($data['mobile_id']);
 
         Db::startTrans();
+        SmsSend::setMobile($data['phone'])->setCode($data['sms_code']??'')->setEvent('order')->check();
         $order=$data;
         $order['admin_id']=$mobile['proxy_id'];
         $order['no']=$mobile['no'];

+ 1 - 1
application/api/controller/Sms.php

@@ -20,7 +20,7 @@ class Sms extends Api
      *
      * @ApiMethod (POST)
      * @param string $mobile 手机号asdasdas
-     * @param string $event 事件名称,changemobile更换手机号,changepwd修改密码,resetpwd重置密码,mobilelogin登录
+     * @param string $event 事件名称,changemobile更换手机号,changepwd修改密码,resetpwd重置密码,mobilelogin登录,提交订单order,商务合作cooperate,投诉complaint
      */
     public function send()
     {

+ 49 - 0
application/common/service/SmsSend.php

@@ -0,0 +1,49 @@
+<?php
+namespace app\common\service;
+
+
+use app\common\library\Sms;
+
+class SmsSend{
+    protected $mobile;
+    protected $code;
+    protected $event;
+
+    /**
+     * @param mixed $mobile
+     */
+    public static function setMobile($mobile)
+    {
+        $clss=new self;
+        $clss->mobile = $mobile;
+        return $clss;
+    }
+
+    /**
+     * @param mixed $code
+     */
+    public function setCode($code)
+    {
+        $this->code = $code;
+        return $this;
+    }
+
+    /**
+     * @param mixed $event
+     */
+    public function setEvent($event)
+    {
+        $this->event = $event;
+        return $this;
+    }
+
+    public function check(){
+        $config=config('site.system_sms_open');
+        if(!$config){
+            return;
+        }
+        if(!Sms::check($this->mobile,$this->code,$this->event)){
+            throw_user('验证码错误');
+        }
+    }
+}

+ 3 - 3
public/api.html

@@ -2893,7 +2893,7 @@
                                                         <td>event</td>
                                                         <td>string</td>
                                                         <td>是</td>
-                                                        <td>事件名称,changemobile更换手机号,changepwd修改密码,resetpwd重置密码,mobilelogin登录</td>
+                                                        <td>事件名称,changemobile更换手机号,changepwd修改密码,resetpwd重置密码,mobilelogin登录,提交订单order,商务合作cooperate,投诉complaint</td>
                                                     </tr>
                                                                                                     </tbody>
                                             </table>
@@ -2923,7 +2923,7 @@
                                                         </div>
                                                                                                                 <div class="form-group">
                                                             <label class="control-label" for="event">event</label>
-                                                            <input type="string" class="form-control input-sm" id="event" required placeholder="事件名称,changemobile更换手机号,changepwd修改密码,resetpwd重置密码,mobilelogin登录" name="event">
+                                                            <input type="string" class="form-control input-sm" id="event" required placeholder="事件名称,changemobile更换手机号,changepwd修改密码,resetpwd重置密码,mobilelogin登录,提交订单order,商务合作cooperate,投诉complaint" name="event">
                                                         </div>
                                                                                                                 <div class="form-group form-group-submit">
                                                             <button type="submit" class="btn btn-success send" rel="15">提交</button>
@@ -7872,7 +7872,7 @@
 
                 </div>
                 <div class="col-md-6" align="right">
-                    Generated on 2022-04-08 13:45:12 <a href="./" target="_blank">靓号</a>
+                    Generated on 2022-04-08 14:00:38 <a href="./" target="_blank">靓号</a>
                 </div>
             </div>