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
2d65f91c
Commit
2d65f91c
authored
Jul 31, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
业绩当日业绩
parent
0512146c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
138 additions
and
6 deletions
+138
-6
Performance.php
application/index/controller/Performance.php
+6
-3
PerformanceService.php
application/index/service/PerformanceService.php
+132
-3
No files found.
application/index/controller/Performance.php
View file @
2d65f91c
...
@@ -44,9 +44,10 @@ class Performance extends Basic
...
@@ -44,9 +44,10 @@ class Performance extends Basic
$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"
,
strtotime
(
"-1 day"
));
$start_day
=
!
empty
(
$params
[
"start_day"
])
?
$params
[
"start_day"
]
:
date
(
"Y-m-01"
,
time
());
$start_day
=
!
empty
(
$params
[
"start_day"
])
?
$params
[
"start_day"
]
:
date
(
"Y-m-01"
,
time
());
$father_id
=
!
empty
(
$params
[
"father_id"
])
?
$params
[
"father_id"
]
:
''
;
$father_id
=
!
empty
(
$params
[
"father_id"
])
?
$params
[
"father_id"
]
:
''
;
$is_today
=
!
empty
(
$params
[
"is_today"
])
?
$params
[
"is_today"
]
:
0
;
$list
=
$this
->
service_
->
totalAgent
(
$params
[
"type"
],
$end_day
,
$start_day
,
$pageNo
,
$pageSize
,
$father_id
);
$list
=
$this
->
service_
->
totalAgent
(
$params
[
"type"
],
$end_day
,
$start_day
,
$pageNo
,
$pageSize
,
$father_id
,
$is_today
);
//dump($list);
//dump($list);
if
(
count
(
$list
)
>
0
)
{
if
(
count
(
$list
)
>
0
)
{
$result
[
"list"
]
=
$list
[
'list'
];
$result
[
"list"
]
=
$list
[
'list'
];
...
@@ -83,9 +84,10 @@ class Performance extends Basic
...
@@ -83,9 +84,10 @@ class Performance extends Basic
$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"
,
strtotime
(
"-1 day"
));
$start_day
=
!
empty
(
$params
[
"start_day"
])
?
$params
[
"start_day"
]
:
date
(
"Y-m-01"
,
time
());
$start_day
=
!
empty
(
$params
[
"start_day"
])
?
$params
[
"start_day"
]
:
date
(
"Y-m-01"
,
time
());
$father_id
=
!
empty
(
$params
[
"father_id"
])
?
$params
[
"father_id"
]
:
''
;
$father_id
=
!
empty
(
$params
[
"father_id"
])
?
$params
[
"father_id"
]
:
''
;
$is_today
=
!
empty
(
$params
[
"is_today"
])
?
$params
[
"is_today"
]
:
0
;
$list
=
$this
->
service_
->
totalAgent
(
$params
[
"type"
],
$end_day
,
$start_day
,
$pageNo
,
$pageSize
,
$father_id
);
$list
=
$this
->
service_
->
totalAgent
(
$params
[
"type"
],
$end_day
,
$start_day
,
$pageNo
,
$pageSize
,
$father_id
,
$is_today
);
//dump($list);
//dump($list);
if
(
count
(
$list
)
>
0
)
{
if
(
count
(
$list
)
>
0
)
{
$result
[
"list"
]
=
$list
[
'list'
];
$result
[
"list"
]
=
$list
[
'list'
];
...
@@ -124,9 +126,10 @@ class Performance extends Basic
...
@@ -124,9 +126,10 @@ class Performance extends Basic
$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"
,
strtotime
(
"-1 day"
));
$start_day
=
!
empty
(
$params
[
"start_day"
])
?
$params
[
"start_day"
]
:
date
(
"Y-m-01"
,
time
());
$start_day
=
!
empty
(
$params
[
"start_day"
])
?
$params
[
"start_day"
]
:
date
(
"Y-m-01"
,
time
());
$father_id
=
!
empty
(
$params
[
"father_id"
])
?
$params
[
"father_id"
]
:
''
;
$father_id
=
!
empty
(
$params
[
"father_id"
])
?
$params
[
"father_id"
]
:
''
;
$is_today
=
!
empty
(
$params
[
"is_today"
])
?
$params
[
"is_today"
]
:
0
;
$list
=
$this
->
service_
->
totalAgent
(
$params
[
"type"
],
$end_day
,
$start_day
,
$pageNo
,
$pageSize
,
$father_id
);
$list
=
$this
->
service_
->
totalAgent
(
$params
[
"type"
],
$end_day
,
$start_day
,
$pageNo
,
$pageSize
,
$father_id
,
$is_today
);
//dump($list);
//dump($list);
if
(
count
(
$list
)
>
0
)
{
if
(
count
(
$list
)
>
0
)
{
$result
[
"list"
]
=
$list
[
'list'
];
$result
[
"list"
]
=
$list
[
'list'
];
...
...
application/index/service/PerformanceService.php
View file @
2d65f91c
...
@@ -61,7 +61,7 @@ class PerformanceService
...
@@ -61,7 +61,7 @@ class PerformanceService
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
totalAgent
(
$type
,
$yesterday
,
$end_day
,
$pageNo
,
$pageSize
,
$father_id
)
public
function
totalAgent
(
$type
,
$yesterday
,
$end_day
,
$pageNo
,
$pageSize
,
$father_id
,
$is_today
)
{
{
$where_
=
[];
$where_
=
[];
$where_
[
'total_time'
]
=
array
(
'between'
,
array
(
$end_day
,
$yesterday
)
);
$where_
[
'total_time'
]
=
array
(
'between'
,
array
(
$end_day
,
$yesterday
)
);
...
@@ -104,21 +104,43 @@ class PerformanceService
...
@@ -104,21 +104,43 @@ class PerformanceService
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
if
(
$is_today
==
1
){
//todo 计算当日业绩 performance_total
//todo 计算当日业绩 performance_total
$where_
=
[];
$time
=
date
(
"Y-m-d"
,
time
());
//$where_["district_id"] = $district_id;
$where_
[
"agent_id"
]
=
$value
[
"agent_id"
];
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$time
.
" 04:00:00"
,
$time
.
" 23:59:59"
)
);
$obargain
=
new
OBargainModel
();
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$value
[
"performance_total"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//todo 计算当日成交单数 bargain_sum
//todo 计算当日成交单数 bargain_sum
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
3
);
//1表示业绩 2表示实收
$value
[
"bargain_sum"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//todo 计算当日收款数 paylog
//todo 计算当日收款数 paylog
$receivedSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$where_
,
2
);
//1表示业绩 2表示实收
$value
[
"paylog"
]
=
isset
(
$receivedSum
[
0
][
"num"
])
?
$receivedSum
[
0
][
"num"
]
:
0
;
//todo 计算当日进场数 march_in_num
//todo 计算当日进场数 march_in_num
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$where_
);
$value
[
"march_in_num"
]
=
isset
(
$addMarchInNum
[
0
][
"num"
])
?
$addMarchInNum
[
0
][
"num"
]
:
0
;
//todo 计算当日报备数 look_at_num
//todo 计算当日报备数 look_at_num
$reportNum
=
$this
->
reportModel
->
getAddReportNum
(
$where_
);
$value
[
"look_at_num"
]
=
isset
(
$reportNum
[
0
][
"num"
])
?
$reportNum
[
0
][
"num"
]
:
0
;
//todo 计算当日新增商铺数 add_house_num
//todo 计算当日新增商铺数 add_house_num
$addHouseNum
=
$this
->
houseModel
->
getAddHouseNum
(
$where_
);
$value
[
"add_house_num"
]
=
isset
(
$addHouseNum
[
0
][
"num"
])
?
$addHouseNum
[
0
][
"num"
]
:
0
;
//todo 计算当日新增客户数 add_user_num
//todo 计算当日新增客户数 add_user_num
$addUserNum
=
$this
->
userModel
->
getAddUserNum
(
$where_
);
$result
[
"add_user_num"
]
=
isset
(
$addUserNum
[
0
][
"num"
])
?
$addUserNum
[
0
][
"num"
]
:
0
;
}
array_push
(
$arr
,
$value
);
array_push
(
$arr
,
$value
);
}
}
break
;
break
;
case
2
:
case
2
:
...
@@ -135,6 +157,57 @@ class PerformanceService
...
@@ -135,6 +157,57 @@ class PerformanceService
$params
=
[];
$params
=
[];
$params
[
'store_id'
]
=
$value
[
"store_id"
];
$params
[
'store_id'
]
=
$value
[
"store_id"
];
$value
[
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
$value
[
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
if
(
$is_today
==
1
)
{
//查询总监下面门店的所有经纪人
$params
=
[];
$params
[
"store_id"
]
=
$value
[
"store_id"
];
$params
[
"status"
]
=
0
;
//只查询正常状态的经纪人
$agentsArr
=
$this
->
agentModel
->
getAgentsByStoreId
(
$params
);
$agent_total
=
count
(
$agentsArr
);
if
(
$agent_total
>
0
)
{
$agentIds
=
""
;
foreach
(
$agentsArr
as
$key1
=>
$value1
)
{
$agentIds
.=
$value1
[
"id"
]
.
","
;
}
$agentIds
=
rtrim
(
$agentIds
,
","
);
//经纪人ID集合
}
//查询总监下面门店的所有经纪人 end
//todo 计算当日业绩 performance_total
$where_
=
[];
$time
=
date
(
"Y-m-d"
,
time
());
//$where_["district_id"] = $district_id;
$where_
[
"agent_id"
]
=
array
(
"in"
,
$agentIds
);
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$time
.
" 04:00:00"
,
$time
.
" 23:59:59"
)
);
$obargain
=
new
OBargainModel
();
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$value
[
"performance_total"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//todo 计算当日成交单数 bargain_sum
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
3
);
//1表示业绩 2表示实收
$value
[
"bargain_sum"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//todo 计算当日收款数 paylog
$receivedSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$where_
,
2
);
//1表示业绩 2表示实收
$value
[
"paylog"
]
=
isset
(
$receivedSum
[
0
][
"num"
])
?
$receivedSum
[
0
][
"num"
]
:
0
;
//todo 计算当日进场数 march_in_num
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$where_
);
$value
[
"march_in_num"
]
=
isset
(
$addMarchInNum
[
0
][
"num"
])
?
$addMarchInNum
[
0
][
"num"
]
:
0
;
//todo 计算当日报备数 look_at_num
$reportNum
=
$this
->
reportModel
->
getAddReportNum
(
$where_
);
$value
[
"look_at_num"
]
=
isset
(
$reportNum
[
0
][
"num"
])
?
$reportNum
[
0
][
"num"
]
:
0
;
//todo 计算当日新增商铺数 add_house_num
$addHouseNum
=
$this
->
houseModel
->
getAddHouseNum
(
$where_
);
$value
[
"add_house_num"
]
=
isset
(
$addHouseNum
[
0
][
"num"
])
?
$addHouseNum
[
0
][
"num"
]
:
0
;
//todo 计算当日新增客户数 add_user_num
$addUserNum
=
$this
->
userModel
->
getAddUserNum
(
$where_
);
$result
[
"add_user_num"
]
=
isset
(
$addUserNum
[
0
][
"num"
])
?
$addUserNum
[
0
][
"num"
]
:
0
;
}
array_push
(
$arr
,
$value
);
array_push
(
$arr
,
$value
);
break
;
break
;
case
3
:
case
3
:
...
@@ -151,6 +224,62 @@ class PerformanceService
...
@@ -151,6 +224,62 @@ class PerformanceService
$params
=
[];
$params
=
[];
$params
[
'district_id'
]
=
$value
[
"district_id"
];
$params
[
'district_id'
]
=
$value
[
"district_id"
];
$value
[
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
$value
[
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
//计算门店人数
$params
=
[];
$params
[
'store_id'
]
=
$value
[
"store_id"
];
$value
[
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
if
(
$is_today
==
1
)
{
//查询总监下面门店的所有经纪人
$params
=
[];
$params
[
"district_id"
]
=
$value
[
"district_id"
];
$params
[
"status"
]
=
0
;
//只查询正常状态的经纪人
$agentsArr
=
$this
->
agentModel
->
getAgentsByStoreId
(
$params
);
$agent_total
=
count
(
$agentsArr
);
if
(
$agent_total
>
0
)
{
$agentIds
=
""
;
foreach
(
$agentsArr
as
$key1
=>
$value1
)
{
$agentIds
.=
$value1
[
"id"
]
.
","
;
}
$agentIds
=
rtrim
(
$agentIds
,
","
);
//经纪人ID集合
}
//查询总监下面门店的所有经纪人 end
//todo 计算当日业绩 performance_total
$where_
=
[];
$time
=
date
(
"Y-m-d"
,
time
());
//$where_["district_id"] = $district_id;
$where_
[
"agent_id"
]
=
array
(
"in"
,
$agentIds
);
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$time
.
" 04:00:00"
,
$time
.
" 23:59:59"
)
);
$obargain
=
new
OBargainModel
();
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$value
[
"performance_total"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//todo 计算当日成交单数 bargain_sum
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
3
);
//1表示业绩 2表示实收
$value
[
"bargain_sum"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//todo 计算当日收款数 paylog
$receivedSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$where_
,
2
);
//1表示业绩 2表示实收
$value
[
"paylog"
]
=
isset
(
$receivedSum
[
0
][
"num"
])
?
$receivedSum
[
0
][
"num"
]
:
0
;
//todo 计算当日进场数 march_in_num
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$where_
);
$value
[
"march_in_num"
]
=
isset
(
$addMarchInNum
[
0
][
"num"
])
?
$addMarchInNum
[
0
][
"num"
]
:
0
;
//todo 计算当日报备数 look_at_num
$reportNum
=
$this
->
reportModel
->
getAddReportNum
(
$where_
);
$value
[
"look_at_num"
]
=
isset
(
$reportNum
[
0
][
"num"
])
?
$reportNum
[
0
][
"num"
]
:
0
;
//todo 计算当日新增商铺数 add_house_num
$addHouseNum
=
$this
->
houseModel
->
getAddHouseNum
(
$where_
);
$value
[
"add_house_num"
]
=
isset
(
$addHouseNum
[
0
][
"num"
])
?
$addHouseNum
[
0
][
"num"
]
:
0
;
//todo 计算当日新增客户数 add_user_num
$addUserNum
=
$this
->
userModel
->
getAddUserNum
(
$where_
);
$result
[
"add_user_num"
]
=
isset
(
$addUserNum
[
0
][
"num"
])
?
$addUserNum
[
0
][
"num"
]
:
0
;
}
array_push
(
$arr
,
$value
);
array_push
(
$arr
,
$value
);
break
;
break
;
}
}
...
...
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