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
ebf579c7
Commit
ebf579c7
authored
Jun 19, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
房源列表
parent
a783a75a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
190 additions
and
42 deletions
+190
-42
Performance.php
application/api_broker/controller/Performance.php
+66
-30
PerformanceService.php
application/api_broker/service/PerformanceService.php
+62
-12
PerformanceValidate.php
application/api_broker/validate/PerformanceValidate.php
+32
-0
GHouses.php
application/model/GHouses.php
+25
-0
route.php
application/route.php
+5
-0
No files found.
application/api_broker/controller/Performance.php
View file @
ebf579c7
...
...
@@ -37,19 +37,19 @@ 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"
,
"请求参数错误"
);
}
//默认排序一周
$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-d"
,
strtotime
(
"-7 day"
));
$list
=
$this
->
service_
->
totalAgent
(
$params
[
"agent_id"
],
$params
[
"type"
],
$end_day
,
$start_day
);
$list
=
$this
->
service_
->
totalAgent
(
$params
[
"agent_id"
],
$params
[
"type"
],
$end_day
,
$start_day
);
//dump($list);
if
(
count
(
$list
)
>
0
)
{
$result
[
"list"
]
=
$list
;
...
...
@@ -76,7 +76,7 @@ class Performance extends Basic
"is_case" => 2,//1经纪人 2案场
"house_id" => 0
);*/
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"start_time"
])
||
!
isset
(
$params
[
"end_time"
]
)
||
!
isset
(
$params
[
"is_case"
]
))
{
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"start_time"
])
||
!
isset
(
$params
[
"end_time"
]
)
||
!
isset
(
$params
[
"is_case"
]
))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
$house_id
=
0
;
...
...
@@ -101,11 +101,11 @@ class Performance extends Basic
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"agent_id" => 6,
"start_time" => "2018-04-09",
"end_time" => "2018-04-12",
);*/
/* $params = array(
"agent_id" => 6,
"start_time" => "2018-04-09",
"end_time" => "2018-04-12",
);*/
try
{
$result
=
$this
->
service_
->
storePerformance
(
$params
[
"agent_id"
],
$params
[
"start_time"
],
$params
[
"end_time"
]);
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
...
...
@@ -122,14 +122,14 @@ class Performance extends Basic
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"agent_id" => 6,
"start_time" => "2018-04-09",
"end_time" => "2018-04-12",
"is_case" => 1,//1经纪人 2案场
"house_id" => 0,
"type" => 1 // 1带看 2进场 3收款 4成交报告
);*/
/* $params = array(
"agent_id" => 6,
"start_time" => "2018-04-09",
"end_time" => "2018-04-12",
"is_case" => 1,//1经纪人 2案场
"house_id" => 0,
"type" => 1 // 1带看 2进场 3收款 4成交报告
);*/
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"start_time"
])
||
!
isset
(
$params
[
"end_time"
])
||
!
isset
(
$params
[
"type"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
...
...
@@ -152,21 +152,22 @@ class Performance extends Basic
* 门店或者经纪人业绩排行
* @return \think\Response
*/
public
function
storeOrAgentSort
(){
public
function
storeOrAgentSort
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"agent_id" => 6,
"is_store" => 1,//1经纪人排行 2门店
"start_time" => "2018-04-12",
"end_time" => "2018-04-12",
/* $params = array(
"agent_id" => 6,
"is_store" => 1,//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
[
"is_store"
]
,
$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
)
{
...
...
@@ -174,4 +175,39 @@ class Performance extends Basic
}
}
/**
* 获取时间段新增房源数据
* @return \think\Response
*/
public
function
housingResource
()
{
$params
=
$this
->
params
;
/* $params = array(
"type" => 1, //1个人,2经纪人
"agent_id" => 1,
"start_time" => "2018-04-12",
"end_time" => "2018-04-12",
"page_no" => 1,
"page_size" => 15
);*/
$checkResult
=
$this
->
validate
(
$params
,
"PerformanceValidate.verify"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
//默认排序一周
$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-d"
,
strtotime
(
"-7 day"
));
$page_no
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$page_size
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
$result
=
$this
->
service_
->
getHousingResourceList
(
$params
[
"type"
],
$params
[
"agent_id"
],
$start_day
,
$end_day
,
$page_no
,
$page_size
);
if
(
$result
[
"code"
]
==
101
)
{
return
$this
->
response
(
"101"
,
$result
[
"date"
]);
}
else
{
return
$this
->
response
(
"200"
,
"success"
,
$result
[
"date"
]);
}
}
}
application/api_broker/service/PerformanceService.php
View file @
ebf579c7
...
...
@@ -4,6 +4,7 @@ namespace app\api_broker\service;
use
app\model\AAgents
;
use
app\model\GHouses
;
use
app\model\GHousesImgs
;
use
app\model\OBargainModel
;
use
app\model\OMarchInModel
;
use
app\model\OPayLogModel
;
...
...
@@ -30,6 +31,7 @@ class PerformanceService
private
$reportModel
;
private
$marchInModel
;
private
$payLogModel
;
private
$gHousesImgModel
;
public
function
__construct
()
{
...
...
@@ -43,6 +45,7 @@ class PerformanceService
$this
->
reportModel
=
new
OReportModel
();
$this
->
marchInModel
=
new
OMarchInModel
();
$this
->
payLogModel
=
new
OPayLogModel
();
$this
->
gHousesImgModel
=
new
GHousesImgs
();
}
...
...
@@ -91,10 +94,10 @@ class PerformanceService
if
(
$value
[
"store_id"
]
==
$agent_info
[
"store_id"
]
||
$key
<
5
)
{
$value
[
"index_"
]
=
$key
+
1
;
$value
[
"is_my"
]
=
$agent_info
[
"store_id"
];
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
]
,
""
]);
$store_name
=
$this
->
agentModel
->
getStoreOrDistrict
([
"store_id"
=>
$value
[
"store_id"
],
"level"
=>
20
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
count
(
$store_name
)
>
0
?
$store_name
[
0
][
"name"
]
:
"---"
;
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
]
,
""
]);
$store_name
=
$this
->
agentModel
->
getStoreOrDistrict
([
"store_id"
=>
$value
[
"store_id"
],
"level"
=>
20
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
count
(
$store_name
)
>
0
?
$store_name
[
0
][
"name"
]
:
"---"
;
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$store_name
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
...
...
@@ -106,7 +109,7 @@ class PerformanceService
$value
[
"index_"
]
=
$key
+
1
;
$value
[
"is_my"
]
=
$agent_info
[
"district_id"
];
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
]
]);
$district_name
=
$this
->
agentModel
->
getStoreOrDistrict
([
"district_id"
=>
$value
[
"district_id"
],
"level"
=>
[
"in"
,
"30,40"
]
]);
$district_name
=
$this
->
agentModel
->
getStoreOrDistrict
([
"district_id"
=>
$value
[
"district_id"
],
"level"
=>
[
"in"
,
"30,40"
]
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
count
(
$district_name
)
>
0
?
$district_name
[
0
][
"name"
]
:
"---"
;
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$district_name
[
0
][
"img"
];
...
...
@@ -343,7 +346,7 @@ class PerformanceService
$params
[
'total_time'
]
=
array
(
'between'
,
array
(
$start_time
,
$end_time
)
);
$list
=
$this
->
totalModel
->
getTotalByAgentId
(
$field
,
$params
,
$type
,
""
);
// dump($list);
// dump($list);
if
(
count
(
$list
)
>
0
)
{
$list
=
$list
[
0
];
}
...
...
@@ -373,10 +376,10 @@ class PerformanceService
return
null
;
}
$verify
=
new
VerifyService
();
$agent_ids
=
$verify
->
getAgentsByAgentId
(
$agent_id
);
$verify
=
new
VerifyService
();
$agent_ids
=
$verify
->
getAgentsByAgentId
(
$agent_id
);
$params
[
"agent_id"
]
=
array
(
"in"
,
$agent_ids
);
$list
=
[];
$list
=
[];
$now_date
=
date
(
"Y-m-d"
,
time
());
if
(
$start_time
==
$now_date
&&
$end_time
==
$now_date
)
{
...
...
@@ -414,10 +417,10 @@ class PerformanceService
$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"
]
+
$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
)
{
+
$list
[
$key
][
"official_receipts"
];
if
(
$sum
<=
0
)
{
unset
(
$list
[
$key
]);
}
}
...
...
@@ -490,4 +493,50 @@ class PerformanceService
return
$result
;
}
private
function
getAgentId
(
$agent_id
)
{
$verify
=
new
VerifyService
();
$agent_ids
=
$verify
->
getAgentsByAgentId
(
$agent_id
);
return
$agent_ids
;
}
/**
* 获取房源数据
* @param $type
* @param $agent_id
* @param $start_time
* @param $end_time
* @param $page_no
* @param $page_size
* @return array|false|\PDOStatement|string|\think\Collection
*/
public
function
getHousingResourceList
(
$type
,
$agent_id
,
$start_time
,
$end_time
,
$page_no
,
$page_size
)
{
switch
(
$type
)
{
case
1
:
$params
[
"agent_id"
]
=
$agent_id
;
break
;
case
2
:
$agent_ids
=
$this
->
getAgentId
(
$agent_id
);
$params
[
"agent_id"
]
=
array
(
"in"
,
$agent_ids
);
break
;
default
:
return
[
"code"
=>
101
,
"date"
=>
"传入的type错误"
];
}
$params
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$field
=
"id,internal_title,shop_area_start,shop_area_end,rent_type,rent_price,shop_type,shop_sign"
;
$addHouseList
=
$this
->
houseModel
->
getAddHouseList
(
$params
,
$field
,
$page_no
,
$page_size
);
//获取图片信息
foreach
(
$addHouseList
as
$key
=>
$val
)
{
$addHouseList
[
$key
][
"api_path"
]
=
CK_IMG_URL
.
'images/'
;
$addHouseList
[
$key
][
"rent_price"
]
=
$val
[
"rent_price"
]
*
0.01
;
$param
[
"house_id"
]
=
$val
[
"id"
];
$param
[
"img_type"
]
=
1
;
//默认主图
$addHouseList
[
$key
][
"images"
]
=
$this
->
gHousesImgModel
->
getHouseImages
(
$param
,
1
);
}
return
[
"code"
=>
200
,
"date"
=>
$addHouseList
];
}
}
\ No newline at end of file
application/api_broker/validate/PerformanceValidate.php
0 → 100644
View file @
ebf579c7
<?php
namespace
app\api_broker\validate
;
use
think\Validate
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/6/19
* Time : 18:41
* Intro:
*/
class
PerformanceValidate
extends
Validate
{
protected
$rule
=
[
'type'
=>
'require|number'
,
'agent_id'
=>
'require|number'
,
];
protected
$message
=
[
'type.require'
=>
'type为必填字段'
,
'type.number'
=>
'type只能为数字'
,
'agent_id.require'
=>
'agent_id为必填字段'
,
'agent_id.number'
=>
'agent_id只能为数字'
,
];
protected
$scene
=
[
'verify'
=>
[
'type'
,
'agent_id'
],
];
}
\ No newline at end of file
application/model/GHouses.php
View file @
ebf579c7
...
...
@@ -721,6 +721,31 @@ class GHouses extends BaseModel
return
$result
;
}
/**
* 获取新增楼盘数据
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getAddHouseList
(
$params
,
$field
,
$page_no
,
$page_size
)
{
$where_
=
[];
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"upload_id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"create_time"
]
=
$params
[
"create_time"
];
}
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
where
(
$where_
)
->
limit
(
$page_size
)
->
page
(
$page_no
)
->
select
();
//echo Db::table($this->table)->getLastSql();
return
$result
;
}
/**
* 获取月均价
* @return float
...
...
application/route.php
View file @
ebf579c7
...
...
@@ -473,6 +473,10 @@ Route::group('broker', [
'housingResource'
=>
[
'api_broker/Performance/housingResource'
,
[
'method'
=>
'POST|GET'
]
],
//获取房源list
]);
//Route::miss('api/index/miss');//处理错误的url
\ 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