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
82416f68
Commit
82416f68
authored
Aug 01, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
业绩修改
parent
2171ec8e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
50 deletions
+19
-50
Performance.php
application/api_broker/controller/Performance.php
+8
-20
PerformanceService.php
application/api_broker/service/PerformanceService.php
+10
-28
TAgentTotalModel.php
application/model/TAgentTotalModel.php
+1
-2
No files found.
application/api_broker/controller/Performance.php
View file @
82416f68
...
...
@@ -37,38 +37,26 @@ class Performance extends Basic
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/*$params = array(
"agent_id" => 80,
"type" => 3, //1表示个人业绩排行 2门店 3区域
"end_day" => "",
"start_day" =>"",
'request_source_type'=>"",
'second_select'=>"",
'second_id'=>"",
);*/
/*$params = array(
"agent_id" => 80,
"type" => 3, //1表示个人业绩排行 2门店 3区域
"end_day" => "",
"start_day" =>""
);*/
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"type"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
$pageNo
=
empty
(
$this
->
params
[
'pageNo'
])
?
1
:
$this
->
params
[
'pageNo'
];
$pageSize
=
empty
(
$this
->
params
[
'pageSize'
])
?
15
:
$this
->
params
[
'pageSize'
];
//默认排序一周 2018-07-18改为本月
$end_day
=
!
empty
(
$params
[
"end_day"
])
?
$params
[
"end_day"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
//$start_day = !empty($params["start_day"]) ? $params["start_day"] : date("Y-m-d", strtotime("-7 day"));
$start_day
=
!
empty
(
$params
[
"start_day"
])
?
$params
[
"start_day"
]
:
date
(
"Y-m-01"
,
time
());
$request_source_type
=
!
empty
(
$params
[
"request_source_type"
])
?
$params
[
"request_source_type"
]
:
0
;
//请求来源默认0:App 1:PC后台
$second_select
=
!
empty
(
$params
[
"second_select"
])
?
$params
[
"second_select"
]
:
0
;
//是否二级查询 是1 否0
$second_id
=
!
empty
(
$params
[
"second_id"
])
?
$params
[
"second_id"
]
:
''
;
//是否二级查询 是1 否0
$list
=
$this
->
service_
->
totalAgent
(
$params
[
"agent_id"
],
$params
[
"type"
],
$end_day
,
$start_day
,
$request_source_type
,
$second_select
,
$second_id
,
$pageNo
,
$pageSize
);
$list
=
$this
->
service_
->
totalAgent
(
$params
[
"agent_id"
],
$params
[
"type"
],
$end_day
,
$start_day
);
//dump($list);
if
(
count
(
$list
)
>
0
)
{
$result
[
"list"
]
=
$list
[
'list'
];
$result
[
"total"
]
=
$list
[
'total'
];
$result
[
"list"
]
=
$list
;
$result
[
"start_time"
]
=
$start_day
;
$result
[
"end_time"
]
=
$end_day
;
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
...
...
application/api_broker/service/PerformanceService.php
View file @
82416f68
...
...
@@ -62,7 +62,7 @@ class PerformanceService
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
totalAgent
(
$agent_id
,
$type
,
$yesterday
,
$end_day
,
$request_source_type
,
$second_select
,
$second_id
,
$pageNo
,
$pageSize
)
public
function
totalAgent
(
$agent_id
,
$type
,
$yesterday
,
$end_day
)
{
$agent_info
=
$this
->
getStoreAndDistrict
(
$agent_id
);
...
...
@@ -70,14 +70,6 @@ class PerformanceService
$where_
=
[];
$where_
[
'total_time'
]
=
array
(
'between'
,
array
(
$end_day
,
$yesterday
)
);
$having
=
''
;
if
(
$second_select
==
1
){
if
(
$type
==
2
){
$having
=
"district_id ="
.
$second_id
;
}
elseif
(
$type
==
3
){
$having
=
"store_id ="
.
$second_id
;
}
}
...
...
@@ -94,24 +86,14 @@ class PerformanceService
$field
=
"agent_id,store_id,district_id,sum(performance) as performance_total,bargain_sum,bargain_sum,paylog,march_in_num,look_at_num,add_house_num,add_user_num"
;
$order
=
"performance_total desc"
;
if
(
$request_source_type
==
0
){
$result
=
$this
->
totalModel
->
getTotalByAgentId
(
$field
,
$where_
,
$type
,
$order
,
$having
);
}
else
{
$result
=
$this
->
totalModel
->
getTotalByAgentIdPage
(
$pageNo
,
$pageSize
,
$field
,
$where_
,
$type
,
$order
,
$having
);
}
//dump($where_);
//dump($having);
$result
=
$this
->
totalModel
->
getTotalByAgentId
(
$field
,
$where_
,
$type
,
$order
);
//dump($result);
$arr
=
[];
$total
=
$this
->
totalModel
->
getTotalByAgentIdCount
(
$field
,
$where_
,
$type
,
$order
,
$having
);
$field
=
"a.name,a.img,b.store_name,c.district_name"
;
//dump($result);
$ranking_num
=
$request_source_type
==
0
?
5
:
100
;
//App显示前5 PC后台显示前100
foreach
(
$result
as
$key
=>
$value
)
{
switch
(
$type
)
{
case
1
:
if
(
$value
[
"agent_id"
]
==
$agent_info
[
"id"
]
||
$key
<
$ranking_num
)
{
if
(
$value
[
"agent_id"
]
==
$agent_info
[
"id"
]
||
$key
<
5
)
{
$value
[
"index_"
]
=
$key
+
1
;
$value
[
"is_my"
]
=
$agent_info
[
"id"
];
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
]
]);
...
...
@@ -121,11 +103,15 @@ class PerformanceService
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
}
//计算区域人数
$params
=
[];
$params
[
'district_id'
]
=
$value
[
"district_id"
];
$value
[
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
array_push
(
$arr
,
$value
);
}
break
;
case
2
:
if
(
$value
[
"store_id"
]
==
$agent_info
[
"store_id"
]
||
$key
<
$ranking_num
)
{
if
(
$value
[
"store_id"
]
==
$agent_info
[
"store_id"
]
||
$key
<
5
)
{
$value
[
"index_"
]
=
$key
+
1
;
$value
[
"is_my"
]
=
$agent_info
[
"store_id"
];
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
],
""
]);
...
...
@@ -154,16 +140,12 @@ class PerformanceService
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
}
//计算区域人数
$params
=
[];
$params
[
'district_id'
]
=
$value
[
"district_id"
];
$value
[
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
array_push
(
$arr
,
$value
);
break
;
}
}
return
[
'list'
=>
$arr
,
'total'
=>
$total
]
;
return
$arr
;
}
...
...
application/model/TAgentTotalModel.php
View file @
82416f68
...
...
@@ -66,7 +66,7 @@ class TAgentTotalModel extends Model
* @param string $order
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getTotalByAgentId
(
$field
,
$params
,
$type
,
$order
=
""
,
$having
)
public
function
getTotalByAgentId
(
$field
,
$params
,
$type
,
$order
=
""
)
{
$group_
=
""
;
switch
(
$type
)
{
...
...
@@ -86,7 +86,6 @@ class TAgentTotalModel extends Model
->
where
(
$params
)
->
group
(
$group_
)
->
order
(
$order
)
->
having
(
$having
)
->
select
();
// echo $this->db_->getLastSql();
return
$result
;
...
...
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