linwu 14 hours ago
parent
commit
7fb83efc38

+ 0 - 1
app/admin/AdminBaseController.php

@@ -5,7 +5,6 @@ namespace app\admin;
 use app\BaseController;
 use app\common\model\AdminModel;
 use app\common\model\MenuModel;
-use think\facade\Session;
 use think\facade\View;
 
 /**

+ 1 - 1
app/admin/view/company/info.html

@@ -466,7 +466,7 @@
                             </thead>
                             <tbody>
                             <tr>
-                                <td onclick="copyMobileUrl('https://www.chuanglan.com/');">网址:https://www.chuanglan.com/</td>
+                                <td onclick="copyMobileUrl('https://www.aliyun.com/product/sms');">网址:https://www.aliyun.com/product/sms</td>
                                 <td onclick="copyMobileUrl('18060002035');">用户名:18060002035</td>
                                 <td onclick="copyMobileUrl('jjhc2019');">密码:jjhc2019</td>
                             </tr>

+ 18 - 7
app/api/controller/Sms.php

@@ -3,6 +3,7 @@
 namespace app\api\controller;
 
 use app\api\ApiBaseController;
+use app\common\model\SettingModel;
 use app\common\model\SmsAuthModel;
 use app\common\model\SmsLogModel;
 use app\common\model\SmsTemplateModel;
@@ -13,6 +14,7 @@ class Sms extends ApiBaseController
 {
     private $ip;
     private $token;
+
     public function _init()
     {
         //权限校验
@@ -32,7 +34,7 @@ class Sms extends ApiBaseController
             ajax_success();
         }
 
-        $this->ip = $ip;
+        $this->ip    = $ip;
         $this->token = $token;
     }
 
@@ -43,8 +45,8 @@ class Sms extends ApiBaseController
         $mobile         = input('post.mobile', '');
         $template_code  = input('post.template_code', '');
         $template_param = input('post.template_param', []);
-        if (empty($mobile) || empty($template_code) || empty($template_param)) {
-            ajax_error('手机号或模板号或模板参数不能为空!');
+        if (empty($mobile) || empty($template_code)) {
+            ajax_error('手机号或模板号不能为空!');
         }
 
         //短信内容
@@ -59,6 +61,14 @@ class Sms extends ApiBaseController
             }
         }
 
+        //默认平台
+        if (empty($type)) {
+            $type = SettingModel::getConfigValue('sms_type');
+            if (empty($type)) {
+                return ['code' => 1, 'msg' => '未配置默认模板'];
+            }
+        }
+
         $res = SmsService::apiSend($mobile, $content, $type, $template, $template_param);
 
         //记录日志
@@ -66,6 +76,7 @@ class Sms extends ApiBaseController
             'ip'             => $this->ip,
             'token'          => $this->token,
             'mobile'         => $mobile,
+            'type'           => $type,
             'content'        => $content,
             'template_code'  => $template_code,
             'template_param' => json_encode($template_param),
@@ -85,13 +96,13 @@ class Sms extends ApiBaseController
     {
         $map = $this->dealLikeInput(['code']);
 
-        $list  = SmsTemplateModel::field(['code','content','comment'])
+        $list  = SmsTemplateModel::field(['code', 'content', 'comment'])
             ->where($map)
-            ->limit(input('limit',10))
-            ->page(input('page',1))
+            ->limit(input('limit', 10))
+            ->page(input('page', 1))
             ->select();
         $count = SmsTemplateModel::where($map)->count();
 
-        ajax_success(['list'=>$list,'count'=>$count]);
+        ajax_success(['list' => $list, 'count' => $count]);
     }
 }

+ 3 - 0
app/common/model/SettingModel.php

@@ -17,6 +17,9 @@ class SettingModel extends BaseModel
         'sms_mas_apId',
         'sms_mas_secretKey',
         'sms_mas_sign',
+        'sms_ali_accesskeyid',
+        'sms_ali_accesskeysecret',
+        'sms_ali_signname',
     ];
     const SMS_TYPE = [
         'chuanglan' => '创蓝',

+ 0 - 6
app/common/service/SmsService.php

@@ -35,12 +35,6 @@ class SmsService
             'mas'        => 'mas\\Mas',
             'ali'        => 'ali\\Ali',
         ];
-        if (empty($sms_type)) {
-            $sms_type = SettingModel::getConfigValue('sms_type');
-            if (empty($sms_type)) {
-                return ['code' => 1, 'msg' => '未配置默认模板'];
-            }
-        }
         if (empty($sms_obj_arr[$sms_type]) && empty($sms_type)) {
             return ['code' => 1, 'msg' => '模板类型错误'];
         }