修改代码注释

This commit is contained in:
Anyon 2022-02-10 13:52:15 +08:00
parent 2ca69565f6
commit 7f3cae056e
4 changed files with 6 additions and 6 deletions

View File

@ -102,10 +102,10 @@ class Auto extends Command
[$item, $news] = [MediaService::instance()->news($data['news_id']), []]; [$item, $news] = [MediaService::instance()->news($data['news_id']), []];
if (isset($item['articles']) && is_array($item['articles'])) { if (isset($item['articles']) && is_array($item['articles'])) {
$host = sysconf('base.site_host') ?: true; $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(), 'url' => url("@wechat/api.view/item/id/{$vo['id']}", [], false, $host)->build(),
'title' => $vo['title'], 'picurl' => $vo['local_url'], 'description' => $vo['digest'], 'title' => $vo['title'], 'picurl' => $vo['local_url'], 'description' => $vo['digest'],
]); ];
$result = $this->sendMessage('news', ['articles' => $news]); $result = $this->sendMessage('news', ['articles' => $news]);
} }
} }

View File

@ -125,7 +125,7 @@ class Menu extends Controller
*/ */
private function _buildMenuData(array $list): array private function _buildMenuData(array $list): array
{ {
foreach ($list as $key => &$item) { foreach ($list as &$item) {
if (empty($item['sub_button'])) { if (empty($item['sub_button'])) {
$item = $this->_buildMenuDataItem($item); $item = $this->_buildMenuDataItem($item);
} else { } else {

View File

@ -148,7 +148,7 @@ class News extends Controller
$id = intval($vo['id']); $id = intval($vo['id']);
$result = WechatNewsArticle::mk()->where('id', $id)->update($vo); $result = WechatNewsArticle::mk()->where('id', $id)->update($vo);
} }
if ($result !== false) array_push($ids, $id); if ($result !== false) $ids[] = $id;
} }
return join(',', $ids); return join(',', $ids);
} }

View File

@ -223,10 +223,10 @@ class Push extends Controller
case 'news': case 'news':
[$news, $articles] = [MediaService::instance()->news($data['news_id']), []]; [$news, $articles] = [MediaService::instance()->news($data['news_id']), []];
if (empty($news['articles'])) return false; 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(), 'url' => url("@wechat/api.view/item/id/{$vo['id']}", [], false, true)->build(),
'title' => $vo['title'], 'picurl' => $vo['local_url'], 'description' => $vo['digest'], 'title' => $vo['title'], 'picurl' => $vo['local_url'], 'description' => $vo['digest'],
]); ];
return $this->_sendMessage('news', ['articles' => $articles], $custom); return $this->_sendMessage('news', ['articles' => $articles], $custom);
case 'music': case 'music':
if (empty($data['music_url']) || empty($data['music_title']) || empty($data['music_desc'])) return false; if (empty($data['music_url']) || empty($data['music_title']) || empty($data['music_desc'])) return false;