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
b2c65f46
Commit
b2c65f46
authored
Oct 23, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
业绩区分站点
parent
93fa4e17
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
30 deletions
+73
-30
Performance.php
application/api_broker/controller/Performance.php
+8
-5
PerformanceService.php
application/api_broker/service/PerformanceService.php
+37
-25
TAgentTotalModel.php
application/model/TAgentTotalModel.php
+28
-0
No files found.
application/api_broker/controller/Performance.php
View file @
b2c65f46
...
...
@@ -43,7 +43,7 @@ class Performance extends Basic
"end_day" => "",
"start_day" =>""
);*/
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"type"
]))
{
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"type"
])
||
!
isset
(
$params
[
"site_id"
])
)
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
//默认排序一周 2018-07-18改为本月
...
...
@@ -51,7 +51,7 @@ class Performance extends Basic
$start_day
=
!
empty
(
$params
[
"start_day"
])
?
$params
[
"start_day"
]
:
date
(
"Y-m-01"
,
time
());
$list
=
$this
->
service_
->
totalAgent
(
$params
[
"agent_id"
],
$params
[
"type"
],
$start_day
,
$end_day
);
$list
=
$this
->
service_
->
totalAgent
(
$params
[
"agent_id"
],
$params
[
"type"
],
$start_day
,
$end_day
,
$params
[
"site_id"
]
);
if
(
count
(
$list
)
>
0
)
{
$result
[
"list"
]
=
$list
;
$result
[
"start_time"
]
=
$start_day
;
...
...
@@ -107,8 +107,11 @@ class Performance extends Basic
"start_time" => "2018-06-25",
"end_time" => "2018-06-25",
);*/
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"site_id"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
try
{
$result
=
$this
->
service_
->
storePerformance
(
$params
[
"agent_id"
],
$params
[
"start_time"
],
$params
[
"end_time"
]
.
" 23:59:59"
);
$result
=
$this
->
service_
->
storePerformance
(
$params
[
"agent_id"
],
$params
[
"start_time"
],
$params
[
"end_time"
]
.
" 23:59:59"
,
$params
[
"site_id"
]
);
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
catch
(
Exception
$exception
)
{
return
$this
->
response
(
"101"
,
"request error,msg:"
.
$exception
);
...
...
@@ -164,11 +167,11 @@ class Performance extends Basic
"end_time" => "2018-04-12",
);*/
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"start_time"
])
||
!
isset
(
$params
[
"end_time"
]
))
{
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"start_time"
])
||
!
isset
(
$params
[
"end_time"
]
)
||
!
isset
(
$params
[
"site_id"
])
)
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
try
{
$result
=
$this
->
service_
->
storeSortByDistrictId
(
$params
[
"agent_id"
],
$params
[
"is_store"
],
$params
[
"start_time"
],
$params
[
"end_time"
]
.
" 23:59:59"
);
$result
=
$this
->
service_
->
storeSortByDistrictId
(
$params
[
"agent_id"
],
$params
[
"is_store"
],
$params
[
"start_time"
],
$params
[
"end_time"
]
.
" 23:59:59"
,
$params
[
"site_id"
]
);
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
catch
(
Exception
$exception
)
{
...
...
application/api_broker/service/PerformanceService.php
View file @
b2c65f46
...
...
@@ -59,7 +59,7 @@ class PerformanceService
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
totalAgent
(
$agent_id
,
$type
,
$yesterday
,
$end_day
)
public
function
totalAgent
(
$agent_id
,
$type
,
$yesterday
,
$end_day
,
$site_id
)
{
$params
[
"agent_id"
]
=
$agent_id
;
$agent_info
=
$this
->
agentModel
->
getAgentById
(
"id,store_id,district_id,level"
,
$params
);
...
...
@@ -68,11 +68,12 @@ class PerformanceService
}
$where_
=
[];
$where_
[
'total_time'
]
=
array
(
'between'
,
array
(
$yesterday
,
$end_day
)
);
$where_
[
'd.site_id'
]
=
$site_id
;
$where_
[
'a.total_time'
]
=
array
(
'between'
,
array
(
$yesterday
,
$end_day
)
);
$field
=
"a
gent_id,store_id,district_id,sum(
performance) as performance_total"
;
$field
=
"a
.agent_id,a.store_id,a.district_id,sum(a.
performance) as performance_total"
;
$order
=
"performance_total desc"
;
$result
=
$this
->
totalModel
->
getTotalByAgentId
(
$field
,
$where_
,
$type
,
$order
);
$result
=
$this
->
totalModel
->
getTotalByAgentId
Site
(
$field
,
$where_
,
$type
,
$order
);
//dump($result);
$arr
=
[];
$field
=
"a.name,a.img,b.store_name,c.district_name"
;
...
...
@@ -312,7 +313,7 @@ class PerformanceService
* @param $end_time
* @return array|false|mixed|null|\PDOStatement|string|\think\Collection
*/
public
function
storePerformance
(
$agent_id
,
$start_time
,
$end_time
)
public
function
storePerformance
(
$agent_id
,
$start_time
,
$end_time
,
$site_id
)
{
//获取经纪人信息
$result
=
$this
->
agentModel
->
searchAgentsByKeyword
(
"id,store_id,district_id,level"
,
[
"id"
=>
$agent_id
]);
...
...
@@ -324,19 +325,24 @@ class PerformanceService
if
(
$result
[
0
][
"level"
]
==
20
)
{
$type
=
2
;
$params
[
"store_id"
]
=
$result
[
0
][
"store_id"
];
$params
[
"
a.
store_id"
]
=
$result
[
0
][
"store_id"
];
}
elseif
(
$result
[
0
][
"level"
]
==
30
||
$result
[
0
][
"level"
]
==
40
)
{
$type
=
3
;
$params
[
"district_id"
]
=
$result
[
0
][
"district_id"
];
$params
[
"
a.
district_id"
]
=
$result
[
0
][
"district_id"
];
}
$field
=
"sum(add_house_num) as add_house_num,sum(add_user_num) as add_user_num,
sum(performance) as performance,sum(official_receipts) as official_receipts,sum(look_at_num) as look_at_num,
sum(march_in_num) as march_in_num,sum(paylog) as paylog,sum(supervision_num) as supervision_num"
;
$params
[
'total_time'
]
=
array
(
'between'
,
array
(
$start_time
,
$end_time
)
);
$list
=
$this
->
totalModel
->
getTotalByAgentId
(
$field
,
$params
,
$type
,
""
);
$params
[
'd.site_id'
]
=
$site_id
;
$field
=
" sum(a.add_house_num) as add_house_num,
sum(a.add_user_num) as add_user_num,
sum(a.performance) as performance,
sum(a.official_receipts) as official_receipts,
sum(a.look_at_num) as look_at_num,
sum(a.march_in_num) as march_in_num,
sum(a.paylog) as paylog,
sum(a.supervision_num) as supervision_num"
;
$params
[
'a.total_time'
]
=
array
(
'between'
,
array
(
$start_time
,
$end_time
)
);
$list
=
$this
->
totalModel
->
getTotalByAgentIdSite
(
$field
,
$params
,
$type
,
""
);
// dump($list);
if
(
count
(
$list
)
>
0
)
{
$list
=
$list
[
0
];
...
...
@@ -357,7 +363,7 @@ class PerformanceService
* @param $end_time
* @return array|false|null|\PDOStatement|string|\think\Collection
*/
public
function
storeSortByDistrictId
(
$agent_id
,
$is_store
,
$start_time
,
$end_time
)
public
function
storeSortByDistrictId
(
$agent_id
,
$is_store
,
$start_time
,
$end_time
,
$site_id
)
{
$result
=
$this
->
agentModel
->
searchAgentsByKeyword
(
"id,store_id,district_id,level"
,
[
"id"
=>
$agent_id
]);
...
...
@@ -368,15 +374,21 @@ class PerformanceService
$verify
=
new
VerifyService
();
$agent_ids
=
$verify
->
getAgentsByAgentId
(
$agent_id
);
$params
[
"agent_id"
]
=
array
(
"in"
,
$agent_ids
);
$field
=
"store_id,agent_id,sum(add_house_num) as add_house_num,sum(add_user_num) as add_user_num,sum(march_in_num) as march_in_num,
sum(performance) as performance,sum(official_receipts) as official_receipts"
;
$params
[
'total_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$order
=
"total_time desc"
;
$list
=
$this
->
totalModel
->
getTotalByAgentId
(
$field
,
$params
,
$is_store
,
$order
);
$params
[
"a.agent_id"
]
=
array
(
"in"
,
$agent_ids
);
$params
[
'd.site_id'
]
=
$site_id
;
$field
=
"
a.store_id,
a.agent_id,
sum(a.add_house_num) as add_house_num,
sum(a.add_user_num) as add_user_num,
sum(a.march_in_num) as march_in_num,
sum(a.performance) as performance,
sum(a.official_receipts) as official_receipts"
;
$params
[
'a.total_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$order
=
"a.total_time desc"
;
$list
=
$this
->
totalModel
->
getTotalByAgentIdSite
(
$field
,
$params
,
$is_store
,
$order
);
if
(
count
(
$list
)
>
0
)
{
...
...
application/model/TAgentTotalModel.php
View file @
b2c65f46
...
...
@@ -113,6 +113,34 @@ class TAgentTotalModel extends Model
}
public
function
getTotalByAgentIdSite
(
$field
,
$params
,
$type
,
$order
=
""
)
{
$group_
=
""
;
switch
(
$type
)
{
case
1
:
$group_
=
"a.agent_id"
;
break
;
case
2
:
$group_
=
"a.store_id"
;
break
;
case
3
:
$group_
=
"a.district_id"
;
break
;
}
$result
=
$this
->
db_
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'a_district d'
,
'a.district_id = d.id'
,
'left'
)
->
where
(
$params
)
->
group
(
$group_
)
->
order
(
$order
)
->
select
();
echo
$this
->
db_
->
getLastSql
();
return
$result
;
}
public
function
getTotalByAgentIdPage
(
$pageNo
,
$pageSize
,
$field
,
$params
,
$type
,
$order
=
""
)
{
$group_
=
""
;
...
...
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