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
3e65d793
Commit
3e65d793
authored
Oct 24, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2
parent
10f3dfd1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
15 deletions
+26
-15
Basic.php
application/api_broker/extend/Basic.php
+8
-15
AAgents.php
application/model/AAgents.php
+18
-0
No files found.
application/api_broker/extend/Basic.php
View file @
3e65d793
...
...
@@ -118,7 +118,7 @@ class Basic extends Controller
*/
public
function
getCity
(
$agentId
)
{
if
(
empty
(
$
this
->
user
Id
))
{
if
(
empty
(
$
agent
Id
))
{
return
;
//没有登陆
}
...
...
@@ -130,22 +130,15 @@ class Basic extends Controller
}
if
(
empty
(
$this
->
city
)
||
empty
(
$this
->
siteId
)){
$m_agent
=
new
AAgents
();
$m_site
=
new
ASite
();
$site_id
=
$m_agent
->
getAgentsById
(
$agentId
,
'site_id'
);
if
(
$site_id
)
{
$this
->
siteId
=
$site_id
;
$city
=
$m_site
->
getSiteById
(
$site_id
,
'city'
);
if
(
$city
)
{
$this
->
city
=
$city
;
}
else
{
echo
json_encode
(
array
(
"code"
=>
"300"
,
"msg"
=>
'账号位置信息错误,请联系运营'
,
"data"
=>
[],
"type"
=>
"json"
));
exit
;
}
}
else
{
echo
json_encode
(
array
(
"code"
=>
"300"
,
"msg"
=>
'账号位置信息错误,请联系运营'
,
"data"
=>
[],
"type"
=>
"json"
));
$site_city
=
$m_agent
->
getAgentsSite
([
'a.id'
=>
$agentId
],
'a.site_id,b.city'
);
if
(
empty
(
$site_city
[
'city'
])
||
empty
(
$site_city
[
'site_id'
]))
{
echo
json_encode
(
array
(
"code"
=>
"300"
,
"msg"
=>
'账号位置信息错误,请联系运营'
,
"data"
=>
[],
"type"
=>
"json"
));
exit
;
}
else
{
$this
->
city
=
$site_city
[
'city'
];
$this
->
siteId
=
$site_city
[
'site_id'
];
}
}
}
catch
(
Exception
$exception
)
{
echo
json_encode
(
array
(
"code"
=>
"300"
,
"msg"
=>
$exception
,
"data"
=>
[],
"type"
=>
"json"
));
...
...
application/model/AAgents.php
View file @
3e65d793
...
...
@@ -1365,4 +1365,21 @@ class AAgents extends BaseModel
return
$id
;
}
/**
* @param $where
* @param $fields
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getAgentsSite
(
$where
,
$fields
)
{
return
$this
->
alias
(
'a'
)
->
field
(
$fields
)
->
join
(
'a_site b'
,
'a.site_id=b.id'
,
'left'
)
->
where
(
$where
)
->
find
();
}
}
\ 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