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
50b56d8e
Commit
50b56d8e
authored
Nov 22, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pk
门店排行
parent
f62d8ac7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
12 deletions
+81
-12
RankingList.php
application/index/controller/RankingList.php
+67
-0
Basic.php
application/index/extend/Basic.php
+2
-2
RankingListService.php
application/index/service/RankingListService.php
+3
-5
AStore.php
application/model/AStore.php
+2
-1
route.php
application/route.php
+7
-4
No files found.
application/index/controller/RankingList.php
View file @
50b56d8e
...
...
@@ -37,13 +37,21 @@ class RankingList extends Basic{
if
(
count
(
$result
)
>
0
){
return
$this
->
response
(
"200"
,
"success"
,
$result
);
}
return
$this
->
response
(
"200"
,
"request null"
);
}
/**
* 门店业绩pk
* @return \think\Response
*/
public
function
getStoreRandKingList
(){
$params
=
$this
->
params
;
//$this->siteId = 10001;
$result
=
$this
->
service_
->
StoreRankingList
(
$this
->
siteId
);
if
(
count
(
$result
)
>
0
){
return
$this
->
response
(
"200"
,
"success"
,
$result
);
}
return
$this
->
response
(
"200"
,
"request null"
);
}
/**
...
...
@@ -62,6 +70,22 @@ class RankingList extends Basic{
return
''
;
}
/**
* 导出门店pk榜
* @return string
*/
public
function
exportReportStore
(){
$params
=
$this
->
params
;
/* $params["position"] = 1;
$this->siteId = 10001;*/
$export
=
new
ExportExcelUntil
();
$result
=
$this
->
service_
->
StoreRankingList
(
$this
->
siteId
);
$title
=
[
'部门ID'
,
'门店名称'
,
'业绩'
];
$export
->
exportTables
(
'门店PK明细表'
,
$result
,
3
,
'门店PK明细表'
,
$title
);
return
''
;
}
/**
* pk榜门店业绩和个人业绩排序显示前五
* @return \think\Response
...
...
@@ -129,4 +153,46 @@ class RankingList extends Basic{
}
return
$this
->
response
(
"200"
,
"null"
);
}
/**
* 首页团队排名
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getStoreRandKingListByAgentId
(){
$params
=
$this
->
params
;
/*$params["agent_id"] = 1;
$this->siteId = 10001;*/
if
(
!
isset
(
$params
[
"agent_id"
])){
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
$agentModel
=
new
AAgents
();
$agent_info
=
$agentModel
->
getAgentInfo
(
"id,position,store_id"
,
$params
[
"agent_id"
]);
if
(
count
(
$agent_info
)
<=
0
){
return
$this
->
response
(
"101"
,
"该经纪人不存在"
);
}
$result
=
$this
->
service_
->
StoreRankingList
(
$this
->
siteId
);
$store_id
=
$agent_info
[
"store_id"
];
$data
=
[];
foreach
(
$result
as
$key
=>
$value
){
$is_exits
=
false
;
foreach
(
$value
as
$item
){
if
(
$item
[
"id"
]
==
$store_id
){
$is_exits
=
true
;
}
}
if
(
!
$is_exits
){
unset
(
$result
[
$key
]);
}
else
{
$data
[
"list"
]
=
$value
;
$data
[
"grade"
]
=
$key
;
}
}
if
(
count
(
$result
)
>
0
){
return
$this
->
response
(
"200"
,
"success"
,
$data
);
}
return
$this
->
response
(
"200"
,
"null"
);
}
}
\ No newline at end of file
application/index/extend/Basic.php
View file @
50b56d8e
...
...
@@ -102,8 +102,8 @@ class Basic extends Controller
$this
->
userId
=
Session
::
get
(
"userId"
);
if
(
!
in_array
(
$requestPath
,
$this
->
filterVerify
))
{
$this
->
userVerify
();
$this
->
userAuth
(
$requestPath
);
/*
$this->userVerify();
$this->userAuth($requestPath);
*/
}
//获取默认城市
...
...
application/index/service/RankingListService.php
View file @
50b56d8e
...
...
@@ -163,8 +163,7 @@ class RankingListService
$end_time
=
date
(
"Y-m-01"
,
strtotime
(
'+1 month'
));
$param_now
[
"a.site_id"
]
=
$siteId
;
$param_now
[
"a.position"
]
=
$position
;
$param_now
[
"a.status"
]
=
array
(
"in"
,
"0,3"
);
$param_now
[
"a.status"
]
=
0
;
$param_now
[
'b.total_time'
]
=
array
(
'between'
,
array
(
$begin_time
,
$end_time
));
foreach
(
$result
as
$index
=>
$item
)
{
$ids
=
""
;
...
...
@@ -182,12 +181,11 @@ class RankingListService
public
function
getStoreSort
(
$params
,
$begin_time
,
$end_time
,
$ids
)
{
$storeModel
=
new
AStore
();
$fields
=
"a.id,
c.store_name,a.name,a.phon
e,SUM(b.performance) as performance"
;
$fields
=
"a.id,
a.store_nam
e,SUM(b.performance) as performance"
;
//查询出有业绩的经纪人
$have_performance_arr
=
$storeModel
->
getStoreListByPK
(
$fields
,
$params
);
//查询出无业绩的经纪人
$arr
=
$storeModel
->
getStoreListByPk1
(
$params
[
"a.site_id"
],
$params
[
"a.position"
],
$begin_time
,
$end_time
,
$ids
);
$arr
=
$storeModel
->
getStoreListByPk1
(
$params
[
"a.site_id"
],
$begin_time
,
$end_time
,
$ids
);
return
array_merge
(
$have_performance_arr
,
$arr
);
}
...
...
application/model/AStore.php
View file @
50b56d8e
...
...
@@ -13,6 +13,7 @@ use think\Db;
class
AStore
extends
BaseModel
{
protected
$table
=
'a_store'
;
/**
* 添加门店,绑定店长关系
*
...
...
@@ -297,7 +298,7 @@ class AStore extends BaseModel
//echo $this->getLastSql();
return
$data
;
}
public
function
getStoreListByPk1
(
$siteId
,
$
position
,
$
startTime
,
$endTime
,
$ids
){
public
function
getStoreListByPk1
(
$siteId
,
$startTime
,
$endTime
,
$ids
){
$str_ids
=
" "
;
if
(
$ids
){
$str_ids
=
" and a.id in (
$ids
)"
;
...
...
application/route.php
View file @
50b56d8e
...
...
@@ -359,10 +359,13 @@ Route::group('index', [
'setSite'
=>
[
'index/auth/setSite'
,
[
'method'
=>
'GET|POST'
]],
//设置角色站点
'getRandKingList'
=>
[
'index/RankingList/getRandKingList'
,
[
'method'
=>
'GET|POST'
]],
//设置角色站点
'exportReport'
=>
[
'index/RankingList/exportReport'
,
[
'method'
=>
'GET|POST'
]],
'selectPkSortByTime'
=>
[
'index/RankingList/selectPkSortByTime'
,
[
'method'
=>
'GET|POST'
]],
'getRandKingListByAgentId'
=>
[
'index/RankingList/getRandKingListByAgentId'
,
[
'method'
=>
'GET|POST'
]],
'getRandKingList'
=>
[
'index/RankingList/getRandKingList'
,
[
'method'
=>
'GET|POST'
]],
//设置角色站点
'getStoreRandKingList'
=>
[
'index/RankingList/getStoreRandKingList'
,
[
'method'
=>
'GET|POST'
]],
'exportReport'
=>
[
'index/RankingList/exportReport'
,
[
'method'
=>
'GET|POST'
]],
'exportReportStore'
=>
[
'index/RankingList/exportReportStore'
,
[
'method'
=>
'GET|POST'
]],
'selectPkSortByTime'
=>
[
'index/RankingList/selectPkSortByTime'
,
[
'method'
=>
'GET|POST'
]],
'getRandKingListByAgentId'
=>
[
'index/RankingList/getRandKingListByAgentId'
,
[
'method'
=>
'GET|POST'
]],
'getStoreRandKingListByAgentId'
=>
[
'index/RankingList/getStoreRandKingListByAgentId'
,
[
'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