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
b43d4e39
Commit
b43d4e39
authored
Dec 11, 2017
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
经纪人咨询
parent
6e052986
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
1 deletion
+84
-1
Broker.php
application/api/controller/Broker.php
+40
-0
Agents.php
application/model/Agents.php
+44
-1
No files found.
application/api/controller/Broker.php
0 → 100644
View file @
b43d4e39
<?php
namespace
app\api\controller
;
use
app\api\extend\Basic
;
use
app\model\Agents
;
/**
* Description of Agents
*
* @user :hujun
* @date :2017-12-11
* @time :11:15:05
* Intro :
*/
class
Broker
extends
Basic
{
/**
* 获取当前商铺或街铺的经纪人
*
* @return type
*/
public
function
index
()
{
$params
=
$this
->
params
;
$data
[
'status'
]
=
101
;
$data
[
'data'
]
=
''
;
if
(
$params
[
'house_id'
])
{
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
$agents
=
new
Agents
();
$data
[
'msg'
]
=
''
;
$data
[
'data'
]
=
$agents
->
getUser
(
$pageNo
,
$pageSize
,
''
,
'id,realname,phone'
,
''
,
$params
[
'house_id'
]);
$data
[
'data'
][
'pageNo'
]
=
$pageNo
;
$data
[
'data'
][
'pageSize'
]
=
$pageSize
;
}
else
{
$data
[
'msg'
]
=
'house_id 为空'
;
}
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]
);
}
}
application/model/Agents.php
View file @
b43d4e39
...
@@ -6,5 +6,48 @@ use think\Model;
...
@@ -6,5 +6,48 @@ use think\Model;
class
Agents
extends
Model
class
Agents
extends
Model
{
{
//
/**
* 查询经纪人
*
* @param type $pageNo
* @param type $pageSize
* @param type $order_
* @param type $field
* @param type $params
* @param type $house_id 查询该街铺和商铺的经纪人
* @return type
*/
public
function
getUser
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
,
$params
,
$house_id
=
''
)
{
if
(
$house_id
==
''
)
{
$data
=
$this
->
field
(
$field
)
->
where
(
$params
)
->
where
(
'level=2 or level=5'
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
}
else
{
$agent_data
=
$this
->
field
(
$field
)
->
where
(
'find_in_set('
.
$house_id
.
', house_ids) or find_in_set('
.
$house_id
.
', house_ids2)'
)
->
where
(
$params
)
->
where
(
'level=2 or level=5'
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
$evaluate
=
new
Evaluate
();
foreach
(
$agent_data
as
$k
=>
$v
)
{
$data
[
$k
][
'id'
]
=
$v
->
id
;
$data
[
$k
][
'realname'
]
=
$v
->
realname
;
$data
[
$k
][
'phone'
]
=
$v
->
phone
;
$data
[
$k
][
'evaluate'
]
=
$evaluate
->
where
(
'agents_id'
,
$v
->
id
)
->
count
();
$data
[
$k
][
'evaluate_grade'
]
=
$evaluate
->
where
(
'agents_id'
,
$v
->
id
)
->
avg
(
'evaluate_grade'
);
$data
[
$k
][
'label'
]
=
''
;
}
}
return
$data
;
}
}
}
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