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
6a0c43c1
Commit
6a0c43c1
authored
Nov 12, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pk
parent
210a48e5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
18 deletions
+52
-18
RankingList.php
application/index/controller/RankingList.php
+12
-4
RankingListService.php
application/index/service/RankingListService.php
+22
-11
AAgents.php
application/model/AAgents.php
+5
-1
TAgentTotalModel.php
application/model/TAgentTotalModel.php
+10
-2
route.php
application/route.php
+3
-0
No files found.
application/index/controller/RankingList.php
View file @
6a0c43c1
<?php
namespace
app\index
;
use
app\api\service\RankingListService
;
namespace
app\index
\controller
;
use
app\index\extend\Basic
;
use
app\index\service\RankingListService
;
use
think\Request
;
/**
...
...
@@ -20,7 +21,13 @@ class RankingList extends Basic{
}
public
function
getRandKingList
(){
$siteId
=
$this
->
siteId
;
$this
->
service_
->
RankingList
(
0
,
$siteId
);
$params
=
$this
->
params
;
if
(
empty
(
$params
[
"position"
])
||
$params
[
"position"
]
<
0
){
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
$result
=
$this
->
service_
->
RankingList
(
0
,
"10001"
);
if
(
count
(
$result
[
"list"
])
>
0
){
return
$this
->
response
(
"200"
,
"success"
,
$result
);
}
}
}
\ No newline at end of file
application/index/service/RankingListService.php
View file @
6a0c43c1
<?php
namespace
app\
api
\service
;
namespace
app\
index
\service
;
use
app\model\AAgents
;
use
app\model\TAgentTotalModel
;
...
...
@@ -28,21 +28,31 @@ class RankingListService
//todo 1.查询出此职称的经纪人 获取10月份某个职称的排行 职称 1店长 2经理 3主任 4顾问 0新人
//todo 2.根据上月的业绩排行获取本月业绩排行,
//todo 3.根据此职称的总经纪人数分组
$fields
=
"id,store_id,district_id"
;
$params
[
"site_id"
]
=
$siteId
;
$params
[
"position"
]
=
$position
;
$params
[
"status"
]
=
array
(
"in"
,
"0,3"
);
$fields
=
"a.id,a.store_id,a.district_id,SUM(b.performance) as performance"
;
$params
[
"a.site_id"
]
=
$siteId
;
$params
[
"a.position"
]
=
$position
;
$params
[
"a.status"
]
=
array
(
"in"
,
"0,3"
);
$begin_time
=
date
(
'Y-m-01 00:00:00'
,
strtotime
(
'-1 month'
));
$end_time
=
date
(
"Y-m-d 23:59:59"
,
strtotime
(
-
date
(
'd'
)
.
'day'
));
$params
[
'b.total_time'
]
=
array
(
'between'
,
array
(
$begin_time
,
$end_time
));
$resultArr
=
$this
->
agentModel
->
getAgentsListByPK
(
$fields
,
$params
);
if
(
count
(
$resultArr
)
<=
0
)
{
return
false
;
}
$ids
=
""
;
foreach
(
$resultArr
as
$item
)
{
$ids
.=
$item
[
"id"
]
.
","
;
}
$ids
=
rtrim
(
$ids
,
","
);
//分组
$total
=
count
(
$resultArr
);
$total_page
=
ceil
(
$total
/
20
);
//加一了的
$this
->
agentTotalModel
->
getSortPerformance
();
$residue
=
$total
%
20
;
if
(
$residue
<
19
)
{
$total_page
=
$total_page
-
1
;
}
$result
[
"list"
]
=
$resultArr
;
$result
[
"total_page"
]
=
$total_page
;
$result
[
"residue"
]
=
$residue
;
return
$result
;
}
}
\ No newline at end of file
application/model/AAgents.php
View file @
6a0c43c1
...
...
@@ -419,10 +419,14 @@ class AAgents extends BaseModel
*/
public
function
getAgentsListByPK
(
$field
=
"id"
,
$params
)
{
$params
[
"district_id"
]
=
array
(
'not in'
,
array
(
'13'
,
'14'
,
'15'
)
);
$params
[
"
a.
district_id"
]
=
array
(
'not in'
,
array
(
'13'
,
'14'
,
'15'
)
);
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"t_agent_total b"
,
"a.id=b.agent_id"
,
"left"
)
->
where
(
$params
)
->
group
(
"b.agent_id"
)
->
order
(
"performance desc"
)
->
select
();
}
...
...
application/model/TAgentTotalModel.php
View file @
6a0c43c1
...
...
@@ -314,7 +314,14 @@ class TAgentTotalModel extends Model
}
public
function
getSortPerformance
(){
public
function
getSortPerformance
(
$field
,
$params
){
$data
=
$this
->
db_
->
field
(
$field
)
->
where
(
$params
)
->
group
(
"agent_id"
)
->
order
(
"performance desc"
)
->
select
();
echo
$this
->
getLastSql
();
return
$data
;
}
}
\ No newline at end of file
application/route.php
View file @
6a0c43c1
...
...
@@ -349,6 +349,9 @@ Route::group('index', [
'inspectionRecordAll'
=>
[
'index/Report/inspectionRecordAll'
,
[
'method'
=>
'GET'
]],
//全部约带看
'setSite'
=>
[
'index/auth/setSite'
,
[
'method'
=>
'GET|POST'
]],
//设置角色站点
'getRandKingList'
=>
[
'index/RankingList/getRandKingList'
,
[
'method'
=>
'GET|POST'
]],
//设置角色站点
]);
...
...
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