|
|
@@ -48,6 +48,18 @@ class Article extends BaseModel
|
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
|
* @throws \think\exception\DbException
|
|
|
*/
|
|
|
+// public static function getArticleOne($id = 0)
|
|
|
+// {
|
|
|
+// if (!$id) return [];
|
|
|
+// $list = self::where('status', 1)->where('hide', 0)->where('id', $id)->order('id desc')->find();
|
|
|
+// if ($list) {
|
|
|
+// $list->store_info = $list->profile ? $list->profile->toArray() : null;
|
|
|
+// $list = $list->hidden(['hide', 'status', 'admin_id', 'mer_id'])->toArray();
|
|
|
+// $list["content"] = Db::name('articleContent')->where('nid', $id)->value('content');
|
|
|
+// $list["content"] = htmlspecialchars_decode($list["content"]);
|
|
|
+// return $list;
|
|
|
+// } else return [];
|
|
|
+// }
|
|
|
public static function getArticleOne($id = 0)
|
|
|
{
|
|
|
if (!$id) return [];
|
|
|
@@ -55,12 +67,13 @@ class Article extends BaseModel
|
|
|
if ($list) {
|
|
|
$list->store_info = $list->profile ? $list->profile->toArray() : null;
|
|
|
$list = $list->hidden(['hide', 'status', 'admin_id', 'mer_id'])->toArray();
|
|
|
+
|
|
|
+ // 修改这里:去除 htmlspecialchars_decode 调用
|
|
|
$list["content"] = Db::name('articleContent')->where('nid', $id)->value('content');
|
|
|
- $list["content"] = htmlspecialchars_decode($list["content"]);
|
|
|
+
|
|
|
return $list;
|
|
|
} else return [];
|
|
|
}
|
|
|
-
|
|
|
/**
|
|
|
* TODO 获取某个分类底下的文章
|
|
|
* @param $cid
|