From bc836edad1b384a74535da554c83e27ded1b9063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Wed, 7 Sep 2022 09:09:40 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=A8=8B=E5=BA=8F=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E3=80=91=E4=BF=AE=E5=A4=8D=E9=98=BF=E9=87=8C=E4=BA=91=E7=9F=AD?= =?UTF-8?q?=E4=BF=A1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/v1/setting/SystemNotification.php | 7 ++++--- crmeb/app/api/controller/v1/PublicController.php | 5 ++++- .../message/SystemNotificationServices.php | 15 +-------------- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/crmeb/app/adminapi/controller/v1/setting/SystemNotification.php b/crmeb/app/adminapi/controller/v1/setting/SystemNotification.php index 0320eaefe..ea8378bf2 100644 --- a/crmeb/app/adminapi/controller/v1/setting/SystemNotification.php +++ b/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); } } diff --git a/crmeb/app/api/controller/v1/PublicController.php b/crmeb/app/api/controller/v1/PublicController.php index f19e9e5c0..ad0e1c459 100644 --- a/crmeb/app/api/controller/v1/PublicController.php +++ b/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 { diff --git a/crmeb/app/services/message/SystemNotificationServices.php b/crmeb/app/services/message/SystemNotificationServices.php index 3721a6ca5..0aaabe299 100644 --- a/crmeb/app/services/message/SystemNotificationServices.php +++ b/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]);