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
f284936f
Commit
f284936f
authored
Aug 14, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
成交报告的全走统计
parent
2671f149
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
123 deletions
+7
-123
PerformanceService.php
application/api_broker/service/PerformanceService.php
+7
-123
No files found.
application/api_broker/service/PerformanceService.php
View file @
f284936f
...
...
@@ -66,11 +66,11 @@ class PerformanceService
}
$where_
=
[];
$where_
[
'
a.create_time'
]
=
array
(
'between'
,
array
(
$yesterday
.
" 00:00:00"
,
$end_day
.
" 23:59:59"
)
);
$where_
[
'
total_time'
]
=
array
(
'between'
,
array
(
$yesterday
,
$end_day
)
);
$field
=
"
b.id as agent_id,b.store_id,b.district_id,sum(a.scale_fe
e) as performance_total"
;
$field
=
"
agent_id,store_id,district_id,sum(performanc
e) as performance_total"
;
$order
=
"performance_total desc"
;
$result
=
$this
->
bargain
Model
->
getTotalByAgentId
(
$field
,
$where_
,
$type
,
$order
);
$result
=
$this
->
total
Model
->
getTotalByAgentId
(
$field
,
$where_
,
$type
,
$order
);
//dump($result);
$arr
=
[];
$field
=
"a.name,a.img,b.store_name,c.district_name"
;
...
...
@@ -140,12 +140,6 @@ 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
);
/*} 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,
sum(march_in_num) as march_in_num , sum(paylog) as paylog , sum(bargain_sum) as bargain_sum"
;
...
...
@@ -157,7 +151,6 @@ class PerformanceService
if
(
count
(
$list
)
>
0
)
{
$result
=
$list
[
0
];
}
}*/
break
;
case
2
:
//案场
$house_id_arr
=
[];
...
...
@@ -232,7 +225,7 @@ class PerformanceService
break
;
}
$result
=
$this
->
getOrderList
(
$params
,
$type
,
$is_case
);
$result
=
$this
->
getOrderList
(
$params
,
$type
,
$is_case
);
if
(
count
(
$result
)
>
0
)
{
return
$result
;
}
else
{
...
...
@@ -241,7 +234,7 @@ class PerformanceService
}
public
function
getOrderList
(
$params
,
$type
,
$is_case
)
public
function
getOrderList
(
$params
,
$type
,
$is_case
)
{
$result
=
[];
//1带看 2进场 3收款 4成交报告
...
...
@@ -261,7 +254,7 @@ class PerformanceService
break
;
case
4
:
$field
=
"DATE(a.create_time) as create_time ,b.house_id,b.house_title,c.user_phone,c.user_name,c.user_id,d.internal_title,d.internal_address"
;
$result
=
$this
->
bargainModel
->
getAddBargainOrderList
(
$field
,
$params
,
$is_case
);
$result
=
$this
->
bargainModel
->
getAddBargainOrderList
(
$field
,
$params
,
$is_case
);
break
;
default
:
...
...
@@ -335,21 +328,6 @@ class PerformanceService
$params
[
"district_id"
]
=
$result
[
0
][
"district_id"
];
}
//$list = [];
//$now_date = date("Y-m-d", time());
// 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"
)
);
$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"
;
...
...
@@ -361,7 +339,6 @@ class PerformanceService
if
(
count
(
$list
)
>
0
)
{
$list
=
$list
[
0
];
}
}*/
if
(
count
(
$list
)
>
0
)
{
return
$list
;
...
...
@@ -390,54 +367,6 @@ class PerformanceService
$verify
=
new
VerifyService
();
$agent_ids
=
$verify
->
getAgentsByAgentId
(
$agent_id
);
$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
);
// 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
)
{
$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
]);
}
}
/* } 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"
;
...
...
@@ -446,7 +375,7 @@ class PerformanceService
$order
=
"total_time desc"
;
$list
=
$this
->
totalModel
->
getTotalByAgentId
(
$field
,
$params
,
$is_store
,
$order
);
}*/
if
(
count
(
$list
)
>
0
)
{
foreach
(
$list
as
$key
=>
$item
)
{
...
...
@@ -471,51 +400,6 @@ class PerformanceService
return
$list
;
}
private
function
sumDistrictPerformance
(
$params
)
{
$result
=
[];
//房源
$addHouseNum
=
$this
->
houseModel
->
getAddHouseNum
(
$params
);
$result
[
"add_house_num"
]
=
isset
(
$addHouseNum
[
0
][
"num"
])
?
$addHouseNum
[
0
][
"num"
]
:
0
;
//dump($addHouseNum);
//客源
$addUserNum
=
$this
->
userModel
->
getAddUserNum
(
$params
);
$result
[
"add_user_num"
]
=
isset
(
$addUserNum
[
0
][
"num"
])
?
$addUserNum
[
0
][
"num"
]
:
0
;
//dump($addUserNum);
//业绩
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$params
,
1
);
//1表示业绩 2表示实收
$result
[
"performance"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//实收
$receivedSum
=
$this
->
bargainModel
->
getReceived
(
$params
);
$result
[
"official_receipts"
]
=
isset
(
$receivedSum
[
0
][
"num"
])
?
$receivedSum
[
0
][
"num"
]
:
0
;
//dump($receivedSum);
//约带看
$reportNum
=
$this
->
reportModel
->
getAddReportNum
(
$params
);
$result
[
"look_at_num"
]
=
isset
(
$reportNum
[
0
][
"num"
])
?
$reportNum
[
0
][
"num"
]
:
0
;
//dump($reportNum);
//进场
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$params
);
$result
[
"march_in_num"
]
=
isset
(
$addMarchInNum
[
0
][
"num"
])
?
$addMarchInNum
[
0
][
"num"
]
:
0
;
//dump($addMarchInNum);
//收款
$payLogNum
=
$this
->
payLogModel
->
getAddPayLogNum
(
$params
);
$result
[
"paylog"
]
=
isset
(
$payLogNum
[
0
][
"num"
])
?
$payLogNum
[
0
][
"num"
]
:
0
;
//dump($payLogNum);
// 监督
$result
[
"supervision_num"
]
=
$this
->
superviseModel
->
getSuperviseListCount
(
$params
);
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