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
8e48403e
Commit
8e48403e
authored
Oct 31, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设置角色站点
parent
61fc066e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
0 deletions
+94
-0
Auth.php
application/index/controller/Auth.php
+42
-0
AuthGroupSite.php
application/model/AuthGroupSite.php
+52
-0
No files found.
application/index/controller/Auth.php
View file @
8e48403e
...
@@ -10,6 +10,8 @@ namespace app\index\controller;
...
@@ -10,6 +10,8 @@ namespace app\index\controller;
use
app\index\extend\Basic
;
use
app\index\extend\Basic
;
use
app\model\AuthGroup
;
use
app\model\AuthGroup
;
use
app\model\AuthGroupSetting
;
use
app\model\AuthGroupSite
;
use
app\model\AuthRule
;
use
app\model\AuthRule
;
use
think\Session
;
use
think\Session
;
...
@@ -450,6 +452,45 @@ class Auth extends Basic
...
@@ -450,6 +452,45 @@ class Auth extends Basic
return
$this
->
response
(
200
,
''
,
$data
);
return
$this
->
response
(
200
,
''
,
$data
);
}
}
/**
* 设置站点
*
* @return \think\Response
*/
public
function
setSite
()
{
$m_auth
=
new
AuthGroupSite
();
$msg
=
''
;
$code
=
200
;
$list
=
[];
if
(
empty
(
$this
->
params
[
'group_id'
]))
{
return
$this
->
response
(
101
,
'参数错误'
);
}
if
(
$this
->
request
->
isGet
())
{
$data
=
$m_auth
->
getGroupSiteList
(
'a.id,b.city'
,
[
''
]);
if
(
$data
[
'status'
]
==
'successful'
)
{
$list
=
$data
[
'data'
];
}
else
{
$code
=
101
;
$msg
=
'内部错误:'
.
$data
[
'msg'
];
}
}
else
{
if
(
empty
(
$this
->
params
[
'site_id_string'
]))
{
return
$this
->
response
(
101
,
'站点数据错误'
);
}
$data
[
'group_id'
]
=
$this
->
params
[
'group_id'
];
$data
[
'site_id'
]
=
$this
->
params
[
'site_id_string'
];
$num
=
$m_auth
->
editData
(
$data
,
$this
->
params
[
'id'
]);
if
(
$num
>
0
)
{
$msg
=
"操作成功"
;
}
else
{
$code
=
101
;
$msg
=
"操作失败,或没有数据更新。"
;
}
}
return
$this
->
response
(
$code
,
$msg
,
$list
);
}
}
}
\ No newline at end of file
application/model/AuthGroupSite.php
0 → 100644
View file @
8e48403e
<?php
/**
* Created by PhpStorm.
* User: hu jun
* Date: 2018/10/31
* Time: 17:19
*/
namespace
app\model
;
use
think\Db
;
class
AuthGroupSite
extends
BaseModel
{
protected
$table
=
"auth_group_site"
;
private
$db_
;
/**
* AuthGroupSite constructor.
* @param array $data
*/
public
function
__construct
(
$data
=
[])
{
parent
::
__construct
(
$data
);
$this
->
db_
=
Db
::
name
(
$this
->
table
);
}
/**
* @param $field
* @param $where
* @return mixed
*/
public
function
getGroupSiteList
(
$field
,
$where
)
{
$data
[
'data'
]
=
[];
try
{
$list
=
$this
->
db_
->
alias
(
'a'
)
->
field
(
$field
)
->
join
(
'a_site a'
,
'a.site_id = b.id'
,
'left'
)
->
where
(
$where
)
->
select
();
$data
[
'data'
]
=
$list
;
$data
[
'status'
]
=
'successful'
;
}
catch
(
\Exception
$e
)
{
$data
[
'status'
]
=
'successful'
;
$data
[
'msg'
]
=
$e
->
getMessage
();
}
return
$data
;
}
}
\ No newline at end of file
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