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
1ba0db05
Commit
1ba0db05
authored
Nov 01, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
站点返回值
parent
a3a7204b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
14 deletions
+42
-14
Auth.php
application/index/controller/Auth.php
+5
-1
BrokerService.php
application/index/service/BrokerService.php
+17
-8
ASite.php
application/model/ASite.php
+13
-0
AuthGroupSite.php
application/model/AuthGroupSite.php
+7
-5
No files found.
application/index/controller/Auth.php
View file @
1ba0db05
...
...
@@ -9,6 +9,7 @@
namespace
app\index\controller
;
use
app\index\extend\Basic
;
use
app\index\service\BrokerService
;
use
app\model\AuthGroup
;
use
app\model\AuthGroupSetting
;
use
app\model\AuthGroupSite
;
...
...
@@ -458,7 +459,10 @@ class Auth extends Basic
* @return \think\Response
*/
public
function
setSite
()
{
$m_auth
=
new
AuthGroupSite
();
$aa
=
new
BrokerService
();
var_dump
(
$aa
->
checkSite
(
1
,
1
));
die
;
$m_auth
=
new
AuthGroupSite
();
$msg
=
''
;
$code
=
200
;
$list
=
[];
...
...
application/index/service/BrokerService.php
View file @
1ba0db05
...
...
@@ -16,6 +16,7 @@ use app\model\AAgents;
use
app\model\ABindingDevice
;
use
app\model\ADistrict
;
use
app\model\AOperatingRecords
;
use
app\model\ASite
;
use
app\model\AuthGroupSite
;
use
app\model\GHousesToAgents
;
use
app\model\OMarchInModel
;
...
...
@@ -265,11 +266,11 @@ class BrokerService
* 检查角色是否属于某个站点
*
* @param $agent_id
* @param $site_id
* @return bool
*/
public
function
checkSite
(
$agent_id
,
$site_id
)
{
$m_site
=
new
AuthGroupSite
();
public
function
checkSite
(
$agent_id
)
{
$m_group_site
=
new
AuthGroupSite
();
$m_site
=
new
ASite
();
if
(
empty
(
$agent_id
))
{
return
false
;
}
...
...
@@ -277,12 +278,20 @@ class BrokerService
if
(
$auth_group_id
)
{
$where
[
'group_id'
]
=
$auth_group_id
;
$where
[
'status'
]
=
0
;
$where
[]
=
[
'EXP'
,
'find_in_set('
.
$site_id
.
', site_id)'
];
$id
=
$m_site
->
getSite
(
'id'
,
$where
);
if
(
count
(
$id
[
'data'
])
>
0
)
{
$result
=
true
;
}
else
{
$site_id
=
$m_group_site
->
getGroupSite
(
'site_id'
,
$where
);
$city
=
$m_site
->
getSiteByIdColumn
(
$site_id
[
'data'
][
'site_id'
],
'city'
);
if
(
empty
(
$city
))
{
$result
=
false
;
}
else
{
$num
=
$m_site
->
getTotal
([
'is_del'
=>
0
]);
if
(
count
(
$city
)
==
$num
)
{
$result
[
'city'
]
=
'all'
;
$result
[
'site_id'
]
=
'all'
;
}
else
{
$result
[
'city'
]
=
implode
(
','
,
$city
);
$result
[
'site_id'
]
=
$site_id
[
'data'
][
'site_id'
];
}
}
}
else
{
$result
=
false
;
...
...
application/model/ASite.php
View file @
1ba0db05
...
...
@@ -75,4 +75,17 @@ class ASite extends BaseModel
return
$return
;
}
/**
* 根据id获取单个字段值
*
* @param $id
* @param $fields
* @return mixed
*/
public
function
getSiteByIdColumn
(
$id
,
$fields
)
{
$return
=
$this
->
where
(
'id'
,
'in'
,
$id
)
->
column
(
$fields
);
return
$return
;
}
}
application/model/AuthGroupSite.php
View file @
1ba0db05
...
...
@@ -51,21 +51,22 @@ class AuthGroupSite extends BaseModel
}
/**
* @param $
fiel
d
* @param $
site_i
d
* @param $where
* @return mixed
*/
public
function
get
Site
(
$fiel
d
,
$where
)
{
public
function
get
GroupSite
(
$site_i
d
,
$where
)
{
$data
[
'data'
]
=
[];
try
{
$data
[
'data'
]
=
$this
->
field
(
$fiel
d
)
$data
[
'data'
]
=
$this
->
db_
->
field
(
$site_i
d
)
->
where
(
$where
)
->
select
();
->
find
();
$data
[
'status'
]
=
'successful'
;
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
$data
[
'status'
]
=
'fail'
;
$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