diff --git a/app/common/controller/BaseController.php b/app/common/controller/BaseController.php index 55b7914..5825098 100644 --- a/app/common/controller/BaseController.php +++ b/app/common/controller/BaseController.php @@ -240,7 +240,7 @@ abstract class BaseController $user = Cache::get('user'.$id); if(!$user){ //1.查询用户 - $user = Db::name('user')->field('id,name,nickname,user_img,sex,auth,city,email,sign,point,vip,create_time')->find($id); + $user = Db::name('user')->field('id,name,nickname,user_img,sex,area_id,auth,city,email,sign,point,vip,create_time')->find($id); Cache::tag('user')->set('user'.$id,$user,600); } diff --git a/app/common/model/User.php b/app/common/model/User.php index 7695aa7..f892999 100644 --- a/app/common/model/User.php +++ b/app/common/model/User.php @@ -117,7 +117,7 @@ class User extends Model { $userId = $data['user_id']; $user = User::where('id',$userId)->find(); - $result = $user->allowField(['email','nickname','sex','city','sign'])->save($data); + $result = $user->allowField(['email','nickname','sex','city','area_id','sign'])->save($data); if($result){ return 1; }else{ diff --git a/app/index/controller/User.php b/app/index/controller/User.php index afaafff..2e253ef 100644 --- a/app/index/controller/User.php +++ b/app/index/controller/User.php @@ -72,7 +72,8 @@ class User extends BaseController public function set() { if(Request::isAjax()){ - $data = Request::only(['user_id','email','nickname','sex','city','sign']); + $data = Request::only(['user_id','email','nickname','sex','city','area_id','sign']); + var_dump($data); $validate = new \app\common\validate\User; $result = $validate->scene('Set')->check($data); if(!$result){ @@ -81,12 +82,15 @@ class User extends BaseController $user = new \app\common\model\User; $result = $user->setNew($data); if($result==1){ + Cache::tag('user')->clear(); return ['code'=>0,'msg'=>'资料更新成功']; } else { $this->error($result); } } } + $area = Db::name('user_area')->select(); + View::assign(['area'=>$area]); return View::fetch(); } diff --git a/view/taoler/index/article/edit.html b/view/taoler/index/article/edit.html index df825e3..75df13b 100644 --- a/view/taoler/index/article/edit.html +++ b/view/taoler/index/article/edit.html @@ -31,7 +31,7 @@
- +
diff --git a/view/taoler/index/public/index-topforum.html b/view/taoler/index/public/index-topforum.html index 0d23975..c702cb3 100644 --- a/view/taoler/index/public/index-topforum.html +++ b/view/taoler/index/public/index-topforum.html @@ -10,7 +10,7 @@ {:getAsing($top.user.area_id) ?: '无'} {$top.user.nickname ?: $top.user.name} - + {if($top.user.vip > 0)} VIP{$top.user.vip} {/if} diff --git a/view/taoler/index/user/home.html b/view/taoler/index/user/home.html index 83edf70..6e5d877 100644 --- a/view/taoler/index/user/home.html +++ b/view/taoler/index/user/home.html @@ -10,7 +10,9 @@ {$u.nickname ?: $u.name} {if($u.sex==0)} {else} {/if} + {if($u.vip > 0)} VIP{$u.vip} + {/if}