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
38041a47
Commit
38041a47
authored
Sep 20, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
评价次数和分数
parent
5a4fa695
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
1 deletion
+72
-1
Broker.php
application/index/controller/Broker.php
+57
-0
Evaluate.php
application/model/Evaluate.php
+14
-1
route.php
application/route.php
+1
-0
No files found.
application/index/controller/Broker.php
View file @
38041a47
...
...
@@ -725,6 +725,63 @@ class Broker extends Basic
}
}
/**
* 经纪人列表计算-评价次数和分数
* @return \think\Response
*/
public
function
agentEvaluateNumAndFractionV2
()
{
$data
=
$this
->
request
->
param
();
// $data = array(
// "agents_id" => '5775,5746,5745'
// );
$agents_ids
=
$data
[
'agents_id'
];
$result
=
[];
if
(
!
isset
(
$agents_ids
))
{
return
$this
->
response
(
"300"
,
"参数不全"
);
}
$result_
=
[];
$model
=
new
Evaluate
();
foreach
(
explode
(
','
,
$agents_ids
)
as
$k
=>
$v
)
{
$params
[
'agents_id'
]
=
$v
;
$field
=
'sum(evaluate_grade) as evaluate_grade,
count(*) as evaluate_num,
sum(evaluate_grade_attitude) as evaluate_grade_attitude,
sum(evaluate_grade_clothing) as evaluate_grade_clothing'
;
$evaluate_grade
=
$model
->
getAgentEvaluate
(
$field
,
$params
);
if
(
$evaluate_grade
[
'evaluate_grade'
])
{
$grade
=
(
$evaluate_grade
[
'evaluate_grade'
]
/
2
)
/
$evaluate_grade
[
'evaluate_num'
];
}
else
{
$grade
=
0
;
}
//评分等级 态度分
if
(
$evaluate_grade
[
'evaluate_grade_attitude'
])
{
$evaluate_grade_attitude
=
((
$evaluate_grade
[
'evaluate_grade_attitude'
]
/
2
)
/
$evaluate_grade
[
'evaluate_num'
]);
}
else
{
$evaluate_grade_attitude
=
0
;
}
//评分等级 着装分
if
(
$evaluate_grade
[
'evaluate_grade_clothing'
])
{
$evaluate_grade_clothing
=
((
$evaluate_grade
[
'evaluate_grade_clothing'
]
/
2
)
/
$evaluate_grade
[
'evaluate_num'
]);
}
else
{
$evaluate_grade_clothing
=
0
;
}
$result
[
'agents_id'
]
=
$v
;
// $result['evaluate_grade'] = $grade;//评分等级 专业分
// $result['evaluate_grade_attitude'] = $evaluate_grade_attitude;//评分等级 态度分
// $result['evaluate_grade_clothing'] = $evaluate_grade_clothing;//评分等级 着装分
$result
[
'average_evaluate'
]
=
round
((
$grade
+
$evaluate_grade_attitude
+
$evaluate_grade_clothing
)
/
3
,
1
);
//平均分
$result
[
'evaluate_num'
]
=
$evaluate_grade
[
'evaluate_num'
];
//评论数量
$result_
[]
=
$result
;
}
if
(
$result
)
{
return
$this
->
response
(
200
,
'成功'
,
$result_
);
}
else
{
return
$this
->
response
(
100
,
'失败'
);
}
}
/**
* 获得经纪人站点城市
*
...
...
application/model/Evaluate.php
View file @
38041a47
...
...
@@ -170,7 +170,7 @@ class Evaluate extends BaseModel
}
/**
*
*
查询
* @param $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
...
...
@@ -182,6 +182,19 @@ class Evaluate extends BaseModel
->
select
();
}
/**
* 查询
* @param $field
* @param string $params
* @return array|false|\PDOStatement|string|Model
*/
public
function
getAgentEvaluate
(
$field
,
$params
=
''
)
{
return
$this
->
field
(
$field
)
->
where
(
$params
)
->
find
();
}
/**
* @param $data
* @param $where
...
...
application/route.php
View file @
38041a47
...
...
@@ -354,6 +354,7 @@ Route::group('index', [
'baiduText'
=>
[
'index/news/baiduText'
,
[
'method'
=>
'GET'
]],
'agentEvaluateNumAndFraction'
=>
[
'index/broker/agentEvaluateNumAndFraction'
,
[
'method'
=>
'POST|GET'
]],
//经纪人列表计算-评价次数和分数 朱伟 2018-07-03
'agentEvaluateNumAndFractionV2'
=>
[
'index/broker/agentEvaluateNumAndFractionV2'
,
[
'method'
=>
'POST|GET'
]],
//经纪人列表计算-评价次数和分数 朱伟 2018-07-03
'uploadImg'
=>
[
'index/UploadImg/uploadImg'
,
[
'method'
=>
'POST'
]],
//全局图片上传
'uploadEditor'
=>
[
'index/UploadImg/uploadEditor'
,
[
'method'
=>
'POST'
]],
//全局图片上传
'followUpList'
=>
[
'index/HouseFollowUp/followUpList'
,
[
'method'
=>
'GET'
]],
//商铺跟进liu
...
...
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