فهرست منبع

【程序目录】修复阿里云短信问题

吴昊天 3 سال پیش
والد
کامیت
bc836edad1

+ 4 - 3
crmeb/app/adminapi/controller/v1/setting/SystemNotification.php

@@ -88,9 +88,10 @@ class SystemNotification extends AuthController
             ['mark', ''],
             ['sms_id', ''],
         ]);
+        if ($data['mark'] == 'verify_code') $data['type'] = 'is_sms';
         if (!$data['id']) return app('json')->fail(100100);
         if ($this->services->saveData($data)) {
-            CacheService::delete('NOTCE_'. $data['mark']);
+            CacheService::delete('NOTCE_' . $data['mark']);
             return app('json')->success(100001);
         } else {
             return app('json')->fail(100007);
@@ -106,8 +107,8 @@ class SystemNotification extends AuthController
     {
         if ($type == '' || $status == '' || $id == 0) return app('json')->fail(100100);
         $this->services->update($id, [$type => $status]);
-        $res = $this->services->getOneNotce(['id'=>$id]);
-        CacheService::delete('NOTCE_'.$res->mark);
+        $res = $this->services->getOneNotce(['id' => $id]);
+        CacheService::delete('NOTCE_' . $res->mark);
         return app('json')->success(100014);
     }
 }

+ 4 - 1
crmeb/app/api/controller/v1/PublicController.php

@@ -300,7 +300,10 @@ class PublicController
             ['image', ''],
             ['code', ''],
         ], true);
-        if (!preg_match('/.*(\.png|\.jpg|\.jpeg|\.gif)$/', $imageUrl) || !preg_match('/.*(\.png|\.jpg|\.jpeg|\.gif)$/', $codeUrl)) {
+        if ($imageUrl !== '' && !preg_match('/.*(\.png|\.jpg|\.jpeg|\.gif)$/', $imageUrl)) {
+            return app('json')->success(['code' => false, 'image' => false]);
+        }
+        if ($codeUrl !== '' && !preg_match('/.*(\.png|\.jpg|\.jpeg|\.gif)$/', $codeUrl)) {
             return app('json')->success(['code' => false, 'image' => false]);
         }
         try {

+ 1 - 14
crmeb/app/services/message/SystemNotificationServices.php

@@ -106,20 +106,7 @@ class SystemNotificationServices extends BaseServices
                 $info['content'] = $info['system_text'] ?? '';
                 break;
             case 'is_sms':
-                $snsCacheName = 'sms_template_list';
-                $smsTem = [];
-                if (Cache::has($snsCacheName)) {
-                    $smsTem = Cache::get($snsCacheName);
-                } else {
-                    $list = $ServeServices->sms()->temps(1, 30, 0);
-                    if (isset($list['data']) && $list['data']) {
-                        foreach ($list['data'] as $item) {
-                            $smsTem[$item['temp_id']] = $item['content'];
-                        }
-                    }
-                    if ($smsTem) Cache::set($snsCacheName, $smsTem, 172800);
-                }
-                $info['content'] = $smsTem[$info['sms_id']] ?? '';
+                $info['content'] = $info['sms_text'];
                 break;
             case 'is_wechat':
                 $wechat = $TemplateMessageServices->getOne(['id' => $info['wechat_id'], 'type' => 1]);