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
f43a41c4
Commit
f43a41c4
authored
Jun 19, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
业绩房源客源
parent
8394ef63
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
121 additions
and
23 deletions
+121
-23
Performance.php
application/api_broker/controller/Performance.php
+37
-2
Basic.php
application/api_broker/extend/Basic.php
+1
-1
PerformanceService.php
application/api_broker/service/PerformanceService.php
+57
-15
Users.php
application/model/Users.php
+24
-0
route.php
application/route.php
+2
-5
No files found.
application/api_broker/controller/Performance.php
View file @
f43a41c4
...
...
@@ -181,15 +181,16 @@ class Performance extends Basic
*/
public
function
housingResource
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
$params
=
array
(
/*
$params = array(
"type" => 1, //1个人,2经纪人
"agent_id" => 80,
"start_time" => "2018-06-12",
"end_time" => "2018-06-19",
"page_no" => 1,
"page_size" => 15
);
);
*/
$checkResult
=
$this
->
validate
(
$params
,
"PerformanceValidate.verify"
);
if
(
true
!==
$checkResult
)
{
...
...
@@ -209,5 +210,39 @@ class Performance extends Basic
return
$this
->
response
(
"200"
,
"success"
,
$result
[
"date"
]);
}
}
/**
* 获取时间段新增客源数据
* @return \think\Response
*/
public
function
userResource
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"type" => 1, //1个人,2经纪人
"agent_id" => 80,
"start_time" => "2018-06-12",
"end_time" => "2018-06-19",
"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_time"
])
?
$params
[
"end_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$start_day
=
!
empty
(
$params
[
"start_time"
])
?
$params
[
"start_time"
]
:
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_
->
getUserResourceList
(
$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/extend/Basic.php
View file @
f43a41c4
...
...
@@ -96,7 +96,7 @@ class Basic extends Controller
$requestPath
=
$this
->
request
->
routeInfo
()[
"rule"
][
0
]
.
"/"
.
$this
->
request
->
routeInfo
()[
"rule"
][
1
];
//过滤掉不需要验证token的接口
if
(
!
in_array
(
trim
(
$requestPath
),
$this
->
filterVerify
))
{
$this
->
tokenVerify
();
//
$this->tokenVerify();
// $this->userAuth(trim($requestPath));
}
unset
(
$this
->
params
[
"AuthToken"
]);
...
...
application/api_broker/service/PerformanceService.php
View file @
f43a41c4
...
...
@@ -493,11 +493,32 @@ class PerformanceService
return
$result
;
}
private
function
getAgentId
(
$agent_id
)
/**
* 组装请求参数
* @param $agent_id
* @param $type
* @param $start_time
* @param $end_time
* @return array
*/
private
function
getAgentId
(
$agent_id
,
$type
,
$start_time
,
$end_time
)
{
switch
(
$type
)
{
case
1
:
$params
[
"agent_id"
]
=
$agent_id
;
break
;
case
2
:
$verify
=
new
VerifyService
();
$agent_ids
=
$verify
->
getAgentsByAgentId
(
$agent_id
);
return
$agent_ids
;
$params
[
"agent_id"
]
=
array
(
"in"
,
$agent_ids
);
break
;
default
:
return
null
;
}
$params
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
return
$params
;
}
/**
...
...
@@ -512,19 +533,10 @@ class PerformanceService
*/
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"
)
);
$params
=
$this
->
getAgentId
(
$agent_id
,
$type
,
$start_time
,
$end_time
);
if
(
!
$params
)
return
[
"code"
=>
101
,
"date"
=>
"传入的参数错误"
];
$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
);
//获取图片信息
...
...
@@ -534,9 +546,38 @@ class PerformanceService
$param
[
"house_id"
]
=
$val
[
"id"
];
$param
[
"img_type"
]
=
1
;
//默认主图
$imgArr
=
$this
->
gHousesImgModel
->
getHouseImages
(
$param
,
1
);
$addHouseList
[
$key
][
"images"
]
=
!
empty
(
$imgArr
[
0
][
"img_name"
])
?
CK_IMG_URL
.
'images/'
.
$imgArr
[
0
][
"img_name"
]
:
null
;
$addHouseList
[
$key
][
"images"
]
=
!
empty
(
$imgArr
[
0
][
"img_name"
])
?
CK_IMG_URL
.
'images/'
.
$imgArr
[
0
][
"img_name"
]
:
null
;
}
return
[
"code"
=>
200
,
"date"
=>
$addHouseList
];
}
/**
* 获取客源数据
* @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
getUserResourceList
(
$type
,
$agent_id
,
$start_time
,
$end_time
,
$page_no
,
$page_size
)
{
$params
=
$this
->
getAgentId
(
$agent_id
,
$type
,
$start_time
,
$end_time
);
if
(
!
$params
)
return
[
"code"
=>
101
,
"date"
=>
"传入的参数错误"
];
$field
=
"id,user_name,user_phone,user_nick,create_time,agent_id"
;
$addUserList
=
$this
->
userModel
->
getAddUserList
(
$params
,
$field
,
$page_no
,
$page_size
);
//获取图片信息
foreach
(
$addUserList
as
$key
=>
$val
)
{
if
(
$val
[
"agent_id"
]
==
$agent_id
)
{
$addUserList
[
$key
][
"is_my"
]
=
1
;
}
else
{
$addUserList
[
$key
][
"is_my"
]
=
0
;
}
$addUserList
[
$key
][
"user_phone"
]
=
preg_replace
(
'/(\d{3})\d{4}(\d{4})/'
,
'$1****$2'
,
$val
[
"user_phone"
]);
}
return
[
"code"
=>
200
,
"date"
=>
$addUserList
];
}
}
\ No newline at end of file
application/model/Users.php
View file @
f43a41c4
...
...
@@ -448,6 +448,30 @@ class Users extends Model
->
select
();
}
/**
* 获取新增用户数据
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getAddUserList
(
$params
,
$field
,
$page_no
,
$page_size
)
{
$where_
=
[];
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"agent_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
;
}
public
function
all_user_count
(
$params
=
''
)
{
...
...
application/route.php
View file @
f43a41c4
...
...
@@ -242,8 +242,7 @@ Route::group('index', [
'delNotice'
=>
[
'index/notice/delNotice'
,
[
'method'
=>
'POST'
]
],
//删除公告
'addNotice'
=>
[
'index/notice/addNotice'
,
[
'method'
=>
'POST'
]
],
//新增公告
'getWxInfo'
=>
[
'index/WxAuthorization/getWxInfo'
,
[
'method'
=>
'POST|GET'
]
],
//wx
'getWxInfo'
=>
[
'index/WxAuthorization/getWxInfo'
,
[
'method'
=>
'POST|GET'
]
],
//wx
'evaluationList'
=>
[
'index/Evaluation/evaluationList'
,
[
'method'
=>
'POST|GET'
]
],
//评价列表 朱伟 2018-06-13
...
...
@@ -251,7 +250,6 @@ Route::group('index', [
'superviseList'
=>
[
'index/Supervise/superviseList'
,
[
'method'
=>
'POST|GET'
]
],
//监督执行列表 朱伟 2018-06-14
]);
...
...
@@ -472,9 +470,8 @@ Route::group('broker', [
'superviseList'
=>
[
'api_broker/Supervise/superviseList'
,
[
'method'
=>
'POST|GET'
]
],
//监督执行列表 朱伟 2018-06-15
'housingResource'
=>
[
'api_broker/Performance/housingResource'
,
[
'method'
=>
'POST|GET'
]
],
//获取房源list
'userResource'
=>
[
'api_broker/Performance/userResource'
,
[
'method'
=>
'POST|GET'
]
],
//获取客源list
]);
...
...
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