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
53cab8ef
Commit
53cab8ef
authored
Sep 19, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查询个人排名
parent
7e9e55c0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
126 additions
and
2 deletions
+126
-2
PerformanceService.php
application/index/service/PerformanceService.php
+126
-2
No files found.
application/index/service/PerformanceService.php
View file @
53cab8ef
...
@@ -106,6 +106,123 @@ class PerformanceService
...
@@ -106,6 +106,123 @@ class PerformanceService
$arr
=
[];
$arr
=
[];
$field
=
"a.name,a.img,b.store_name,c.district_name"
;
$field
=
"a.name,a.img,b.store_name,c.district_name"
;
$num
=
(
$pageNo
-
1
)
*
10
;
foreach
(
$result
as
$key
=>
$value
)
{
switch
(
$type
)
{
case
1
:
$value
[
"index_"
]
=
$key
+
1
+
$num
;
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
]
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
$info
[
0
][
"name"
];
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$info
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
array_push
(
$arr
,
$value
);
}
break
;
case
2
:
$value
[
"index_"
]
=
$key
+
1
+
$num
;
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
],
""
]);
$store_name
=
$this
->
agentModel
->
getStoreOrDistrict
([
"store_id"
=>
$value
[
"store_id"
],
"level"
=>
20
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
count
(
$store_name
)
>
0
?
$store_name
[
0
][
"name"
]
:
"---"
;
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$store_name
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
}
//计算门店人数
$params
=
[];
$params
[
'store_id'
]
=
$value
[
"store_id"
];
$params
[
"status"
]
=
0
;
//只查询正常状态的经纪人
$value
[
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
array_push
(
$arr
,
$value
);
break
;
case
3
:
$value
[
"index_"
]
=
$key
+
1
+
$num
;
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
]
]);
$district_name
=
$this
->
agentModel
->
getStoreOrDistrict
([
"district_id"
=>
$value
[
"district_id"
],
"level"
=>
[
"in"
,
"30,40"
]
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
count
(
$district_name
)
>
0
?
$district_name
[
0
][
"name"
]
:
"---"
;
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$district_name
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
}
//计算区域人数
$params
=
[];
$params
[
'district_id'
]
=
$value
[
"district_id"
];
$params
[
"status"
]
=
0
;
//只查询正常状态的经纪人
$value
[
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
array_push
(
$arr
,
$value
);
break
;
}
}
if
(
count
(
$arr
)
==
1
)
{
$agent_id
=
$arr
[
0
][
'agent_id'
];
//只有一条数据说明是经纪人个人业绩查询,将完整排名查下,将个人排名查出来
$ranking_num
=
$this
->
getRanking
(
$type
,
$yesterday
,
$end_day
,
$pageNo
,
$pageSize
,
$params
,
$agent_id
);
$arr
[
0
][
'index_'
]
=
$ranking_num
;
}
return
[
'list'
=>
$arr
,
'total'
=>
$total_result
];
}
/**
* 查询完整排名
* @param $type
* @param $yesterday
* @param $end_day
* @param $pageNo
* @param $pageSize
* @param $params
* @param string $agent_id
* @return int]
*/
public
function
getRanking
(
$type
,
$yesterday
,
$end_day
,
$pageNo
,
$pageSize
,
$params
,
$agent_id
=
'5740'
)
{
$where_
=
[];
//区域搜索条件
if
(
!
empty
(
$params
[
'district_id'
]))
{
$where_
[
'district_id'
]
=
$params
[
'district_id'
];
}
//部门搜索条件
if
(
!
empty
(
$params
[
'store_id'
]))
{
$where_
[
'store_id'
]
=
$params
[
'store_id'
];
}
$where_
[
'total_time'
]
=
array
(
'between'
,
array
(
$end_day
,
$yesterday
)
);
/* 成交报告数 bargain_sum
收款数 paylog
进场数 march_in_num
报备数 look_at_num
新增商铺数 add_house_num
新增客户数 add_user_num
团队人数 team_num*/
$field
=
"agent_id,store_id,district_id,
sum(performance) as performance_total,
sum(bargain_sum) as bargain_sum_total,
sum(paylog) as paylog_total,
sum(march_in_num) as march_in_num_total,
sum(look_at_num) as look_at_num_total,
sum(add_house_num) as add_house_num_total,
sum(add_user_num) as add_user_num_total
"
;
//排序规则
$order
=
"performance_total "
.
$params
[
'order'
];
$result
=
$this
->
totalModel
->
getTotalByAgentId
(
$field
,
$where_
,
$type
,
$order
);
$arr
=
[];
$field
=
"a.name,a.img,b.store_name,c.district_name"
;
foreach
(
$result
as
$key
=>
$value
)
{
foreach
(
$result
as
$key
=>
$value
)
{
switch
(
$type
)
{
switch
(
$type
)
{
case
1
:
case
1
:
...
@@ -160,10 +277,16 @@ class PerformanceService
...
@@ -160,10 +277,16 @@ class PerformanceService
break
;
break
;
}
}
}
}
//dump($arr);exit;
foreach
(
$arr
as
$k
=>
$v
)
{
return
[
'list'
=>
$arr
,
'total'
=>
$total_result
];
if
(
$v
[
'agent_id'
]
==
$agent_id
){
return
$v
[
'index_'
];
}
}
return
1
;
}
}
}
}
\ No newline at end of file
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