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
66166503
Commit
66166503
authored
Aug 08, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
03edd457
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
109 deletions
+107
-109
Performance.php
application/api_broker/controller/Performance.php
+20
-21
PerformanceService.php
application/api_broker/service/PerformanceService.php
+87
-88
No files found.
application/api_broker/controller/Performance.php
View file @
66166503
...
...
@@ -37,22 +37,21 @@ 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" =>""
);*/
/* $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"
,
"请求参数错误"
);
}
//默认排序一周 2018-07-18改为本月
$end_day
=
!
empty
(
$params
[
"end_day"
])
?
$params
[
"end_day"
]
:
date
(
"Y-m-d"
,
strtotime
(
"+1 day"
));
$end_day
=
!
empty
(
$params
[
"end_day"
])
?
$params
[
"end_day"
]
:
date
(
"Y-m-d"
,
time
(
));
$start_day
=
!
empty
(
$params
[
"start_day"
])
?
$params
[
"start_day"
]
:
date
(
"Y-m-01"
,
time
());
$list
=
$this
->
service_
->
totalAgent
(
$params
[
"agent_id"
],
$params
[
"type"
],
$end_day
,
$start_day
);
$list
=
$this
->
service_
->
totalAgent
(
$params
[
"agent_id"
],
$params
[
"type"
],
$start_day
,
$end_day
);
if
(
count
(
$list
)
>
0
)
{
$result
[
"list"
]
=
$list
;
$result
[
"start_time"
]
=
$start_day
;
...
...
@@ -71,13 +70,13 @@ class Performance extends Basic
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"agent_id" => 9,
"start_time" => "2018-06-20",
"end_time" => "2018-06-20",
"is_case" => 1,//1经纪人 2案场
"house_id" => 0
);*/
/* $params = array(
"agent_id" => 9,
"start_time" => "2018-06-20",
"end_time" => "2018-06-20",
"is_case" => 1,//1经纪人 2案场
"house_id" => 0
);*/
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"start_time"
])
||
!
isset
(
$params
[
"end_time"
])
||
!
isset
(
$params
[
"is_case"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
...
...
@@ -103,11 +102,11 @@ class Performance extends Basic
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"agent_id" => 5739,
"start_time" => "2018-06-25",
"end_time" => "2018-06-25",
);*/
/* $params = array(
"agent_id" => 5739,
"start_time" => "2018-06-25",
"end_time" => "2018-06-25",
);*/
try
{
$result
=
$this
->
service_
->
storePerformance
(
$params
[
"agent_id"
],
$params
[
"start_time"
],
$params
[
"end_time"
]);
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
...
...
application/api_broker/service/PerformanceService.php
View file @
66166503
...
...
@@ -35,16 +35,16 @@ class PerformanceService
public
function
__construct
()
{
$this
->
totalModel
=
new
TAgentTotalModel
();
$this
->
agentModel
=
new
AAgents
();
$this
->
houseModel
=
new
GHouses
();
$this
->
userModel
=
new
Users
();
$this
->
bargainModel
=
new
OBargainModel
();
$this
->
reportModel
=
new
OReportModel
();
$this
->
marchInModel
=
new
OMarchInModel
();
$this
->
payLogModel
=
new
OPayLogModel
();
$this
->
gHousesImgModel
=
new
GHousesImgs
();
$this
->
superviseModel
=
new
ASuperviseModel
();
$this
->
totalModel
=
new
TAgentTotalModel
();
$this
->
agentModel
=
new
AAgents
();
$this
->
houseModel
=
new
GHouses
();
$this
->
userModel
=
new
Users
();
$this
->
bargainModel
=
new
OBargainModel
();
$this
->
reportModel
=
new
OReportModel
();
$this
->
marchInModel
=
new
OMarchInModel
();
$this
->
payLogModel
=
new
OPayLogModel
();
$this
->
gHousesImgModel
=
new
GHousesImgs
();
$this
->
superviseModel
=
new
ASuperviseModel
();
}
/**
...
...
@@ -65,8 +65,8 @@ class PerformanceService
$agent_info
=
$agent_info
[
0
];
}
$where_
=
[];
$where_
[
'a.create_time'
]
=
array
(
'between'
,
array
(
$
end_day
,
$yesterday
)
);
$where_
=
[];
$where_
[
'a.create_time'
]
=
array
(
'between'
,
array
(
$
yesterday
.
" 00:00:00"
,
$end_day
.
" 23:59:59"
)
);
$field
=
"b.id as agent_id,b.store_id,b.district_id,sum(a.scale_fee) as performance_total"
;
$order
=
"performance_total desc"
;
...
...
@@ -126,7 +126,6 @@ class PerformanceService
}
/**
* 个人业绩
* @param $agent_id
...
...
@@ -141,11 +140,11 @@ class PerformanceService
$result
=
[];
switch
(
$is_case
)
{
case
1
:
/* $now_date = date("Y-m-d", time());
if ($start_time == $now_date && $end_time == $now_date) {*/
$params
[
"agent_id"
]
=
$agent_id
;
$params
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$result
=
$this
->
nowTimeSum
(
$params
,
1
);
/* $now_date = date("Y-m-d", time());
if ($start_time == $now_date && $end_time == $now_date) {*/
$params
[
"agent_id"
]
=
$agent_id
;
$params
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$result
=
$this
->
nowTimeSum
(
$params
,
1
);
/*} else {
$field = "agent_id,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,
...
...
@@ -339,29 +338,29 @@ class PerformanceService
//$now_date = date("Y-m-d", time());
// if ($start_time == $now_date && $end_time == $now_date) {
// if ($start_time == $now_date && $end_time == $now_date) {
$verify
=
new
VerifyService
();
$agent_ids
=
$verify
->
getAgentsByAgentId
(
$agent_id
);
$where_
[
"agent_id"
]
=
array
(
"in"
,
$agent_ids
);
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$verify
=
new
VerifyService
();
$agent_ids
=
$verify
->
getAgentsByAgentId
(
$agent_id
);
$where_
[
"agent_id"
]
=
array
(
"in"
,
$agent_ids
);
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$list
=
$this
->
sumDistrictPerformance
(
$where_
);
$list
=
$this
->
sumDistrictPerformance
(
$where_
);
// dump($list);exit;
/* } else {
$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";
// dump($list);exit;
/* } else {
$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 ) );
$params['total_time'] = array( 'between', array( $start_time, $end_time ) );
$list = $this->totalModel->getTotalByAgentId($field, $params, $type, "");
// dump($list);
if (count($list) > 0) {
$list = $list[0];
}
}*/
$list = $this->totalModel->getTotalByAgentId($field, $params, $type, "");
// dump($list);
if (count($list) > 0) {
$list = $list[0];
}
}*/
if
(
count
(
$list
)
>
0
)
{
return
$list
;
...
...
@@ -392,68 +391,68 @@ class PerformanceService
$params
[
"agent_id"
]
=
array
(
"in"
,
$agent_ids
);
$list
=
[];
/* $now_date = date("Y-m-d", time());
if ($start_time == $now_date && $end_time == $now_date) {*/
$param
[
"id"
]
=
array
(
"in"
,
$agent_ids
);
/* $now_date = date("Y-m-d", time());
if ($start_time == $now_date && $end_time == $now_date) {*/
$param
[
"id"
]
=
array
(
"in"
,
$agent_ids
);
// 1.获取所有经纪人
$field
=
"id as agent_id,store_id"
;
$group
=
""
;
// 1.获取所有经纪人
$field
=
"id as agent_id,store_id"
;
$group
=
""
;
if
(
$is_store
==
2
)
{
$group
=
"store_id"
;
}
$list
=
$this
->
agentModel
->
getAgentsList
(
$field
,
$param
,
$group
);
//dump($list);
foreach
(
$list
as
$key
=>
$item
)
{
$totalParams
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$totalParams
[
'agent_id'
]
=
$item
[
"agent_id"
];
if
(
$is_store
==
2
)
{
$group
=
"store_id"
;
$agent_ids
=
$verify
->
getAgentsByAgentId
(
$item
[
"agent_id"
]);
$totalParams
[
'agent_id'
]
=
array
(
"in"
,
$agent_ids
);
}
$list
=
$this
->
agentModel
->
getAgentsList
(
$field
,
$param
,
$group
);
//dump($list);
foreach
(
$list
as
$key
=>
$item
)
{
$totalParams
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$totalParams
[
'agent_id'
]
=
$item
[
"agent_id"
];
if
(
$is_store
==
2
)
{
$agent_ids
=
$verify
->
getAgentsByAgentId
(
$item
[
"agent_id"
]);
$totalParams
[
'agent_id'
]
=
array
(
"in"
,
$agent_ids
);
}
//房源
$addHouseNum
=
$this
->
houseModel
->
getAddHouseNum
(
$totalParams
);
$list
[
$key
][
"add_house_num"
]
=
isset
(
$addHouseNum
[
0
][
"num"
])
?
$addHouseNum
[
0
][
"num"
]
:
0
;
//客源
$addUserNum
=
$this
->
userModel
->
getAddUserNum
(
$totalParams
);
$list
[
$key
][
"add_user_num"
]
=
isset
(
$addUserNum
[
0
][
"num"
])
?
$addUserNum
[
0
][
"num"
]
:
0
;
//进场
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$totalParams
);
$list
[
$key
][
"march_in_num"
]
=
isset
(
$addMarchInNum
[
0
][
"num"
])
?
$addMarchInNum
[
0
][
"num"
]
:
0
;
//业绩
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$totalParams
,
1
);
//1表示业绩 2表示实收
$list
[
$key
][
"performance"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//实收
$receivedSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$totalParams
,
2
);
//1表示业绩 2表示实收
$list
[
$key
][
"official_receipts"
]
=
isset
(
$receivedSum
[
0
][
"num"
])
?
$receivedSum
[
0
][
"num"
]
:
0
;
$sum
=
$list
[
$key
][
"add_house_num"
]
+
$list
[
$key
][
"add_user_num"
]
+
$list
[
$key
][
"march_in_num"
]
+
$list
[
$key
][
"performance"
]
+
$list
[
$key
][
"official_receipts"
];
if
(
$sum
<=
0
)
{
unset
(
$list
[
$key
]);
}
//房源
$addHouseNum
=
$this
->
houseModel
->
getAddHouseNum
(
$totalParams
);
$list
[
$key
][
"add_house_num"
]
=
isset
(
$addHouseNum
[
0
][
"num"
])
?
$addHouseNum
[
0
][
"num"
]
:
0
;
//客源
$addUserNum
=
$this
->
userModel
->
getAddUserNum
(
$totalParams
);
$list
[
$key
][
"add_user_num"
]
=
isset
(
$addUserNum
[
0
][
"num"
])
?
$addUserNum
[
0
][
"num"
]
:
0
;
//进场
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$totalParams
);
$list
[
$key
][
"march_in_num"
]
=
isset
(
$addMarchInNum
[
0
][
"num"
])
?
$addMarchInNum
[
0
][
"num"
]
:
0
;
//业绩
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$totalParams
,
1
);
//1表示业绩 2表示实收
$list
[
$key
][
"performance"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//实收
$receivedSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$totalParams
,
2
);
//1表示业绩 2表示实收
$list
[
$key
][
"official_receipts"
]
=
isset
(
$receivedSum
[
0
][
"num"
])
?
$receivedSum
[
0
][
"num"
]
:
0
;
$sum
=
$list
[
$key
][
"add_house_num"
]
+
$list
[
$key
][
"add_user_num"
]
+
$list
[
$key
][
"march_in_num"
]
+
$list
[
$key
][
"performance"
]
+
$list
[
$key
][
"official_receipts"
];
if
(
$sum
<=
0
)
{
unset
(
$list
[
$key
]);
}
}
/* } else {
/* } else {
$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";
$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" ) );
$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);
}*/
$order = "total_time desc";
$list = $this->totalModel->getTotalByAgentId($field, $params, $is_store, $order);
}*/
if
(
count
(
$list
)
>
0
)
{
foreach
(
$list
as
$key
=>
$item
)
{
if
(
$is_store
==
2
)
{
$fields
=
"a.name,b.store_name"
;
}
else
{
$fields
=
"c.name,b.store_name"
;
if
(
$is_store
==
2
)
{
$fields
=
"a.name,b.store_name"
;
}
else
{
$fields
=
"c.name,b.store_name"
;
}
$where_
[
"a.store_id"
]
=
$item
[
"store_id"
];
...
...
@@ -512,7 +511,7 @@ class PerformanceService
//dump($payLogNum);
// 监督
$result
[
"supervision_num"
]
=
$this
->
superviseModel
->
getSuperviseListCount
(
$params
);
$result
[
"supervision_num"
]
=
$this
->
superviseModel
->
getSuperviseListCount
(
$params
);
return
$result
;
}
...
...
@@ -741,7 +740,7 @@ class PerformanceService
$where_
[
"agent_id"
]
=
$params
[
"agent_id"
];
$where_
[
"create_time"
]
=
$params
[
"create_time"
];
$receivedList
=
$this
->
bargainModel
->
getReceivedList
(
$page_no
,
$page_size
,
$field
,
$where_
);
$receivedList
=
$this
->
bargainModel
->
getReceivedList
(
$page_no
,
$page_size
,
$field
,
$where_
);
return
[
"code"
=>
200
,
"date"
=>
$receivedList
];
}
...
...
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