Bladeren bron

[智价云] 官网留言短信通知

tangyuanwang 7 uur geleden
bovenliggende
commit
31ce071271

+ 1 - 0
app/Facades/Servers/Sms/VerifyCode.php

@@ -7,6 +7,7 @@ use Illuminate\Support\Facades\Facade;
  * 
  * @method static array sendCode($phone,$verifyCode) 发送短信验证码
  * @method static array sendRemind($phone,$content) 发送短信
+ * @method static array sendContent($phone,$content) 发送短信内容
  *
  * @see \App\Servers\Sms\VerifyCode
  * 

+ 1 - 1
app/Http/Controllers/Api/Website/LeadMessage.php

@@ -55,7 +55,7 @@ class LeadMessage extends Controller
         $phone_array                              = $phone_data ? array_column($phone_data, 'phone') : [];
         $phone                              = $phone_array ? implode(',', $phone_array) : '';
         // 发送短信
-        $result                             = $phone ? Sms::sendRemind($phone, $data['company_name'] . '的' . $data['position'] . '已留资料,请及时登录智价云管理后台跟进 ') : true; // : true;
+        $result                             = $phone ? Sms::sendContent($phone,['company'=>$data['company_name'],'position'=>$data['position']]) : true; // : true;
         // 返回结果
         return                                json_send(['code' => 'success', 'msg' => '留言成功', 'data' => '']);
     }

+ 16 - 1
app/Servers/Sms/VerifyCode.php

@@ -67,7 +67,7 @@ class VerifyCode
         // 如果是阿里云
         if ($type == 'aliyun') {
             // 发送短信
-            $result                         = Aliyun::sendSms($phone, config('verifycode.aliyun.sms_sign'), config('verifycode.aliyun.sms_tpl'), ['code' => $content]);;
+            $result                         = Aliyun::sendSms($phone, config('verifycode.aliyun.sms_sign'), config('verifycode.aliyun.sms_tpl'), ['code' => $content]);
             // 如果code不是03
             if (isset($result['error']))    return ['error' => $result['error'], 'data' => $result];
             // 返回结果
@@ -85,4 +85,19 @@ class VerifyCode
         // 返回结果
         return                              ['error' => '未知运营商,请配置运营商类型'];
     }
+
+
+    public function sendContent($phone, $content)
+    {
+        // 判断运营商,以方便发送短信
+        $type                               = config('verifycode.operator_type');
+        // 如果是阿里云
+        if ($type == 'aliyun') {
+            // 发送短信
+            $result                         = Aliyun::sendSms($phone, config('verifycode.aliyun_website.sms_sign'), config('verifycode.aliyun_website.sms_tpl'),$content);
+            // 如果code不是03
+            if (isset($result['error']))    return ['error' => $result['error'], 'data' => $result];
+            // 返回结果
+            return                          $result;
+        }
 }

+ 4 - 0
config/verifycode.php

@@ -7,6 +7,10 @@ return [
         'sms_sign'      => env('VERIFYCODE_ALIYUN_SMS_SIGN', '开邻'),
         'sms_tpl'       => env('VERIFYCODE_ALIYUN_SMS_TPL', 'SMS_483305249'),
     ],
+    'aliyun_website'=>[
+        'sms_sign'      => env('VERIFYCODE_ALIYUN_SMS_SIGN', '开邻'),
+        'sms_tpl'       => env('VERIFYCODE_ALIYUN_SMS_TPL', 'SMS_504795046'),
+    ],
     'guodu'=>[
         'sms_sign'      => env('VERIFYCODE_GUODU_SMS_SIGN', '开邻'),
     ],