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
13f52839
Commit
13f52839
authored
Apr 12, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
fb8a933e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
35 deletions
+97
-35
Performance.php
application/api_broker/controller/Performance.php
+15
-14
PerformanceService.php
application/api_broker/service/PerformanceService.php
+65
-21
AAgents.php
application/model/AAgents.php
+17
-0
No files found.
application/api_broker/controller/Performance.php
View file @
13f52839
...
...
@@ -70,9 +70,9 @@ class Performance extends Basic
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"agent_id" =>
10013
,
"start_time" => "2018-04-1
1
",
"end_time" => "2018-04-1
1
",
"agent_id" =>
4
,
"start_time" => "2018-04-1
2
",
"end_time" => "2018-04-1
2
",
"is_case" => 2,//1经纪人 2案场
"house_id" => 0
);*/
...
...
@@ -101,11 +101,11 @@ class Performance extends Basic
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/*
$params = array(
"agent_id" =>
1001
4,
"start_time" => "2018-04-1
1
",
"end_time" => "2018-04-1
1
",
);
*/
$params
=
array
(
"agent_id"
=>
4
,
"start_time"
=>
"2018-04-1
2
"
,
"end_time"
=>
"2018-04-1
2
"
,
);
try
{
$result
=
$this
->
service_
->
storePerformance
(
$params
[
"agent_id"
],
$params
[
"start_time"
],
$params
[
"end_time"
]);
...
...
@@ -124,7 +124,7 @@ class Performance extends Basic
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"agent_id" =>
10013
,
"agent_id" =>
4
,
"start_time" => "2018-03-13",
"end_time" => "2018-04-10",
"is_case" => 2,//1经纪人 2案场
...
...
@@ -156,17 +156,18 @@ class Performance extends Basic
public
function
storeOrAgentSort
(){
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"agent_id" => 1,
"start_time" => "2018-03-10",
"end_time" => "2018-03-23",
/* $params = array(
"agent_id" => 6,
"is_store" => 2,//1经纪人排行 2门店
"start_time" => "2018-04-12",
"end_time" => "2018-04-12",
);*/
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"start_time"
])
||
!
isset
(
$params
[
"end_time"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
try
{
$result
=
$this
->
service_
->
storeSortByDistrictId
(
$params
[
"agent_id"
],
$params
[
"start_time"
],
$params
[
"end_time"
]);
$result
=
$this
->
service_
->
storeSortByDistrictId
(
$params
[
"agent_id"
],
$params
[
"is_store"
]
,
$params
[
"start_time"
],
$params
[
"end_time"
]);
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
catch
(
Exception
$exception
)
{
...
...
application/api_broker/service/PerformanceService.php
View file @
13f52839
...
...
@@ -182,8 +182,8 @@ class PerformanceService
foreach
(
$house_id_arr
as
$item
)
{
$ids
.=
$item
[
"houses_id"
]
.
","
;
}
$ids
=
rtrim
(
$ids
,
","
);
if
(
!
$ids
)
{
//代表没有案场
$ids
=
rtrim
(
$ids
,
","
);
if
(
!
$ids
)
{
//代表没有案场
return
null
;
}
$condition
[
"house_ids"
]
=
$ids
;
...
...
@@ -232,8 +232,8 @@ class PerformanceService
foreach
(
$house_id_arr
as
$item
)
{
$ids
.=
$item
[
"houses_id"
]
.
","
;
}
$ids
=
rtrim
(
$ids
,
","
);
if
(
!
$ids
)
{
//代表没有案场
$ids
=
rtrim
(
$ids
,
","
);
if
(
!
$ids
)
{
//代表没有案场
return
null
;
}
$params
[
"house_ids"
]
=
$ids
;
...
...
@@ -306,7 +306,7 @@ class PerformanceService
public
function
storePerformance
(
$agent_id
,
$start_time
,
$end_time
)
{
$result
=
$this
->
agentModel
->
searchAgentsByKeyword
(
"id,store_id,district_id,level"
,
[
"id"
=>
$agent_id
]);
// dump($result);
// dump($result);
if
(
count
(
$result
)
<=
0
)
{
return
null
;
}
...
...
@@ -326,13 +326,13 @@ class PerformanceService
if
(
$start_time
==
$now_date
&&
$end_time
==
$now_date
)
{
$verify
=
new
VerifyService
();
$agent_ids
=
$verify
->
getAgentsByAgentId
(
$agent_id
);
$params
[
"agent_id"
]
=
array
(
"in"
,
$agent_ids
);
$verify
=
new
VerifyService
();
$agent_ids
=
$verify
->
getAgentsByAgentId
(
$agent_id
);
$params
[
"agent_id"
]
=
array
(
"in"
,
$agent_ids
);
$params
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$list
=
$this
->
sumDistrictPerformance
(
$params
);
// dump($list);exit;
// 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,
...
...
@@ -354,30 +354,74 @@ class PerformanceService
}
public
function
storeSortByDistrictId
(
$agent_id
,
$start_time
,
$end_time
)
/**
* @param $agent_id
* @param $is_store
* @param $start_time
* @param $end_time
* @return array|false|null|\PDOStatement|string|\think\Collection
*/
public
function
storeSortByDistrictId
(
$agent_id
,
$is_store
,
$start_time
,
$end_time
)
{
$result
=
$this
->
agentModel
->
searchAgentsByKeyword
(
"id,store_id,district_id,level"
,
[
"id"
=>
$agent_id
]);
dump
(
$result
);
if
(
count
(
$result
)
<=
0
)
{
return
null
;
}
$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"
;
$list
=
[];
$type
=
0
;
if
(
$result
[
0
][
"level"
]
==
20
)
{
$type
=
1
;
$params
[
"store_id"
]
=
$result
[
0
][
"store_id"
];
}
elseif
(
$result
[
0
][
"level"
]
==
30
||
$result
[
0
][
"level"
]
==
40
)
{
$type
=
2
;
$params
[
"district_id"
]
=
$result
[
0
][
"district_id"
];
}
$now_date
=
date
(
"Y-m-d"
,
time
());
$params
[
'total_time'
]
=
array
(
'between'
,
array
(
$start_time
,
$end_time
)
);
if
(
$start_time
==
$now_date
&&
$end_time
==
$now_date
)
{
$verify
=
new
VerifyService
();
$agent_ids
=
$verify
->
getAgentsByAgentId
(
$agent_id
);
$params
[
"id"
]
=
array
(
"in"
,
$agent_ids
);
//todo 1.获取所有经纪人
$field
=
"id as agent_id,store_id"
;
$group
=
""
;
if
(
$is_store
==
2
)
{
$group
=
"store_id"
;
}
$list
=
$this
->
agentModel
->
getAgentsList
(
$field
,
$params
,
$group
);
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
;
}
}
else
{
$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
,
$type
,
$order
);
if
(
count
(
$list
)
>
0
)
{
foreach
(
$list
as
$key
=>
$item
)
{
$fields
=
"a.name,b.store_name"
;
...
...
application/model/AAgents.php
View file @
13f52839
...
...
@@ -765,4 +765,20 @@ class AAgents extends BaseModel
->
page
(
$pageNo
)
->
select
();
}
public
function
getAgentsList
(
$field
,
$params
,
$group
){
$where_
=
[];
if
(
$group
==
"store_id"
){
$where_
[
'level'
]
=
array
(
"in"
,[
20
,
40
]);
}
$result
=
Db
::
name
(
$this
->
table
)
->
field
(
$field
)
->
where
(
$params
)
->
where
(
$where_
)
->
group
(
$group
)
->
select
();
return
$result
;
}
}
\ No newline at end of file
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