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
741a45cc
Commit
741a45cc
authored
May 31, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
客户搜索
parent
94311b2f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
18 deletions
+61
-18
User.php
application/api_broker/controller/User.php
+49
-18
Users.php
application/model/Users.php
+11
-0
route.php
application/route.php
+1
-0
No files found.
application/api_broker/controller/User.php
View file @
741a45cc
...
...
@@ -3,6 +3,7 @@
namespace
app\api_broker\controller
;
use
app\api_broker\extend\Basic
;
use
app\model\Users
;
use
think\Request
;
/**
...
...
@@ -14,9 +15,12 @@ use think\Request;
*/
class
User
extends
Basic
{
private
$userModel
;
public
function
__construct
(
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
userModel
=
new
Users
();
}
/**
...
...
@@ -47,35 +51,61 @@ class User extends Basic
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
public
function
searchUser
(){
public
function
searchUser
()
{
$params
=
$this
->
params
;
$params
=
array
(
"yetai"
=>
"休闲娱乐"
,
"area_start"
=>
45
,
//面积起始范围 room_area2
"area_end"
=>
65
,
//面积结束范围
"yetai"
=>
"休闲娱乐"
,
"area_start"
=>
45
,
//面积起始范围 room_area2
"area_end"
=>
65
,
//面积结束范围
"money_start"
=>
1000
,
//租金 price2
"money_end"
=>
10000
,
//租金
"start_time"
=>
"2018-05-25"
,
"end_time"
=>
"2018-05-30"
,
"pageNo"
=>
"1"
,
"pageSize"
=>
15
"money_end"
=>
10000
,
//租金
"start_time"
=>
"2018-05-25"
,
"end_time"
=>
"2018-05-30"
,
"pageNo"
=>
1
,
"pageSize"
=>
15
);
$params
=
$this
->
params
;
$field
=
"a.id,a.agent_id,a.title,a.address,a.city,disc,a.disccircles,a.sales,a.yetai,a.room_area,a.room_area2,
a.shangpu_type,a.is_test,a.room_num_left,a.shangpu_tags,a.carefully_chosen,a.price,a.rent_type,b.foreign_name,b.address_detail_c,
b.foreign_advantage"
;
$field
=
"id as user_id,sex,user_nick,user_phone,user_status,agent_id,create_time,industry_type,price_demand,area_demand"
;
$conditions
=
[];
if
(
empty
(
$params
[
'site_area'
]))
{
return
$this
->
response
(
"101"
,
"请求来源不能为空"
);
}
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
if
(
isset
(
$params
[
'title'
]))
{
$conditions
[
'b.foreign_name'
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'title'
])
.
"%"
);
if
(
isset
(
$params
[
'yetai'
]))
{
$conditions
[
'industry_type'
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'yetai'
])
.
"%"
);
}
$area_start
=
isset
(
$params
[
'area_start'
])
?
$params
[
'area_start'
]
:
-
1
;
$area_end
=
isset
(
$params
[
'area_end'
])
?
$params
[
'area_end'
]
:
-
1
;
if
(
$area_start
>=
0
&&
$area_end
>=
0
)
{
//面积
$conditions
[
'area_demand'
]
=
array
(
'between'
,
array
(
$area_start
,
$area_end
)
);
$conditions
[
'area_demand'
]
=
array
(
'between'
,
array
(
$area_start
,
$area_end
)
);
}
else
if
(
$area_start
>=
0
&&
$area_end
<
0
)
{
//100米以上不用传结束面积
$conditions
[
'area_demand'
]
=
array
(
'egt'
,
$area_start
);
$conditions
[
'area_demand'
]
=
array
(
'egt'
,
$area_start
);
}
$price_start
=
isset
(
$params
[
'money_start'
])
?
$params
[
'money_start'
]
:
-
1
;
$price_end
=
isset
(
$params
[
'end_time'
])
?
$params
[
'end_time'
]
:
-
1
;
if
(
$price_start
>=
0
&&
$price_end
>=
0
)
{
//金额
$conditions
[
'price_demand'
]
=
array
(
'between'
,
array
(
$price_start
,
$price_end
)
);
}
else
if
(
$price_start
>=
0
&&
$price_end
<
0
)
{
$conditions
[
'price_demand'
]
=
array
(
'egt'
,
$price_start
);
}
if
(
isset
(
$params
[
'start_time'
])
&&
isset
(
$params
[
'end_time'
]))
{
$conditions
[
'create_time'
]
=
array
(
'between'
,
array
(
$params
[
'start_time'
],
$params
[
'end_time'
]
)
);
}
$userList
=
$this
->
userModel
->
selectUserList
(
$field
,
$conditions
,
$pageNo
,
$pageSize
,
"id desc"
);
if
(
empty
(
$userList
))
{
return
$this
->
response
(
"200"
,
"此条件没有找到数据"
);
}
return
$this
->
response
(
"200"
,
'request success'
,
$userList
);
}
}
\ No newline at end of file
application/model/Users.php
View file @
741a45cc
...
...
@@ -413,6 +413,17 @@ class Users extends Model
->
select
();
}
public
function
selectUserList
(
$field
,
$params
,
$pageNo
,
$pageSize
,
$order
=
"id desc"
){
$result
=
$this
->
field
(
$field
)
->
where
(
$params
)
->
order
(
$order
)
->
page
(
$pageNo
)
->
limit
(
$pageSize
)
->
select
();
echo
$this
->
getLastSql
();
return
$result
;
}
/**
* 数据转换 返回用户信息
* @param $params
...
...
application/route.php
View file @
741a45cc
...
...
@@ -454,6 +454,7 @@ Route::group('broker', [
//user
'returnSearchCondition'
=>
[
'api_broker/User/returnSearchCondition'
,
[
'method'
=>
'get'
]
],
//客户搜索条件
'searchUser'
=>
[
'api_broker/User/searchUser'
,
[
'method'
=>
'get|post'
]
],
//客户搜索
]);
...
...
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