From 7f3cae056e528801a13e126c282bfbc2188ad819 Mon Sep 17 00:00:00 2001 From: Anyon Date: Thu, 10 Feb 2022 13:52:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/wechat/command/Auto.php | 4 ++-- app/wechat/controller/Menu.php | 2 +- app/wechat/controller/News.php | 2 +- app/wechat/controller/api/Push.php | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/wechat/command/Auto.php b/app/wechat/command/Auto.php index 4f1ebdc2a..61b42facd 100644 --- a/app/wechat/command/Auto.php +++ b/app/wechat/command/Auto.php @@ -102,10 +102,10 @@ class Auto extends Command [$item, $news] = [MediaService::instance()->news($data['news_id']), []]; if (isset($item['articles']) && is_array($item['articles'])) { $host = sysconf('base.site_host') ?: true; - foreach ($item['articles'] as $vo) if (empty($news)) array_push($news, [ + foreach ($item['articles'] as $vo) if (empty($news)) $news[] = [ 'url' => url("@wechat/api.view/item/id/{$vo['id']}", [], false, $host)->build(), 'title' => $vo['title'], 'picurl' => $vo['local_url'], 'description' => $vo['digest'], - ]); + ]; $result = $this->sendMessage('news', ['articles' => $news]); } } diff --git a/app/wechat/controller/Menu.php b/app/wechat/controller/Menu.php index fb3f49c43..f93f81e56 100644 --- a/app/wechat/controller/Menu.php +++ b/app/wechat/controller/Menu.php @@ -125,7 +125,7 @@ class Menu extends Controller */ private function _buildMenuData(array $list): array { - foreach ($list as $key => &$item) { + foreach ($list as &$item) { if (empty($item['sub_button'])) { $item = $this->_buildMenuDataItem($item); } else { diff --git a/app/wechat/controller/News.php b/app/wechat/controller/News.php index 7707ec129..8d352b249 100644 --- a/app/wechat/controller/News.php +++ b/app/wechat/controller/News.php @@ -148,7 +148,7 @@ class News extends Controller $id = intval($vo['id']); $result = WechatNewsArticle::mk()->where('id', $id)->update($vo); } - if ($result !== false) array_push($ids, $id); + if ($result !== false) $ids[] = $id; } return join(',', $ids); } diff --git a/app/wechat/controller/api/Push.php b/app/wechat/controller/api/Push.php index 58b129b9e..0289db885 100644 --- a/app/wechat/controller/api/Push.php +++ b/app/wechat/controller/api/Push.php @@ -223,10 +223,10 @@ class Push extends Controller case 'news': [$news, $articles] = [MediaService::instance()->news($data['news_id']), []]; if (empty($news['articles'])) return false; - foreach ($news['articles'] as $vo) array_push($articles, [ + foreach ($news['articles'] as $vo) $articles[] = [ 'url' => url("@wechat/api.view/item/id/{$vo['id']}", [], false, true)->build(), 'title' => $vo['title'], 'picurl' => $vo['local_url'], 'description' => $vo['digest'], - ]); + ]; return $this->_sendMessage('news', ['articles' => $articles], $custom); case 'music': if (empty($data['music_url']) || empty($data['music_title']) || empty($data['music_desc'])) return false;