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
3a0eece4
Commit
3a0eece4
authored
Jul 30, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
业绩修改
parent
2e7e6918
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
8 deletions
+60
-8
Performance.php
application/api_broker/controller/Performance.php
+11
-2
PerformanceService.php
application/api_broker/service/PerformanceService.php
+18
-4
TAgentTotalModel.php
application/model/TAgentTotalModel.php
+31
-2
No files found.
application/api_broker/controller/Performance.php
View file @
3a0eece4
...
...
@@ -42,20 +42,29 @@ class Performance extends Basic
"type" => 3, //1表示个人业绩排行 2门店 3区域
"end_day" => "",
"start_day" =>"",
'request_source_type'=>""
'request_source_type'=>"",
'second_select'=>"",
'second_id'=>"",
);*/
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
);
$list
=
$this
->
service_
->
totalAgent
(
$params
[
"agent_id"
],
$params
[
"type"
],
$end_day
,
$start_day
,
$request_source_type
,
$second_select
,
$second_id
,
$pageNo
,
$pageSize
);
//dump($list);
if
(
count
(
$list
)
>
0
)
{
$result
[
"list"
]
=
$list
[
'list'
];
...
...
application/api_broker/service/PerformanceService.php
View file @
3a0eece4
...
...
@@ -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
)
public
function
totalAgent
(
$agent_id
,
$type
,
$yesterday
,
$end_day
,
$request_source_type
,
$second_select
,
$second_id
,
$pageNo
,
$pageSize
)
{
$agent_info
=
$this
->
getStoreAndDistrict
(
$agent_id
);
...
...
@@ -70,6 +70,14 @@ 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
;
}
}
...
...
@@ -86,10 +94,16 @@ 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"
;
$result
=
$this
->
totalModel
->
getTotalByAgentId
(
$field
,
$where_
,
$type
,
$order
);
//dump($result);
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);
$arr
=
[];
$total
=
$this
->
totalModel
->
getTotalByAgentIdCount
(
$field
,
$where_
,
$type
,
$order
);
$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
...
...
application/model/TAgentTotalModel.php
View file @
3a0eece4
...
...
@@ -66,7 +66,7 @@ class TAgentTotalModel extends Model
* @param string $order
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getTotalByAgentId
(
$field
,
$params
,
$type
,
$order
=
""
)
public
function
getTotalByAgentId
(
$field
,
$params
,
$type
,
$order
=
""
,
$having
)
{
$group_
=
""
;
switch
(
$type
)
{
...
...
@@ -86,13 +86,14 @@ class TAgentTotalModel extends Model
->
where
(
$params
)
->
group
(
$group_
)
->
order
(
$order
)
->
having
(
$having
)
->
select
();
// echo $this->db_->getLastSql();
return
$result
;
}
public
function
getTotalByAgentId
Count
(
$field
,
$params
,
$type
,
$order
=
""
)
public
function
getTotalByAgentId
Page
(
$pageNo
,
$pageSize
,
$field
,
$params
,
$type
,
$order
=
""
,
$having
)
{
$group_
=
""
;
switch
(
$type
)
{
...
...
@@ -112,6 +113,34 @@ class TAgentTotalModel extends Model
->
where
(
$params
)
->
group
(
$group_
)
->
order
(
$order
)
->
having
(
$having
)
->
select
();
// echo $this->db_->getLastSql();
return
$result
;
}
public
function
getTotalByAgentIdCount
(
$field
,
$params
,
$type
,
$order
=
""
,
$having
)
{
$group_
=
""
;
switch
(
$type
)
{
case
1
:
$group_
=
"agent_id"
;
break
;
case
2
:
$group_
=
"store_id"
;
break
;
case
3
:
$group_
=
"district_id"
;
break
;
}
$result
=
$this
->
db_
->
field
(
$field
)
->
where
(
$params
)
->
group
(
$group_
)
->
order
(
$order
)
->
having
(
$having
)
->
count
();
// 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