diff --git a/app/admin/controller/Admin.php b/app/admin/controller/Admin.php index 54c4882..ffb248e 100644 --- a/app/admin/controller/Admin.php +++ b/app/admin/controller/Admin.php @@ -139,8 +139,15 @@ class Admin extends AdminController //基本资料显示 public function info() { - $admin = AdminModel::find(Session::get('admin_id')); - View::assign('admin',$admin); + $admin = AdminModel::find(Session::get('admin_id')); + $auths = $admin->adminGroup; + $authname = []; + foreach($auths as $v){ + $authname[] = $v->title; + } + $authGroupTitle = implode('|', $authname); + + View::assign(['admin'=>$admin,'authGroupTitle'=>$authGroupTitle]); return View::fetch('set/user/info'); } //管理员资料更新 diff --git a/app/admin/controller/Set.php b/app/admin/controller/Set.php index 4605f5d..334aa88 100644 --- a/app/admin/controller/Set.php +++ b/app/admin/controller/Set.php @@ -136,10 +136,13 @@ class Set extends AdminController { $url = $url.'?u='.Request::domain(); $cy = Api::urlGet($url); - if($cy->code != 0){ - $cylevel = $cy->level; - return $cylevel; - } else { + + if(!$cy){ + if($cy->code == 1){ + $cylevel = $cy->level; + return $cylevel; + } + } else { return 0; } } diff --git a/app/admin/model/Admin.php b/app/admin/model/Admin.php index 55b48e9..98c103e 100644 --- a/app/admin/model/Admin.php +++ b/app/admin/model/Admin.php @@ -5,7 +5,6 @@ namespace app\admin\model; use think\Model; use think\facade\Db; use think\facade\Session; -//use think\facade\Request; use think\model\concern\SoftDelete; class Admin extends Model @@ -16,10 +15,23 @@ class Admin extends Model protected $defaultSoftDelete = 0; //管理员关联角色 +/* public function authGroup() { return $this->belongsTo('AuthGroup','auth_group_id','id'); } +*/ + + //远程一对多管理员关联角色 + public function adminGroup() + { + return $this->hasManyThrough('AuthGroup', 'AuthGroupAccess','uid','id','id','group_id'); + } + //管理员关联角色分配表 + public function authGroupAccess() + { + return $this->hasMany('AuthGroupAccess','uid','id'); + } //登陆校验 public function login($data) diff --git a/app/admin/model/AuthGroup.php b/app/admin/model/AuthGroup.php index 9bb0d51..9cf3d92 100644 --- a/app/admin/model/AuthGroup.php +++ b/app/admin/model/AuthGroup.php @@ -3,8 +3,6 @@ namespace app\admin\model; use think\Model; -use think\facade\Db; -use think\facade\Session; //use think\model\concern\SoftDelete; class AuthGroup extends Model @@ -13,6 +11,12 @@ class AuthGroup extends Model //use SoftDelete; // protected $deleteTime = 'delete_time'; //protected $defaultSoftDelete = 0; + + //角色多对多关联角色分配表 + public function GroupAccess() + { + return $this->hasMany('AuthGroupAccess','group_id','id'); + } //登陆校验 public function authRuleTree() diff --git a/app/admin/model/AuthGroupAccess.php b/app/admin/model/AuthGroupAccess.php index 39c3c94..e2650e8 100644 --- a/app/admin/model/AuthGroupAccess.php +++ b/app/admin/model/AuthGroupAccess.php @@ -3,8 +3,6 @@ namespace app\admin\model; use think\Model; -use think\facade\Db; -use think\facade\Session; use think\model\concern\SoftDelete; class AuthGroupAccess extends Model @@ -13,5 +11,17 @@ class AuthGroupAccess extends Model use SoftDelete; protected $deleteTime = 'delete_time'; protected $defaultSoftDelete = 0; + + //角色分配表关联管理员 + public function admin() + { + return $this->belongsTo('Admin','uid','id'); + } + + //角色分配表关联管理员 + public function authGroup() + { + return $this->belongsTo('AuthGroup','group_id','id'); + } } diff --git a/app/admin/model/AuthRule.php b/app/admin/model/AuthRule.php index bd2dfd4..f6bea0d 100644 --- a/app/admin/model/AuthRule.php +++ b/app/admin/model/AuthRule.php @@ -3,8 +3,6 @@ namespace app\admin\model; use think\Model; -use think\facade\Db; -use think\facade\Session; use think\model\concern\SoftDelete; class AuthRule extends Model diff --git a/app/admin/model/MailServer.php b/app/admin/model/MailServer.php index e5efcb8..b98c547 100644 --- a/app/admin/model/MailServer.php +++ b/app/admin/model/MailServer.php @@ -3,9 +3,6 @@ namespace app\admin\model; use think\Model; -use think\facade\Db; -use think\facade\Session; -use think\facade\Request; //use think\model\concern\SoftDelete; class MailServer extends Model diff --git a/app/admin/model/System.php b/app/admin/model/System.php index 6572b3b..5e26d8e 100644 --- a/app/admin/model/System.php +++ b/app/admin/model/System.php @@ -3,9 +3,6 @@ namespace app\admin\model; use think\Model; -use think\facade\Db; -use think\facade\Session; -use think\facade\Request; //use think\model\concern\SoftDelete; class System extends Model diff --git a/app/admin/view/public/auth.html b/app/admin/view/public/auth.html index d951394..d78497e 100644 --- a/app/admin/view/public/auth.html +++ b/app/admin/view/public/auth.html @@ -1,20 +1,15 @@ - - {block name="title"}TaoLer后台管理模板系统{/block} - - - - - - {block name="css"}{/block} + - -无操作权限! - - - + +
无操作权限!
\ No newline at end of file diff --git a/app/admin/view/set/user/info.html b/app/admin/view/set/user/info.html index 6173547..e18256d 100644 --- a/app/admin/view/set/user/info.html +++ b/app/admin/view/set/user/info.html @@ -16,7 +16,7 @@
- +
当前角色不可更改为其它角色
diff --git a/app/common/model/User.php b/app/common/model/User.php index 9c67da2..6cfc585 100644 --- a/app/common/model/User.php +++ b/app/common/model/User.php @@ -54,7 +54,7 @@ class User extends Model if($user['password'] == $data['password']){ //将用户数据写入Session Session::set('user_id',$user['id']); - //Session::set('user_name',$user['name']); + Session::set('user_name',$user['name']); if(isset($data['remember'])){ $salt = 'taoler'; //加密auth存入cookie diff --git a/app/index/lang/en-us.php b/app/index/lang/en-us.php index 9b21017..50a3a20 100644 --- a/app/index/lang/en-us.php +++ b/app/index/lang/en-us.php @@ -52,6 +52,7 @@ return [ 'no comments' => 'No comments', 'submit comments' => 'Submit comments', 'reply' => 'reply', + 'replies' => 'replies', 'accept' => 'accept', 'please input the content' => 'please input the content', 'ads area' => 'Ads area', @@ -92,5 +93,17 @@ return [ 'please confirm the password' => 'Please confirm the password', 'please input the captcha' => 'Please input the captcha', - + //user + 'add friends' => 'Add friends', + 'start a chat' => 'Start a chat', + 'authentication information' => 'Authentication information', + 'it is not signed yet' => 'It is not signed yet', + 'log in to view' => 'Log in to view', + 'join' => 'Join', + 'recent statements' => 'Recent statements', + 'recent answers' => 'Recent answers', + 'browses' => 'Browses', + 'in' => 'in', + 'accumulate points' => 'Accumulate points', + 'my post' => 'My post', ]; \ No newline at end of file diff --git a/app/index/lang/zh-cn.php b/app/index/lang/zh-cn.php index b38d821..a3d04b9 100644 --- a/app/index/lang/zh-cn.php +++ b/app/index/lang/zh-cn.php @@ -51,6 +51,7 @@ return [ 'no comments' => '暂时还没有评论', 'submit comments' => '提交评论', 'reply' => '回复', + 'replies' => '次回复', 'accept' => '采纳', 'please input the content' => '请输入内容', 'ads area' => '广告区', @@ -89,4 +90,20 @@ return [ 'please input the password' => '请输入密码', 'please confirm the password' => '请确认密码', 'please input the captcha' => '请输入验证码', + + //user + 'add friends' => '添加为好友', + 'start a chat' => '开始会话', + 'authentication information' => '认证信息', + 'it is not signed yet' => '懒得还没有任何签名', + 'log in to view' => '登录查看', + 'join' => '加入', + 'recent statements' => '最近发帖', + 'recent answers' => '最近回贴', + 'browses' => '浏览', + 'in' => '在', + 'accumulate points' => '积分', + 'my post' => '我的帖子', + + ]; \ No newline at end of file diff --git a/app/index/lang/zh-tw.php b/app/index/lang/zh-tw.php index 80ec258..eade333 100644 --- a/app/index/lang/zh-tw.php +++ b/app/index/lang/zh-tw.php @@ -51,6 +51,7 @@ return [ 'no comments' => '暫時還沒有評論', 'submit comments' => '提交評論', 'reply' => '回復', + 'replies' => '次回復', 'accept' => '采納', 'please input the content' => '請輸入內容', 'ads area' => '廣告區', diff --git a/extend/taoler/com/Api.php b/extend/taoler/com/Api.php index f380f4b..c73aedd 100644 --- a/extend/taoler/com/Api.php +++ b/extend/taoler/com/Api.php @@ -21,7 +21,7 @@ class Api if($httpCode == '200'){ return json_decode($data); } else { - return json(['code'=>-1,'msg'=>'Զ̷ʧ']); + return json(['code'=>-1,'msg'=>'远程服务器失败']); } } @@ -30,15 +30,16 @@ class Api $ch =curl_init (); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1); - //curl_setopt($ch, CURLOPT_HEADER, 0); //ʱὫͷļϢΪ Ϊ1ʾϢͷ,Ϊ0ʾ - curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1) ; // CURLOPT_RETURNTRANSFER ʱ򽫻ȡݷ + //curl_setopt($ch, CURLOPT_HEADER, 0); //启用时会将头文件的信息作为数据流输出。 参数为1表示输出信息头,为0表示不输出 + curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1) ; // 在启用 CURLOPT_RETURNTRANSFER 时候将获取数据返回 $data = curl_exec($ch); $httpCode = curl_getinfo($ch,CURLINFO_HTTP_CODE); curl_close($ch); if($httpCode == '200'){ return json_decode($data); } else { - return json(['code'=>-1,'msg'=>'Զ̷ʧ']); + //return json(['code'=>-1,'msg'=>'远程服务器失败']); + return false; } } diff --git a/public/static/res/mods/index.js b/public/static/res/mods/index.js index 11a50b9..6a590d4 100644 --- a/public/static/res/mods/index.js +++ b/public/static/res/mods/index.js @@ -664,7 +664,7 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util'], function( ,'' ,'' ,'{{item.user.username}}' - ,'{{item["count(*)"]}}次回答' + ,'{{item["count(*)"]}}' +replyNum+'' ,'' ,'' ,'{{# }); }}'].join('') diff --git a/view/taoler/index/index/index.html b/view/taoler/index/index/index.html index 4010798..0b51619 100644 --- a/view/taoler/index/index/index.html +++ b/view/taoler/index/index/index.html @@ -59,31 +59,31 @@ {/volist} - +

{:lang('reviewers list')}

- -
-
{:lang('hot post list')}
- {volist name="artHot" id="vo"} -
- {$vo.title} - {$vo.comments_count} -
- {/volist} -
- -
+ +
+
{:lang('hot post list')}
+ {volist name="artHot" id="vo"} +
+ {$vo.title} + {$vo.comments_count} +
+ {/volist} +
+ +
{:lang('official products')}
-
-
+
+
{volist name="ad_comm" id="vo"} {/volist} diff --git a/view/taoler/index/public/footer.html b/view/taoler/index/public/footer.html index 39645ae..e89e1c4 100644 --- a/view/taoler/index/public/footer.html +++ b/view/taoler/index/public/footer.html @@ -17,7 +17,8 @@ var messageNums = "{:url('index/Message/nums')}", articleAdd = "{:url('Article/add')}", websearch = "{:url('index/index/search')}", textImgUpload = "{:url('index/article/textImgUpload')}", - searchUrl = "{:url('index/search')}"; - langUrl = "{:url('index/language')}"; + searchUrl = "{:url('index/search')}", + langUrl = "{:url('index/language')}", + replyNum = "{:lang('replies')}"; diff --git a/view/taoler/index/user/home.html b/view/taoler/index/user/home.html index 2e33ecf..2d131f4 100644 --- a/view/taoler/index/user/home.html +++ b/view/taoler/index/user/home.html @@ -19,17 +19,17 @@ (该号已被封) --> -

认证信息: 作者

+

{:lang('authentication information')}

- {$u.point} 飞吻 - {$u.create_time|date='Y-m-d'} 加入 - {:session('user_id') ? '来自'.$u.city:'登录查看'} + {$u.point} {:lang('accumulate points')} + {$u.create_time|date='Y-m-d'} {:lang('join')} + {:session('user_id') ? '来自'.$u.city: lang('log in to view')}

-

({$u.sign ?:'懒得还没有签名'})

+

({$u.sign ?: lang('it is not signed yet')})

@@ -37,14 +37,14 @@
-

{$u.nickname ?: $u.name} 最近的帖子

+

{:lang('recent statements')}

    {volist name="$arts" id="vo"}
  • - {if condition="$vo.is_hot==1"}{/if} + {if condition="$vo.is_hot==1"}{:lang('hot')}{/if} {$vo.title} {$vo.create_time|date='Y-m-d'} - {$vo.pv} 阅 + {$vo.pv} {:lang('browses')}
  • {/volist} {if condition="$arts eq ''"} @@ -56,13 +56,13 @@
    -

    {$u.nickname ?? $u.name} 最近的回答

    +

    {:lang('recent answers')}

      {volist name="$reys" id="vo" empty="没有回答任何问题"}
    • {$vo.create_time|date='Y-m-d H-m'} - 在{$vo.title}中回答: + {:lang('in')}{$vo.title}{:lang('reply')}:

      {$vo.content}