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
965a3e51
Commit
965a3e51
authored
Dec 12, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
周pk
parent
5f758672
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
41 deletions
+59
-41
RankingList.php
application/index/controller/RankingList.php
+1
-1
RankingListService.php
application/index/service/RankingListService.php
+58
-40
No files found.
application/index/controller/RankingList.php
View file @
965a3e51
...
@@ -34,7 +34,7 @@ class RankingList extends Basic{
...
@@ -34,7 +34,7 @@ class RankingList extends Basic{
$params
=
$this
->
params
;
$params
=
$this
->
params
;
/* $params = array(
/* $params = array(
"position" => 1,//职称 1店长 2经理 3主任 4顾问 0新人
"position" => 1,//职称 1店长 2经理 3主任 4顾问 0新人
"pk_type" =>
1
//pk类型 1月pk 2周pk
"pk_type" =>
2
//pk类型 1月pk 2周pk
);
);
$this->siteId = 10001;*/
$this->siteId = 10001;*/
if
(
!
isset
(
$params
[
"position"
])
||
$params
[
"position"
]
<
0
||
$params
[
"position"
]
>
5
){
if
(
!
isset
(
$params
[
"position"
])
||
$params
[
"position"
]
<
0
||
$params
[
"position"
]
>
5
){
...
...
application/index/service/RankingListService.php
View file @
965a3e51
...
@@ -13,8 +13,6 @@ use app\model\TAgentTotalModel;
...
@@ -13,8 +13,6 @@ use app\model\TAgentTotalModel;
* Time : 2:06 PM
* Time : 2:06 PM
* Intro:
* Intro:
*/
*/
class
RankingListService
class
RankingListService
{
{
private
$agentModel
;
private
$agentModel
;
...
@@ -51,20 +49,18 @@ class RankingListService
...
@@ -51,20 +49,18 @@ class RankingListService
* pk业绩
* pk业绩
* @param $position
* @param $position
* @param $siteId
* @param $siteId
* @param $pk_type
* @return array
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
RankingList
(
$position
,
$siteId
,
$pk_type
)
public
function
RankingList
(
$position
,
$siteId
,
$pk_type
)
{
{
$begin_time
=
date
(
'Y-m-01 00:00:00'
,
strtotime
(
'-3 month'
));
$date
=
$this
->
getTotalDate
(
$pk_type
,
1
);
$end_time
=
date
(
"Y-m-d 23:59:59"
,
strtotime
(
-
date
(
'd'
)
.
'day'
));
$begin_time
=
$date
[
"begin_time"
];
//周pk
$end_time
=
$date
[
"end_time"
];
if
(
$pk_type
==
2
){
$begin_time
=
"2018-10-01"
;
$end_time
=
"2018-10-08"
;
}
$params
[
"a.site_id"
]
=
$siteId
;
$params
[
"a.site_id"
]
=
$siteId
;
$params
[
"a.position"
]
=
$position
;
$params
[
"a.position"
]
=
$position
;
$params
[
"a.status"
]
=
array
(
"in"
,
"0,3"
);
$params
[
"a.status"
]
=
array
(
"in"
,
"0,3"
);
...
@@ -75,17 +71,15 @@ class RankingListService
...
@@ -75,17 +71,15 @@ class RankingListService
}
}
//分组
//分组
$result
=
$this
->
group
(
$resultArr
,
$siteId
,
$pk_type
);
$result
=
$this
->
group
(
$resultArr
,
$siteId
,
$pk_type
);
//循环分组后的数组,查询出各组本月业绩排行
//循环分组后的数组,查询出各组本月业绩排行
//本月
//本月
$sort_begin_time
=
date
(
'Y-m-01'
,
time
());
//本月
$sort_end_time
=
date
(
"Y-m-01"
,
strtotime
(
'+1 month'
));
$time
=
$this
->
getTotalDate
(
$pk_type
,
2
);
//周pk
$sort_begin_time
=
$time
[
"begin_time"
];
if
(
$pk_type
==
2
){
$sort_end_time
=
$time
[
"end_time"
];
$sort_begin_time
=
"2018-11-01"
;
$sort_end_time
=
"2018-11-08"
;
}
$param_now
[
"a.site_id"
]
=
$siteId
;
$param_now
[
"a.site_id"
]
=
$siteId
;
$param_now
[
"a.position"
]
=
$position
;
$param_now
[
"a.position"
]
=
$position
;
$param_now
[
"a.status"
]
=
array
(
"in"
,
"0,3"
);
$param_now
[
"a.status"
]
=
array
(
"in"
,
"0,3"
);
...
@@ -114,37 +108,32 @@ class RankingListService
...
@@ -114,37 +108,32 @@ class RankingListService
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
StoreRankingList
(
$siteId
,
$pk_type
){
public
function
StoreRankingList
(
$siteId
,
$pk_type
)
{
$date
=
$this
->
getTotalDate
(
$pk_type
,
1
);
$begin_time
=
$date
[
"begin_time"
];
$end_time
=
$date
[
"end_time"
];
$begin_time
=
date
(
'Y-m-01 00:00:00'
,
strtotime
(
'-3 month'
));
$end_time
=
date
(
"Y-m-d 23:59:59"
,
strtotime
(
-
date
(
'd'
)
.
'day'
));
//周pk
if
(
$pk_type
==
2
){
$begin_time
=
"2018-10-01"
;
$end_time
=
"2018-10-08"
;
}
$params
[
"a.site_id"
]
=
$siteId
;
$params
[
"a.site_id"
]
=
$siteId
;
$params
[
"a.status"
]
=
0
;
$params
[
"a.status"
]
=
0
;
$params
[
"a.id"
]
=
array
(
"not in"
,
"5288,3742,5292"
);
$params
[
"a.id"
]
=
array
(
"not in"
,
"5288,3742,5292"
);
$params
[
'b.total_time'
]
=
array
(
'between'
,
array
(
$begin_time
,
$end_time
));
$params
[
'b.total_time'
]
=
array
(
'between'
,
array
(
$begin_time
,
$end_time
));
$resultArr
=
$this
->
getStoreSort
(
$params
,
$begin_time
,
$end_time
,
""
,
$notIds
=
"5288,3742,5292"
);
$resultArr
=
$this
->
getStoreSort
(
$params
,
$begin_time
,
$end_time
,
""
,
$notIds
=
"5288,3742,5292"
);
if
(
count
(
$resultArr
)
<=
0
)
{
if
(
count
(
$resultArr
)
<=
0
)
{
return
null
;
return
null
;
}
}
//分组
//分组
$result
=
$this
->
group
(
$resultArr
,
$siteId
,
$pk_type
);
$result
=
$this
->
group
(
$resultArr
,
$siteId
,
$pk_type
);
//循环分组后的数组,查询出各组本月业绩排行
//循环分组后的数组,查询出各组本月业绩排行
//本月
//本月
$sort_begin_time
=
date
(
'Y-m-01'
,
time
());
$time
=
$this
->
getTotalDate
(
$pk_type
,
2
);
$sort_end_time
=
date
(
"Y-m-01"
,
strtotime
(
'+1 month'
));
$sort_begin_time
=
$time
[
"begin_time"
];
$sort_end_time
=
$time
[
"end_time"
];
if
(
$pk_type
==
2
){
$sort_begin_time
=
"2018-11-01"
;
$sort_end_time
=
"2018-11-08"
;
}
$param_now
[
"a.site_id"
]
=
$siteId
;
$param_now
[
"a.site_id"
]
=
$siteId
;
$param_now
[
"a.status"
]
=
0
;
$param_now
[
"a.status"
]
=
0
;
...
@@ -162,16 +151,46 @@ class RankingListService
...
@@ -162,16 +151,46 @@ class RankingListService
return
$result
;
return
$result
;
}
}
/**
* 统计时间
* @param $pk_type
* @return mixed
*/
private
function
getTotalDate
(
$pk_type
,
$type
)
{
if
(
$type
==
1
){
$begin_time
=
date
(
'Y-m-01 00:00:00'
,
strtotime
(
'-3 month'
));
$end_time
=
date
(
"Y-m-d 23:59:59"
,
strtotime
(
-
date
(
'd'
)
.
'day'
));
}
else
{
$begin_time
=
date
(
'Y-m-01'
,
time
());
$end_time
=
date
(
"Y-m-01"
,
strtotime
(
'+1 month'
));
}
//周pk
if
(
$pk_type
==
2
&&
$type
==
1
)
{
$begin_time
=
"2018-10-01"
;
$end_time
=
"2018-10-08"
;
}
elseif
(
$pk_type
==
2
&&
$type
==
2
){
$begin_time
=
"2018-11-01"
;
$end_time
=
"2018-11-08"
;
}
$result
[
"begin_time"
]
=
$begin_time
;
$result
[
"end_time"
]
=
$end_time
;
return
$result
;
}
/**
/**
* @param $resultArr
* @param $resultArr
* @param $siteId
* @param $siteId
* @param $pk_type
* @param $pk_type
* @return array
* @return array
*/
*/
private
function
group
(
$resultArr
,
$siteId
,
$pk_type
){
private
function
group
(
$resultArr
,
$siteId
,
$pk_type
)
{
$crewNum_
=
$this
->
crewNum
[
$siteId
];
$crewNum_
=
$this
->
crewNum
[
$siteId
];
$crewNumMax_
=
$this
->
crewNumMax
[
$siteId
];
$crewNumMax_
=
$this
->
crewNumMax
[
$siteId
];
if
(
$pk_type
==
2
)
{
if
(
$pk_type
==
2
)
{
$crewNum_
=
$this
->
weekNum
[
$siteId
];
$crewNum_
=
$this
->
weekNum
[
$siteId
];
$crewNumMax_
=
$this
->
weekNumMax
[
$siteId
];
$crewNumMax_
=
$this
->
weekNumMax
[
$siteId
];
}
}
...
@@ -225,14 +244,14 @@ class RankingListService
...
@@ -225,14 +244,14 @@ class RankingListService
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
private
function
getStoreSort
(
$params
,
$begin_time
,
$end_time
,
$ids
,
$notIds
=
""
)
private
function
getStoreSort
(
$params
,
$begin_time
,
$end_time
,
$ids
,
$notIds
=
""
)
{
{
$storeModel
=
new
AStore
();
$storeModel
=
new
AStore
();
$fields
=
"a.id,a.store_name,SUM(b.performance) as performance"
;
$fields
=
"a.id,a.store_name,SUM(b.performance) as performance"
;
//查询出有业绩的经纪人
//查询出有业绩的经纪人
$have_performance_arr
=
$storeModel
->
getStoreListByPK
(
$fields
,
$params
);
$have_performance_arr
=
$storeModel
->
getStoreListByPK
(
$fields
,
$params
);
//查询出无业绩的经纪人
//查询出无业绩的经纪人
$arr
=
$storeModel
->
getStoreListByPk1
(
$params
[
"a.site_id"
],
$begin_time
,
$end_time
,
$ids
,
$notIds
);
$arr
=
$storeModel
->
getStoreListByPk1
(
$params
[
"a.site_id"
],
$begin_time
,
$end_time
,
$ids
,
$notIds
);
return
array_merge
(
$have_performance_arr
,
$arr
);
return
array_merge
(
$have_performance_arr
,
$arr
);
}
}
...
@@ -261,7 +280,6 @@ class RankingListService
...
@@ -261,7 +280,6 @@ class RankingListService
}
}
/**
/**
* 个人业绩团队业绩前五
* 个人业绩团队业绩前五
* @param $yesterday
* @param $yesterday
...
...
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