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
04a8194b
Commit
04a8194b
authored
Jul 05, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
经纪人列表计算-评价次数和分数
parent
b92d5d21
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
159 additions
and
13 deletions
+159
-13
CollectHouse.php
application/api_broker/controller/CollectHouse.php
+42
-0
CollectUser.php
application/api_broker/controller/CollectUser.php
+54
-0
Agent.php
application/index/controller/Agent.php
+24
-11
ACollectHouse.php
application/model/ACollectHouse.php
+17
-0
ACollectUser.php
application/model/ACollectUser.php
+18
-0
route.php
application/route.php
+4
-2
No files found.
application/api_broker/controller/CollectHouse.php
View file @
04a8194b
...
@@ -75,4 +75,45 @@ class CollectHouse extends Basic
...
@@ -75,4 +75,45 @@ class CollectHouse extends Basic
}
}
}
}
/**
* 查询收藏数据
* User: 朱伟
* Date: 2018-07-04
* Time: 15:35:40
*/
public
function
getCollectHouseList
()
{
$params
=
$this
->
params
;
/*$params = array(
"agents_id" => 2,
);*/
if
(
!
isset
(
$params
[
"agents_id"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
$field
=
'CollectUser.id,'
;
$field
.=
'Houses.internal_title,'
;
$field
.=
'Houses.market_area,'
;
$field
.=
'Houses.rent_type,'
;
$field
.=
'Houses.rent_price,'
;
$field
.=
'Houses.shop_area_start,'
;
$field
.=
'Houses.shop_area_end,'
;
$field
.=
'Houses.shop_sign'
;
$get_params
[
'agents_id'
]
=
$params
[
"agents_id"
];
$res
=
$this
->
aCollectHouse
->
getCollectList
(
$field
,
$get_params
);
//dump($res);
if
(
$res
)
{
return
$this
->
response
(
"200"
,
"成功"
,
$res
);
}
else
{
return
$this
->
response
(
"101"
,
"失败"
);
}
}
}
}
\ No newline at end of file
application/api_broker/controller/CollectUser.php
View file @
04a8194b
...
@@ -78,4 +78,57 @@ class CollectUser extends Basic
...
@@ -78,4 +78,57 @@ class CollectUser extends Basic
}
}
}
}
/**
* 查询收藏数据
* User: 朱伟
* Date: 2018-07-04
* Time: 15:35:40
*/
public
function
getCollectUserList
()
{
$params
=
$this
->
params
;
/*$params = array(
"agents_id" => 2,
);*/
if
(
!
isset
(
$params
[
"agents_id"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
$field
=
'CollectUser.id,'
;
$field
.=
'CollectUser.status,'
;
$field
.=
'Users.id AS user_id,'
;
$field
.=
'Users.user_nick,'
;
$field
.=
'Users.user_phone,'
;
$field
.=
'Users.agent_id,'
;
$field
.=
'Users.user_status,'
;
$field
.=
'Users.industry_type,'
;
$field
.=
'Users.price_demand,'
;
$field
.=
'Users.area_demand'
;
$get_params
[
'agents_id'
]
=
$params
[
"agents_id"
];
$res
=
$this
->
aCollectUser
->
getCollectList
(
$field
,
$get_params
);
foreach
(
$res
as
$k
=>
$v
)
{
$label
=
[];
if
(
$params
[
"agents_id"
]
==
$v
[
'agent_id'
])
{
$label
[]
=
'我的'
;
}
//无效客户不显示标签
if
(
$v
[
'user_status'
]
!=
-
1
){
$res
[
$k
][
'label'
]
=
implode
(
','
,
$label
);
}
}
//dump($res);
if
(
$res
)
{
return
$this
->
response
(
"200"
,
"成功"
,
$res
);
}
else
{
return
$this
->
response
(
"101"
,
"失败"
);
}
}
}
}
\ No newline at end of file
application/index/controller/Agent.php
View file @
04a8194b
...
@@ -311,22 +311,35 @@ class Agent extends Basic
...
@@ -311,22 +311,35 @@ class Agent extends Basic
public
function
agentEvaluateNumAndFraction
()
public
function
agentEvaluateNumAndFraction
()
{
{
$data
=
$this
->
request
->
param
();
$data
=
$this
->
request
->
param
();
$agents_id
=
$data
[
'agents_id'
];
/*$data = array(
"agents_id" => '869,5758,5757,5756,5755,5754,5753,5752,5751,5750,5749,5748,5747,5746,5745'
);*/
$agents_ids
=
$data
[
'agents_id'
];
if
(
!
isset
(
$agents_id
))
{
if
(
!
isset
(
$agents_id
s
))
{
return
$this
->
response
(
"300"
,
"参数不全"
);
return
$this
->
response
(
"300"
,
"参数不全"
);
}
}
$params
[
'agents_id'
]
=
$agents_id
;
$field
=
'sum(evaluate_grade) as agent_evaluate_fraction'
;
$model
=
new
Evaluate
();
$model
=
new
Evaluate
();
$agent_evaluate_num
=
$model
->
getAgentEvaluateNum
(
$params
);
$agent_evaluate_fraction_res
=
$model
->
getAgentEvaluateFraction
(
$field
,
$params
);
$agent_evaluate_fraction
=
round
(
$agent_evaluate_fraction_res
[
0
][
'agent_evaluate_fraction'
]
/
2
/
$agent_evaluate_num
,
1
);
if
(
$agent_evaluate_num
&&
$agent_evaluate_fraction_res
)
{
foreach
(
explode
(
','
,
$agents_ids
)
as
$k
=>
$v
){
$result
[
'agent_evaluate_num'
]
=
$agent_evaluate_num
;
$params
[
'agents_id'
]
=
$v
;
$result
[
'agent_evaluate_fraction'
]
=
$agent_evaluate_fraction
;
//dump($v);
$field
=
'sum(evaluate_grade) as agent_evaluate_fraction'
;
$agent_evaluate_num
=
$model
->
getAgentEvaluateNum
(
$params
);
$agent_evaluate_fraction_res
=
$model
->
getAgentEvaluateFraction
(
$field
,
$params
);
$agent_evaluate_fraction
=
0
;
if
(
$agent_evaluate_fraction_res
[
0
][
'agent_evaluate_fraction'
]){
$agent_evaluate_fraction
=
round
(
$agent_evaluate_fraction_res
[
0
][
'agent_evaluate_fraction'
]
/
2
/
$agent_evaluate_num
,
1
);
}
$res
[
'agents_id'
]
=
$v
;
$res
[
'agent_evaluate_num'
]
=
$agent_evaluate_num
;
$res
[
'agent_evaluate_fraction'
]
=
$agent_evaluate_fraction
;
$result
[]
=
$res
;
}
if
(
$result
)
{
return
$this
->
response
(
200
,
'成功'
,
$result
);
return
$this
->
response
(
200
,
'成功'
,
$result
);
}
else
{
}
else
{
return
$this
->
response
(
100
,
'失败'
);
return
$this
->
response
(
100
,
'失败'
);
...
...
application/model/ACollectHouse.php
View file @
04a8194b
...
@@ -46,4 +46,21 @@ class ACollectHouse extends Model
...
@@ -46,4 +46,21 @@ class ACollectHouse extends Model
}
}
/**
* 查询收藏数据
* 朱伟 2018-07-04
*/
public
function
getCollectList
(
$field
,
$params
)
{
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
'CollectUser'
)
->
join
(
'g_houses Houses'
,
'CollectUser.house_id = Houses.id'
,
'left'
)
->
where
(
$params
)
->
select
();
//dump($this->getLastSql());
return
$result
;
}
}
}
application/model/ACollectUser.php
View file @
04a8194b
...
@@ -44,4 +44,22 @@ class ACollectUser extends Model
...
@@ -44,4 +44,22 @@ class ACollectUser extends Model
return
$result
;
return
$result
;
}
}
/**
* 查询收藏数据
* 朱伟 2018-07-04
*/
public
function
getCollectList
(
$field
,
$params
)
{
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
'CollectUser'
)
->
join
(
'u_users Users'
,
'CollectUser.user_id = Users.id'
,
'left'
)
->
where
(
$params
)
->
select
();
//dump($this->getLastSql());
return
$result
;
}
}
}
application/route.php
View file @
04a8194b
...
@@ -501,8 +501,10 @@ Route::group('broker', [
...
@@ -501,8 +501,10 @@ Route::group('broker', [
'getComment'
=>
[
'api_broker/news/getComment'
,
[
'method'
=>
'GET'
]
],
//商学院评论列表
'getComment'
=>
[
'api_broker/news/getComment'
,
[
'method'
=>
'GET'
]
],
//商学院评论列表
'commentNews'
=>
[
'api_broker/news/commentNews'
,
[
'method'
=>
'POST'
]
],
//评论商学院文章
'commentNews'
=>
[
'api_broker/news/commentNews'
,
[
'method'
=>
'POST'
]
],
//评论商学院文章
'addCollectUser'
=>
[
'api_broker/CollectUser/addCollectUser'
,
[
'method'
=>
'POST|GET'
]
],
//监督执行列表 朱伟 2018-06-15
'addCollectUser'
=>
[
'api_broker/CollectUser/addCollectUser'
,
[
'method'
=>
'POST|GET'
]
],
//收藏或取消收藏客户 朱伟 2018-07-04
'addCollectHouse'
=>
[
'api_broker/CollectHouse/addCollectHouse'
,
[
'method'
=>
'POST|GET'
]
],
//新增-监督执行 朱伟 2018-06-20
'addCollectHouse'
=>
[
'api_broker/CollectHouse/addCollectHouse'
,
[
'method'
=>
'POST|GET'
]
],
//收藏或取消收藏商铺 朱伟 2018-07-04
'getCollectUserList'
=>
[
'api_broker/CollectUser/getCollectUserList'
,
[
'method'
=>
'POST|GET'
]
],
//查询收藏数据 朱伟 2018-07-04
'getCollectHouseList'
=>
[
'api_broker/CollectHouse/getCollectHouseList'
,
[
'method'
=>
'POST|GET'
]
],
//查询收藏数据 朱伟 2018-07-04
]);
]);
...
...
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