Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
b3b6e9ff
Commit
b3b6e9ff
authored
Mar 09, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码修改
parent
40859902
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
74 additions
and
56 deletions
+74
-56
Auth.php
application/index/controller/Auth.php
+6
-0
Label.php
application/index/controller/Label.php
+1
-1
Login.php
application/index/controller/Login.php
+26
-25
Member.php
application/index/controller/Member.php
+2
-2
Basic.php
application/index/extend/Basic.php
+7
-1
AuthRule.php
application/model/AuthRule.php
+31
-27
route.php
application/route.php
+1
-0
No files found.
application/index/controller/Auth.php
View file @
b3b6e9ff
...
@@ -429,6 +429,11 @@ class Auth extends Basic
...
@@ -429,6 +429,11 @@ class Auth extends Basic
}
}
}
}
public
function
getMenu
()
{
$menu_data
=
Session
::
get
(
'user_info'
);
return
$this
->
response
(
200
,
'取值'
,
$menu_data
);
}
}
}
\ No newline at end of file
application/index/controller/Label.php
View file @
b3b6e9ff
...
@@ -102,7 +102,7 @@ class Label extends Basic
...
@@ -102,7 +102,7 @@ class Label extends Basic
if
(
$this
->
request
->
isPost
())
{
if
(
$this
->
request
->
isPost
())
{
$data
=
input
(
'post.'
);
$data
=
input
(
'post.'
);
$data
[
'operation_id'
]
=
Session
::
get
(
"userinfo.id"
);
//操作人id
$data
[
'operation_id'
]
=
Session
::
get
(
"user
_
info.id"
);
//操作人id
if
(
$table
->
repetition
(
'name'
,
$data
[
'name'
])
&&
empty
(
$data
[
'id'
])){
if
(
$table
->
repetition
(
'name'
,
$data
[
'name'
])
&&
empty
(
$data
[
'id'
])){
return
$this
->
response
(
100
,
'url存在重复值'
);
return
$this
->
response
(
100
,
'url存在重复值'
);
}
}
...
...
application/index/controller/Login.php
View file @
b3b6e9ff
...
@@ -34,7 +34,7 @@ class Login extends Basic
...
@@ -34,7 +34,7 @@ class Login extends Basic
/**
/**
* 登录接口
* 登录接口
*
*
* @return \think\Response
* @return \think\Response
|void
* @throws \think\Exception
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
...
@@ -49,36 +49,37 @@ class Login extends Basic
...
@@ -49,36 +49,37 @@ class Login extends Basic
return
$this
->
response
(
'100'
,
'用户名或密码不能为空'
);
return
$this
->
response
(
'100'
,
'用户名或密码不能为空'
);
}
}
$filed
=
" a.id,a.store_id,a.auth_group_id,a.district_id,a.level,a.name,a.phone,a.sex,a.img,a.status,a.admin_off,
$filed
=
" a.id,a.store_id,a.auth_group_id,a.district_id,a.level,a.name,a.phone,a.sex,a.img,a.status,a.admin_off,
if
null(s.store_name,'')store_name,ifn
ull(d.district_name,'')district_name,g.rules,g.status as g_status"
;
if
Null(s.store_name,'')store_name,ifN
ull(d.district_name,'')district_name,g.rules,g.status as g_status"
;
$join
=
[
$join
=
[
[
'a_store s'
,
' a.store_id=a.id'
,
'left'
],
[
'a_store s'
,
' a.store_id=a.id'
,
'left'
],
[
'a_district d'
,
'a.district_id=d.id'
,
'left'
],
[
'a_district d'
,
'a.district_id=d.id'
,
'left'
],
[
'auth_group g'
,
'a.auth_group_id=g.id'
,
'left'
]
[
'auth_group g'
,
'a.auth_group_id=g.id'
,
'left'
]
];
];
$params
[
"name"
]
=
$name
;
$params
[
"name"
]
=
$name
;
$password
=
md5
(
$password
);
$password
=
md5
(
$password
);
$where
=
"( phone='
{
$name
}
') and password='
$password
' "
;
$where
=
"( phone='
{
$name
}
') and password='
$password
' "
;
$list
=
$this
->
loginAgent
->
verifyUser
(
$filed
,
$join
,
$where
);
$list
=
$this
->
loginAgent
->
verifyUser
(
$filed
,
$join
,
$where
);
if
(
!
$list
)
{
if
(
!
$list
)
{
return
$this
->
response
(
'101'
,
'用户名或密码错误'
);
return
$this
->
response
(
'101'
,
'用户名或密码错误'
);
}
}
if
(
$list
[
'g_status'
]
==
'1'
)
{
if
(
$list
[
'g_status'
]
==
'1'
)
{
return
$this
->
response
(
'102'
,
'用户所在角色组已冻结'
);
return
$this
->
response
(
'102'
,
'用户所在角色组已冻结'
);
}
}
if
(
$list
[
'admin_off'
]
!=
'0'
||
empty
(
$list
[
'rules'
]))
{
if
(
$list
[
'admin_off'
]
!=
'0'
||
empty
(
$list
[
'rules'
]))
{
return
$this
->
response
(
'103'
,
'用户无后台访问权限'
);
return
$this
->
response
(
'103'
,
'用户无后台访问权限'
);
}
else
{
}
else
{
$rules
=
trim
(
$list
[
'rules'
],
','
);
$rules
=
trim
(
$list
[
'rules'
],
','
);
//查询后台菜单
//查询后台菜单
$where
=
"id in(
{
$rules
}
)and is_menu=1 and status=0 and pid=1 "
;
$where
=
"id in(
{
$rules
}
)
and is_menu=1 and status=0 and pid=1 "
;
$nav
=
$this
->
authRule
->
loginRule
(
$where
);
$nav
=
$this
->
authRule
->
loginRule
(
$where
);
$nav2
=
array
();
$nav2
=
array
();
$url
=
''
;
//跳转页面
$url
=
''
;
//跳转页面
foreach
(
$nav
as
$k
=>
$v
){
foreach
(
$nav
as
$k
=>
$v
){
if
(
$k
==
'0'
){
if
(
$k
==
'0'
){
$url
=
$v
->
name
;
$url
=
$v
->
name
;
...
@@ -91,18 +92,18 @@ class Login extends Basic
...
@@ -91,18 +92,18 @@ class Login extends Basic
//搜索菜单功能
//搜索菜单功能
$where
=
"id in(
{
$rules
}
) and is_menu=0 and status=0 "
;
$where
=
"id in(
{
$rules
}
) and is_menu=0 and status=0 "
;
$
r
=
$this
->
authRule
->
loginRule
(
$where
);
$
auth_rule
=
$this
->
authRule
->
loginRule
(
$where
);
$
r2
=
array
();
$
auth_rule_arr
=
array
();
foreach
(
$
r
as
$v
)
{
foreach
(
$
auth_rule
as
$v
)
{
$buttonUrl
=
explode
(
'/'
,
$v
->
name
);
$buttonUrl
=
explode
(
'/'
,
$v
->
name
);
$v
[
'
bt
'
]
=
$buttonUrl
[
1
];
$v
[
'
action_control
'
]
=
$buttonUrl
[
1
];
$r2
[
$v
->
pid
][]
=
$v
;
$auth_rule_arr
[
$v
->
pid
][]
=
$v
;
}
}
foreach
(
$nav2
as
$k
=>
$v
){
foreach
(
$nav2
as
$k
=>
$v
){
if
(
!
empty
(
$
r2
[
$k
])){
if
(
!
empty
(
$
auth_rule_arr
[
$k
])){
$nav2
[
$k
][
'
cz'
]
=
$r2
[
$k
];
$nav2
[
$k
][
'
operation'
]
=
$auth_rule_arr
[
$k
];
}
}
}
}
...
@@ -112,19 +113,19 @@ class Login extends Basic
...
@@ -112,19 +113,19 @@ class Login extends Basic
Session
::
set
(
"userName"
,
$list
[
"name"
]);
Session
::
set
(
"userName"
,
$list
[
"name"
]);
Session
::
set
(
"userId"
,
$list
[
"id"
]);
Session
::
set
(
"userId"
,
$list
[
"id"
]);
Session
::
set
(
"userinfo"
,
$list2
);
Session
::
set
(
"user_info"
,
$list2
);
Session
::
set
(
"usertable"
,
'agent'
);
Session
::
set
(
"lastLoginTime"
,
time
());
Session
::
set
(
"lastLoginTime"
,
time
());
$this
->
operating_records
(
$list
[
"id"
],
1
,
'后台登陆'
);
//记录操作日志
$this
->
operating_records
(
$list
[
"id"
],
1
,
'后台登陆'
);
//记录操作日志
$data
[
'url'
]
=
$url
;
$data
[
'url'
]
=
$url
;
$data
[
'data'
]
=
$list2
;
$data
[
'data'
]
=
$list2
;
if
(
$this
->
request
->
isAjax
())
{
if
(
$this
->
request
->
isAjax
())
{
return
$this
->
response
(
'200'
,
'登录成功'
,
$data
);
return
$this
->
response
(
'200'
,
'登录成功'
,
$data
);
}
else
{
}
else
{
$this
->
redirect
(
'/admin.php/'
.
$url
);
$this
->
redirect
(
'/admin.php/'
.
$url
);
}
}
return
;
}
}
/**
/**
...
...
application/index/controller/Member.php
View file @
b3b6e9ff
...
@@ -149,7 +149,7 @@ class Member extends Basic{
...
@@ -149,7 +149,7 @@ class Member extends Basic{
if
(
!
empty
(
$params
[
'content'
])
&&!
empty
(
$params
[
'user_id'
])){
if
(
!
empty
(
$params
[
'content'
])
&&!
empty
(
$params
[
'user_id'
])){
$params
[
'id'
]
=
''
;
$params
[
'id'
]
=
''
;
$params
[
'labels_id'
]
=
0
;
$params
[
'labels_id'
]
=
0
;
$params
[
'agent_id'
]
=
Session
::
get
(
"userinfo.id"
);
$params
[
'agent_id'
]
=
Session
::
get
(
"user
_
info.id"
);
$params
[
'type'
]
=
2
;
$params
[
'type'
]
=
2
;
$params
[
'create_time'
]
=
$time
;
$params
[
'create_time'
]
=
$time
;
$params
[
'update_time'
]
=
$time
;
$params
[
'update_time'
]
=
$time
;
...
@@ -177,7 +177,7 @@ class Member extends Basic{
...
@@ -177,7 +177,7 @@ class Member extends Basic{
if
(
$this
->
params
[
'id'
])
{
if
(
$this
->
params
[
'id'
])
{
//编辑
//编辑
$data
[
'start'
]
=
$this
->
user
->
edit
(
$this
->
params
,
$this
->
params
[
'id'
]);
$data
[
'start'
]
=
$this
->
user
->
edit
(
$this
->
params
,
$this
->
params
[
'id'
]);
$this
->
operating_records
(
Session
::
get
(
"userinfo.id"
),
$type
=
3
,
$remark
=
'用户编辑'
,
0
,
$this
->
params
[
'id'
]);
$this
->
operating_records
(
Session
::
get
(
"user
_
info.id"
),
$type
=
3
,
$remark
=
'用户编辑'
,
0
,
$this
->
params
[
'id'
]);
}
}
}
else
{
}
else
{
$data
[
'list'
]
=
$this
->
user
->
getClient
(
$this
->
params
[
'id'
]);
$data
[
'list'
]
=
$this
->
user
->
getClient
(
$this
->
params
[
'id'
]);
...
...
application/index/extend/Basic.php
View file @
b3b6e9ff
...
@@ -72,7 +72,7 @@ class Basic extends Controller
...
@@ -72,7 +72,7 @@ class Basic extends Controller
* @return Response
* @return Response
*/
*/
public
function
userAuth
(
$requestPath
){
public
function
userAuth
(
$requestPath
){
$session
=
Session
::
get
(
"userinfo.nav"
);
$session
=
Session
::
get
(
"user
_
info.nav"
);
$rule
=
0
;
$rule
=
0
;
//判断当前控制器用户是否拥有进入权限
//判断当前控制器用户是否拥有进入权限
foreach
(
$session
as
$v
){
foreach
(
$session
as
$v
){
...
@@ -125,6 +125,12 @@ class Basic extends Controller
...
@@ -125,6 +125,12 @@ class Basic extends Controller
return
Response
::
create
(
$result
,
$type
);
return
Response
::
create
(
$result
,
$type
);
}
}
/**
* @return Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
navigation
(){
public
function
navigation
(){
$table
=
New
AuthGroup
;
$table
=
New
AuthGroup
;
$data
=
$table
->
where
(
"pid=1"
)
->
select
();
$data
=
$table
->
where
(
"pid=1"
)
->
select
();
...
...
application/model/AuthRule.php
View file @
b3b6e9ff
...
@@ -17,9 +17,6 @@ class AuthRule extends BaseModel
...
@@ -17,9 +17,6 @@ class AuthRule extends BaseModel
// 'birthday' => 'timestamp',
// 'birthday' => 'timestamp',
// ];
// ];
/**
/**
* 将格式数组转换为树
* 将格式数组转换为树
*
*
...
@@ -47,6 +44,14 @@ class AuthRule extends BaseModel
...
@@ -47,6 +44,14 @@ class AuthRule extends BaseModel
return
;
return
;
}
}
/**
* @param $list
* @param string $title
* @param string $pk
* @param string $pid
* @param int $root
* @return array
*/
public
function
toFormatTree
(
$list
,
$title
=
'title'
,
$pk
=
'id'
,
$pid
=
'pid'
,
$root
=
0
){
public
function
toFormatTree
(
$list
,
$title
=
'title'
,
$pk
=
'id'
,
$pid
=
'pid'
,
$root
=
0
){
$list
=
list_to_tree
(
$list
,
$pk
,
$pid
,
'_child'
,
$root
);
$list
=
list_to_tree
(
$list
,
$pk
,
$pid
,
'_child'
,
$root
);
$this
->
formatTree
=
array
();
$this
->
formatTree
=
array
();
...
@@ -54,8 +59,6 @@ class AuthRule extends BaseModel
...
@@ -54,8 +59,6 @@ class AuthRule extends BaseModel
return
$this
->
formatTree
;
return
$this
->
formatTree
;
}
}
/**
/**
* 记录总数
* 记录总数
*
*
...
@@ -68,9 +71,9 @@ class AuthRule extends BaseModel
...
@@ -68,9 +71,9 @@ class AuthRule extends BaseModel
return
$this
->
alias
(
$as
)
->
where
(
$params
)
->
count
();
return
$this
->
alias
(
$as
)
->
where
(
$params
)
->
count
();
}
}
/**
* 查询不带分页
/**查询不带分页
*
* @param string $order
* @param string $order
* @param string $field
* @param string $field
* @param string $join
* @param string $join
...
@@ -81,16 +84,17 @@ class AuthRule extends BaseModel
...
@@ -81,16 +84,17 @@ class AuthRule extends BaseModel
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
authRuleList2
(
$order
=
''
,
$field
=
''
,
$join
=
''
,
$where
=
''
){
public
function
authRuleList2
(
$order
=
''
,
$field
=
''
,
$join
=
''
,
$where
=
''
){
$data
=
$this
->
field
(
$field
)
return
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
alias
(
'a'
)
->
join
(
$join
)
->
join
(
$join
)
->
where
(
$where
)
->
where
(
$where
)
->
order
(
$order
)
->
order
(
$order
)
->
select
();
->
select
();
return
$data
;
}
}
/**查询带分页
/**
* 查询带分页
*
* @param int $p
* @param int $p
* @param int $pageSize
* @param int $pageSize
* @param string $order_
* @param string $order_
...
@@ -103,7 +107,7 @@ class AuthRule extends BaseModel
...
@@ -103,7 +107,7 @@ class AuthRule extends BaseModel
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
authRuleList
(
$p
=
1
,
$pageSize
=
15
,
$order_
=
''
,
$field
=
''
,
$join
=
''
,
$where
=
''
){
public
function
authRuleList
(
$p
=
1
,
$pageSize
=
15
,
$order_
=
''
,
$field
=
''
,
$join
=
''
,
$where
=
''
){
$data
=
$this
->
field
(
$field
)
return
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
alias
(
'a'
)
->
join
(
$join
)
->
join
(
$join
)
->
where
(
$where
)
->
where
(
$where
)
...
@@ -111,10 +115,11 @@ class AuthRule extends BaseModel
...
@@ -111,10 +115,11 @@ class AuthRule extends BaseModel
->
limit
(
$pageSize
)
->
limit
(
$pageSize
)
->
page
(
$p
)
->
page
(
$p
)
->
select
();
->
select
();
return
$data
;
}
}
/**检查重复
/**
* 检查重复
*
* @param $name
* @param $name
* @param $key
* @param $key
* @return bool
* @return bool
...
@@ -123,11 +128,11 @@ class AuthRule extends BaseModel
...
@@ -123,11 +128,11 @@ class AuthRule extends BaseModel
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
repetition
(
$name
,
$key
){
public
function
repetition
(
$name
,
$key
){
$
r
=
$this
->
field
(
$name
)
$
data
=
$this
->
field
(
$name
)
->
where
(
$name
,
'='
,
$key
)
->
where
(
$name
,
'='
,
$key
)
->
select
();
->
select
();
//$this->getLastSql();
if
(
$
r
){
if
(
$
data
){
return
true
;
return
true
;
}
else
{
}
else
{
return
false
;
return
false
;
...
@@ -142,21 +147,21 @@ class AuthRule extends BaseModel
...
@@ -142,21 +147,21 @@ class AuthRule extends BaseModel
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
loginRule
(
$where
){
public
function
loginRule
(
$where
){
$r
=
$this
->
field
(
'id,name,title,pid'
)
return
$this
->
field
(
'id,name,title,pid'
)
->
where
(
$where
)
->
where
(
$where
)
->
select
();
->
select
();
// $this->getLastSql();
return
$r
;
}
}
//更新数据
/**
* 更新数据
*
* @param $name
* @param $key
* @param $ids
* @return $this
*/
public
function
saveStatus
(
$name
,
$key
,
$ids
){
public
function
saveStatus
(
$name
,
$key
,
$ids
){
$r
=
$this
->
where
(
"id"
,
'in'
,
$ids
)
->
update
([
$name
=>
$key
]);
$r
=
$this
->
where
(
"id"
,
'in'
,
$ids
)
->
update
([
$name
=>
$key
]);
return
$r
;
return
$r
;
}
}
}
}
\ No newline at end of file
application/route.php
View file @
b3b6e9ff
...
@@ -163,6 +163,7 @@ Route::group('index', [
...
@@ -163,6 +163,7 @@ Route::group('index', [
'select_by_phone'
=>
[
'index/remark/select_by_phone'
,
[
'method'
=>
'get|post'
]
],
//后台客户详情--客方搜索
'select_by_phone'
=>
[
'index/remark/select_by_phone'
,
[
'method'
=>
'get|post'
]
],
//后台客户详情--客方搜索
'setting_index'
=>
[
'index/Setting/index'
,
[
'method'
=>
'get'
]
],
//全局参数设置页面
'setting_index'
=>
[
'index/Setting/index'
,
[
'method'
=>
'get'
]
],
//全局参数设置页面
'getSetting'
=>
[
'index/Setting/getSetting'
,
[
'method'
=>
'get|post'
]
],
//新增和修改全局参数设置
'getSetting'
=>
[
'index/Setting/getSetting'
,
[
'method'
=>
'get|post'
]
],
//新增和修改全局参数设置
'getMenu'
=>
[
'index/Auth/getMenu'
,
[
'method'
=>
'get|post'
]
],
//新增和修改全局参数设置
]);
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment