data_request['id'])) { MyViewAssign('msg', '文章ID有误'); return MyView('public/tips_error'); } // 获取数据 $id = intval($this->data_request['id']); $params = [ 'where' => [ 'is_enable' => 1, 'id' => $id, ], 'field' => 'id,title,title_color,jump_url,content,access_count,article_category_id,seo_title,seo_keywords,seo_desc,add_time', 'm' => 0, 'n' => 1, ]; $ret = ArticleService::ArticleList($params); if(!empty($ret['data'][0])) { // 访问统计 ArticleService::ArticleAccessCountInc(['id'=>$id]); // 是否外部链接 if(!empty($ret['data'][0]['jump_url'])) { return MyRedirect($ret['data'][0]['jump_url']); } // 获取分类 $article_category_content = ArticleService::ArticleCategoryListContent(); MyViewAssign('category_list', $article_category_content['data']); // seo $seo_title = empty($ret['data'][0]['seo_title']) ? $ret['data'][0]['title'] : $ret['data'][0]['seo_title']; MyViewAssign('home_seo_site_title', SeoService::BrowserSeoTitle($seo_title, 2)); if(!empty($ret['data'][0]['seo_keywords'])) { MyViewAssign('home_seo_site_keywords', $ret['data'][0]['seo_keywords']); } if(!empty($ret['data'][0]['seo_desc'])) { MyViewAssign('home_seo_site_description', $ret['data'][0]['seo_desc']); } MyViewAssign('article', $ret['data'][0]); return MyView(); } // 无数据 MyViewAssign('msg', '文章不存在或已删除'); return MyView('public/tips_error'); } } ?>