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

This commit is contained in:
吴昊天 2022-09-07 09:09:40 +08:00
parent e5ecb82ccd
commit bc836edad1
3 changed files with 9 additions and 18 deletions

View File

@ -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);
}
}

View File

@ -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 {

View File

@ -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]);