This commit is contained in:
2025-06-27 17:04:25 +08:00
parent c30ff3cca1
commit c8eb5f33ee
8 changed files with 147 additions and 46 deletions
+3 -1
View File
@@ -2,6 +2,7 @@
namespace app\apis\controller;
use app\apis\model\CommentModel;
use support\Request;
use support\Response;
use app\apis\model\ArticleModel;
@@ -47,11 +48,12 @@ class ArticleController extends BaseController
if ($item['cover']) {
$item['cover_full'] = (new \app\mzl\modules\upload\service\OssService())->generatePrivateUrl($item['cover']);
}
$item['comment'] = CommentModel::where(['article_id' => $item['id'], ['created_at', '<=', time()]])->get();
foreach ($item['comment'] as &$comment) {
if ($comment['avatar']) {
$comment['avatar_full'] = (new \app\mzl\modules\upload\service\OssService())->generatePrivateUrl($comment['avatar']);
}
$comment['created_at'] = date('Y-m-d H:i:s', $comment['created_at']);
}
unset($comment);
}