application/index/controller/ArticleDetail.php
(完整代码) 1KB<?php
namespace app\index\controller;
use app\index\model\ArticleSpace;
use app\index\model\ArticleCommontSpace;
class ArticleDetail extends Base
{
public function index()
{
$article_status=$this->check_article_status(request()->param('id')) ;
if($article_status !=2 ){return $this->fetch('ajax/tip', ['info'=>'该文章已关闭']); }
$CommontSpace = ArticleCommontSpace::where(['article_id' => request()->param('id')])->order('id', 'desc')->select();
$ArticleSpace = ArticleSpace::get(['id' => request()->param('id')]);
$ArticleSpace->saw_num+=1;
$ArticleSpace->save();
$this->assign('ArticleSpace', $ArticleSpace);
$this->assign('CommontSpace', $CommontSpace);
return $this->fetch();
}
public function add_article_commont_action()
{
if(!session('uid', '', 'index')){$this->redirect('Login/index');}
$ArticleCommontSpace=new ArticleCommontSpace;
$id=$ArticleCommontSpace->add();
if($id){$this->redirect('ArticleDetail/index', ['id' => request()->param('article_id')]);}
}
public function check_article_status($article_id){
$articleSpace= articleSpace::where(['id' => $article_id])->find();
return $articleSpace['status'];
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。