uhome and artedit
This commit is contained in:
parent
e6ee8dff79
commit
d079f03887
@ -237,7 +237,7 @@ abstract class BaseController
|
|||||||
protected function showUser()
|
protected function showUser()
|
||||||
{
|
{
|
||||||
//1.查询用户
|
//1.查询用户
|
||||||
$user = Db::name('user')->field('id,name,nickname,user_img,sex,auth,city,email,sign,point')->where('id',Session::get('user_id'))->cache(true)->find();
|
$user = Db::name('user')->field('id,name,nickname,user_img,sex,auth,city,email,sign,point')->where('id',Session::get('user_id'))->cache(600)->find();
|
||||||
//2.将User变量赋给模板 公共模板nav.html
|
//2.将User变量赋给模板 公共模板nav.html
|
||||||
View::assign('user',$user);
|
View::assign('user',$user);
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ class Article extends BaseController
|
|||||||
if(true !==$result){
|
if(true !==$result){
|
||||||
return $this->error($validate->getError());
|
return $this->error($validate->getError());
|
||||||
} else {
|
} else {
|
||||||
$article = new \app\common\model\Article();
|
$article = new \app\common\model\Article;
|
||||||
$result = $article->add($data);
|
$result = $article->add($data);
|
||||||
if($result == 1) {
|
if($result == 1) {
|
||||||
$aid = Db::name('article')->max('id');
|
$aid = Db::name('article')->max('id');
|
||||||
@ -213,7 +213,7 @@ class Article extends BaseController
|
|||||||
if(true !==$res){
|
if(true !==$res){
|
||||||
return $this->error($validate->getError());
|
return $this->error($validate->getError());
|
||||||
} else {
|
} else {
|
||||||
$article = new \app\common\model\Article();
|
$article = new \app\common\model\Article;
|
||||||
$result = $article->edit($data);
|
$result = $article->edit($data);
|
||||||
if($result == 1) {
|
if($result == 1) {
|
||||||
return json(['code'=>1,'msg'=>'修改成功','url'=>'/'.app('http')->getName().'/jie/'.$id.'.html']);
|
return json(['code'=>1,'msg'=>'修改成功','url'=>'/'.app('http')->getName().'/jie/'.$id.'.html']);
|
||||||
|
@ -134,11 +134,11 @@ class User extends BaseController
|
|||||||
public function home($id)
|
public function home($id)
|
||||||
{
|
{
|
||||||
//用户
|
//用户
|
||||||
$u = Db::name('user')->field('name,nickname,city,sex,sign,user_img,point,create_time')->cache(true)->find($id);
|
$u = Db::name('user')->field('name,nickname,city,sex,sign,user_img,point,create_time')->cache(3600)->find($id);
|
||||||
//用户发贴
|
//用户发贴
|
||||||
$arts = Db::name('user')->alias('u')->join('article a','u.id = a.user_id')->field('u.id,a.id,a.title,a.pv,a.is_hot,a.create_time,a.delete_time')->where('a.delete_time',0)->where('a.user_id',$id)->cache(true)->select();
|
$arts = Db::name('user')->alias('u')->join('article a','u.id = a.user_id')->field('u.id,a.id,a.title,a.pv,a.is_hot,a.create_time,a.delete_time')->where('a.delete_time',0)->where('a.user_id',$id)->order(['a.create_time'=>'desc'])->cache(3600)->select();
|
||||||
//用户回答
|
//用户回答
|
||||||
$reys = Db::name('comment')->alias('c')->join('article a','c.article_id = a.id')->field('a.id,a.title,c.content,c.create_time,c.delete_time')->where(['a.delete_time'=>0,'c.delete_time'=>0])->where('c.user_id',$id)->cache(true)->select();
|
$reys = Db::name('comment')->alias('c')->join('article a','c.article_id = a.id')->field('a.id,a.title,c.content,c.create_time,c.delete_time')->where(['a.delete_time'=>0,'c.delete_time'=>0])->where('c.user_id',$id)->order(['c.create_time'=>'desc'])->cache(3600)->select();
|
||||||
|
|
||||||
View::assign(['u'=>$u,'arts'=>$arts,'reys'=>$reys]);
|
View::assign(['u'=>$u,'arts'=>$arts,'reys'=>$reys]);
|
||||||
return View::fetch();
|
return View::fetch();
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{extend name="public/base" /}
|
{extend name="public/base" /}
|
||||||
|
|
||||||
{block name="title"}发表帖子{/block}
|
{block name="title"}发表帖子{/block}
|
||||||
{block name="column"}{/block}
|
{block name="column"}{/block}
|
||||||
{block name="content"}
|
{block name="content"}
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
<label for="L_title" class="layui-form-label">标题</label>
|
<label for="L_title" class="layui-form-label">标题</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" value="{$article.title}">
|
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" value="{$article.title}">
|
||||||
<input type="hidden" name="user_id" value="{:session('user_id')}">
|
<input type="hidden" name="user_id" value="{$article.user_id}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user