diff --git a/app/admin/controller/Article.php b/app/admin/controller/Article.php index dfaf2c3..7167edf 100644 --- a/app/admin/controller/Article.php +++ b/app/admin/controller/Article.php @@ -51,7 +51,6 @@ class Article extends BaseController if ($res) { add_log('edit', $data['id'], $data); } - return to_assign(); } else { try { @@ -65,7 +64,6 @@ class Article extends BaseController if ($insertId) { add_log('add', $insertId, $param); } - return to_assign(); } } @@ -105,7 +103,7 @@ class Article extends BaseController $where[] = ['a.status', '>=', 0]; $rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit']; $content = ArticleList::where($where) - ->field('*,w.id as cate_id,a.id as id,w.title as cate_title,a.title as title') + ->field('a.*,w.id as cate_id,a.id as id,w.title as cate_title,a.title as title') ->alias('a') ->join('article_cate w', 'a.article_cate_id = w.id') ->order('a.create_time desc') @@ -143,8 +141,7 @@ class Article extends BaseController // 验证失败 输出错误信息 return to_assign(0, $e->getError()); } - $param['update_time'] = time(); - + $param['update_time'] = time(); Db::startTrans(); try { $res = ArticleList::strict(false)->field(true)->update($param); @@ -185,6 +182,9 @@ class Article extends BaseController $param['create_time'] = time(); Db::startTrans(); try { + if(empty($param['desc'])){ + $param['desc'] = getDescriptionFromContent($param['content'], 100); + } $aid = ArticleList::strict(false)->field(true)->insertGetId($param); if ($aid) { if (isset($param['keyword_names']) && $param['keyword_names']) { diff --git a/app/admin/view/article/add.html b/app/admin/view/article/add.html index f0c2c8a..16aa267 100644 --- a/app/admin/view/article/add.html +++ b/app/admin/view/article/add.html @@ -9,7 +9,7 @@ class="layui-input">