模型基本雏形

This commit is contained in:
2017-06-19 00:09:18 +08:00
parent ac1e6a634f
commit 571b9841b1
13 changed files with 372 additions and 373 deletions

View File

@@ -123,12 +123,7 @@ class Content extends Fornt {
//模块内容详情页
public function detail($id = '', $name = '') {
//当为文章模型时
$info = $this->model->detail($id);
if ($this->modelInfo['extend'] = 1 && (time() - session('set_content_view')) > 1800) {
db('Document')->where(array('id' => $id))->setInc('view');
session('set_content_view', time());
}
$info = $this->model->find($id);
if (empty($info)) {
return $this->error("无此内容!");
@@ -168,11 +163,7 @@ class Content extends Fornt {
return $this->error("无此模型!");
} else {
$this->modelInfo = $model_name ? $name_list[$model_name] : $id_list[$model_id];
if ($this->modelInfo['extend'] > 1) {
$this->model = model('Content')->extend($this->modelInfo['name']);
} else {
$this->model = model('Document')->extend($this->modelInfo['name']);
}
$this->model = new \app\common\model\Content($this->modelInfo['name']);
$this->assign('model_id', $this->modelInfo['id']);
$this->assign('model_list', $name_list);

View File

@@ -13,8 +13,7 @@ use app\common\controller\Fornt;
class Index extends Fornt {
//网站首页
public function index() {
//设置SEO
public function index() { //设置SEO
$this->setSeo(config('web_site_title'), config('web_site_keyword'), config('web_site_description'));
return $this->fetch();
}