添加语言包 修复后台用户角色

This commit is contained in:
taoser 2020-11-13 17:24:58 +08:00
parent 7ea001a7b3
commit d9dbfdbad0
19 changed files with 126 additions and 70 deletions

View File

@ -140,7 +140,14 @@ class Admin extends AdminController
public function info()
{
$admin = AdminModel::find(Session::get('admin_id'));
View::assign('admin',$admin);
$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');
}
//管理员资料更新

View File

@ -136,9 +136,12 @@ class Set extends AdminController
{
$url = $url.'?u='.Request::domain();
$cy = Api::urlGet($url);
if($cy->code != 0){
if(!$cy){
if($cy->code == 1){
$cylevel = $cy->level;
return $cylevel;
}
} else {
return 0;
}

View File

@ -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)

View File

@ -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
@ -14,6 +12,12 @@ class AuthGroup extends Model
// protected $deleteTime = 'delete_time';
//protected $defaultSoftDelete = 0;
//角色多对多关联角色分配表
public function GroupAccess()
{
return $this->hasMany('AuthGroupAccess','group_id','id');
}
//登陆校验
public function authRuleTree()
{

View File

@ -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
@ -14,4 +12,16 @@ class AuthGroupAccess extends Model
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');
}
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,20 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{block name="title"}TaoLer后台管理模板系统{/block}</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
<link rel="stylesheet" href="/static/admin/style/admin.css" media="all">
{block name="css"}{/block}
<style>
.auth{
font-size: 18px;
text-align:center;
margin-top:30px;
}
</style>
</head>
<body {if($Request.url=='/admin/index/index')}class="layui-layout-body"{/if}>
<a>无操作权限!</a>
<script src="/static/layui/jquery.min.js" charset="utf-8"></script>
<script src="/static/layui/layui.js"></script>
<script type="text/javascript" charset="utf-8">
</script>
<body>
<div class="auth">无操作权限!</div>
</body>
</html>

View File

@ -16,7 +16,7 @@
<div class="layui-form-item">
<label class="layui-form-label">我的角色</label>
<div class="layui-input-inline">
<input type="text" name="auth_group_id" value="{$admin.authGroup.title}" readonly class="layui-input layui-disabled" disabled>
<input type="text" name="auth_group_id" value="{$authGroupTitle}" readonly class="layui-input layui-disabled" disabled>
</div>
<div class="layui-form-mid layui-word-aux">当前角色不可更改为其它角色</div>
</div>

View File

@ -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

View File

@ -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',
];

View File

@ -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' => '我的帖子',
];

View File

@ -51,6 +51,7 @@ return [
'no comments' => '暫時還沒有評論',
'submit comments' => '提交評論',
'reply' => '回復',
'replies' => '次回復',
'accept' => '采納',
'please input the content' => '請輸入內容',
'ads area' => '廣告區',

View File

@ -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;
}
}

View File

@ -664,7 +664,7 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util'], function(
,'<a href="{{item.uid}}">'
,'<img src="{{item.user.avatar}}">'
,'<cite>{{item.user.username}}</cite>'
,'<i>{{item["count(*)"]}}次回答</i>'
,'<i>{{item["count(*)"]}}' +replyNum+'</i>'
,'</a>'
,'</dd>'
,'{{# }); }}'].join('')

View File

@ -59,14 +59,14 @@
{/volist}
</div>
</div>
<!--回帖榜-->
<div class="fly-panel fly-rank fly-rank-reply" id="LAY_replyRank">
<h3 class="fly-panel-title">{:lang('reviewers list')}</h3>
<dl>
<i class="layui-icon fly-loading">&#xe63d;</i>
</dl>
</div>
<!--热帖榜-->
<dl class="fly-panel fly-list-one">
<dt class="fly-panel-title">{:lang('hot post list')}</dt>
{volist name="artHot" id="vo"}
@ -76,7 +76,7 @@
</dd>
{/volist}
</dl>
<!--自定义-->
<div class="fly-panel">
<div class="fly-panel-title">{:lang('official products')}</div>
<div class="fly-panel-main">

View File

@ -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')}";
</script>

View File

@ -19,17 +19,17 @@
<span>(该号已被封)</span>
-->
</h1>
<p style="padding: 10px 0; color: #5FB878;">认证信息: 作者</p>
<p style="padding: 10px 0; color: #5FB878;">{:lang('authentication information')}</p>
<p class="fly-home-info">
<i class="iconfont icon-kiss" title="飞吻"></i><span style="color: #FF7200;">{$u.point} 飞吻</span>
<i class="iconfont icon-shijian"></i><span>{$u.create_time|date='Y-m-d'} 加入</span>
<i class="iconfont icon-chengshi"></i><span>{:session('user_id') ? '来自'.$u.city:'登录查看'}</span>
<i class="iconfont icon-kiss" title="飞吻"></i><span style="color: #FF7200;">{$u.point} {:lang('accumulate points')}</span>
<i class="iconfont icon-shijian"></i><span>{$u.create_time|date='Y-m-d'} {:lang('join')}</span>
<i class="iconfont icon-chengshi"></i><span>{:session('user_id') ? '来自'.$u.city: lang('log in to view')}</span>
</p>
<p class="fly-home-sign">{$u.sign ?:'懒得还没有签名'}</p>
<p class="fly-home-sign">{$u.sign ?: lang('it is not signed yet')}</p>
<div class="fly-sns" data-user="">
<a href="javascript:;" class="layui-btn layui-btn-primary fly-imActive" data-type="addFriend">加为好友</a>
<a href="javascript:;" class="layui-btn layui-btn-normal fly-imActive" data-type="chat">发起会话</a>
<a href="javascript:;" class="layui-btn layui-btn-primary fly-imActive" data-type="addFriend">{:lang('add friends')}</a>
<a href="javascript:;" class="layui-btn layui-btn-normal fly-imActive" data-type="chat">{:lang('start a chat')}</a>
</div>
</div>
@ -37,14 +37,14 @@
<div class="layui-row layui-col-space15">
<div class="layui-col-md6 fly-home-jie">
<div class="fly-panel">
<h3 class="fly-panel-title">{$u.nickname ?: $u.name} 最近的帖子</h3>
<h3 class="fly-panel-title">{:lang('recent statements')}</h3>
<ul class="jie-row">
{volist name="$arts" id="vo"}
<li>
{if condition="$vo.is_hot==1"}<span class="fly-jing"></span>{/if}
{if condition="$vo.is_hot==1"}<span class="fly-jing">{:lang('hot')}</span>{/if}
<a href="{:url('article/detail',['id'=>$vo.id])}" class="jie-title"> {$vo.title}</a>
<i>{$vo.create_time|date='Y-m-d'}</i>
<em class="layui-hide-xs">{$vo.pv} </em>
<em class="layui-hide-xs">{$vo.pv} {:lang('browses')}</em>
</li>
{/volist}
{if condition="$arts eq ''"}
@ -56,13 +56,13 @@
<div class="layui-col-md6 fly-home-da">
<div class="fly-panel">
<h3 class="fly-panel-title">{$u.nickname ?? $u.name} 最近的回答</h3>
<h3 class="fly-panel-title">{:lang('recent answers')}</h3>
<ul class="home-jieda">
{volist name="$reys" id="vo" empty="没有回答任何问题"}
<li>
<p>
<span>{$vo.create_time|date='Y-m-d H-m'}</span>
<a href="{:url('article/detail',['id'=>$vo.id])}" target="_blank">{$vo.title}</a>中回答
{:lang('in')}<a href="{:url('article/detail',['id'=>$vo.id])}" target="_blank">{$vo.title}</a>{:lang('reply')}
</p>
<div class="home-dacontent detail-body jieda-body photos" >{$vo.content}</div>
</li>