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
e3b5fc21
Commit
e3b5fc21
authored
Aug 08, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
9bf9397f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
47 deletions
+69
-47
User.php
application/api_broker/controller/User.php
+56
-37
Users.php
application/model/Users.php
+13
-10
No files found.
application/api_broker/controller/User.php
View file @
e3b5fc21
...
...
@@ -61,78 +61,95 @@ class User extends Basic
public
function
searchUser
()
{
$params
=
$this
->
params
;
/*$params = array(
"user_status" => 0,//客户状态(0:求租;1:已租;-1:无效)
"yetai" => "休闲娱乐",
"area_start" => 1,//面积起始范围 room_area2
"area_end" => 65,//面积结束范围
"money_start" => 1,//租金 price2
"money_end" => 10000,//租金
"start_time" => "2016-05-25",
"end_time" => "2018-05-30",
"pageNo" => 1,
"agent_id" => 5741,
"pageSize" => 15,
"status" => -1,
);*/
$field
=
"id as user_id,sex,user_name,user_phone,user_status,agent_id,create_time,industry_type,price_demand,area_demand,vip"
;
$params
=
array
(
"user_status"
=>
0
,
//客户状态(0:求租;1:已租;-1:无效)
"yetai"
=>
"休闲娱乐"
,
"area_start"
=>
1
,
//面积起始范围 room_area2
"area_end"
=>
65
,
//面积结束范围
"money_start"
=>
1
,
//租金 price2
"money_end"
=>
10000
,
//租金
"start_time"
=>
"2016-05-25"
,
"end_time"
=>
"2018-05-30"
,
"user_id"
=>
1
,
"user_name"
=>
"12312"
,
"user_phone"
=>
"138171212"
,
"follow_content"
=>
"1"
,
"pageNo"
=>
1
,
"agent_id"
=>
5741
,
"pageSize"
=>
15
,
"status"
=>
-
1
,
);
$field
=
"a.id as user_id,a.sex,a.user_name,a.user_phone,a.user_status,a.agent_id,a.create_time,a.industry_type,a.price_demand,a.area_demand,a.vip"
;
$conditions
=
[];
$is_show
=
true
;
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
$conditions
[
"city"
]
=
trim
(
$this
->
city
);
$conditions
[
"
a.
city"
]
=
trim
(
$this
->
city
);
if
(
isset
(
$params
[
'user_status'
]))
{
$conditions
[
'user_status'
]
=
$params
[
'user_status'
];
$conditions
[
'
a.
user_status'
]
=
$params
[
'user_status'
];
}
else
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
if
(
isset
(
$params
[
'user_id'
]))
{
$conditions
[
'a.id'
]
=
$params
[
'user_id'
];
}
if
(
isset
(
$params
[
'user_name'
]))
{
$conditions
[
'a.user_name'
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'user_name'
])
.
"%"
);
}
if
(
isset
(
$params
[
'user_phone'
]))
{
$conditions
[
'a.user_phone'
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'user_phone'
])
.
"%"
);
}
if
(
isset
(
$params
[
'follow_content'
]))
{
$conditions
[
'b.content'
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'follow_content'
])
.
"%"
);
}
if
(
isset
(
$params
[
'yetai'
]))
{
$conditions
[
'industry_type'
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'yetai'
])
.
"%"
);
$conditions
[
'
a.
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
)
);
$conditions
[
'a
.a
rea_demand'
]
=
array
(
'between'
,
array
(
$area_start
,
$area_end
)
);
$conditions
[
'a
.a
rea_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
);
$conditions
[
'a
.a
rea_demand'
]
=
array
(
'egt'
,
$area_start
);
$conditions
[
'a
.a
rea_demand'
]
=
array
(
'egt'
,
$area_start
);
}
$price_start
=
isset
(
$params
[
'money_start'
])
?
$params
[
'money_start'
]
:
-
1
;
$price_end
=
isset
(
$params
[
'money_end'
])
?
$params
[
'money_end'
]
:
-
1
;
if
(
$price_start
>=
0
&&
$price_end
>=
0
)
{
//金额
$conditions
[
'price_demand'
]
=
array
(
'between'
,
array
(
$price_start
,
$price_end
)
);
$conditions
[
'
a.
price_demand'
]
=
array
(
'between'
,
array
(
$price_start
,
$price_end
)
);
}
else
if
(
$price_start
>=
0
&&
$price_end
<
0
)
{
$conditions
[
'price_demand'
]
=
array
(
'egt'
,
$price_start
);
$conditions
[
'
a.
price_demand'
]
=
array
(
'egt'
,
$price_start
);
}
if
(
isset
(
$params
[
'start_time'
])
&&
isset
(
$params
[
'end_time'
]))
{
$start_time
=
date
(
'Y-m-d H:i:s'
,
$params
[
'start_time'
]);
$end_time
=
date
(
'Y-m-d H:i:s'
,
$params
[
'end_time'
]);
$conditions
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
,
$end_time
)
);
$start_time
=
date
(
'Y-m-d H:i:s'
,
$params
[
'start_time'
]);
$end_time
=
date
(
'Y-m-d H:i:s'
,
$params
[
'end_time'
]);
$conditions
[
'
a.
create_time'
]
=
array
(
'between'
,
array
(
$start_time
,
$end_time
)
);
}
else
{
$time_
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
"-1 day"
));
$conditions
[
'create_time'
]
=
array
(
'lt'
,
$time_
);
$time_
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
"-1 day"
));
$conditions
[
'
a.
create_time'
]
=
array
(
'lt'
,
$time_
);
}
if
(
isset
(
$params
[
'status'
]))
{
$conditions
[
'status'
]
=
$params
[
'status'
];
$conditions
[
'
a.
status'
]
=
$params
[
'status'
];
}
//传了经纪人id则表示我的客户
if
(
isset
(
$params
[
"agent_id"
]))
{
$conditions
[
'agent_id'
]
=
$params
[
'agent_id'
];
$is_show
=
false
;
$conditions
[
'a.agent_id'
]
=
$params
[
'agent_id'
];
}
...
...
@@ -140,9 +157,11 @@ class User extends Basic
if
(
empty
(
$userList
))
{
return
$this
->
response
(
"200"
,
"此条件没有找到数据"
);
}
if
(
$is_show
){
$list
=
[];
if
(
isset
(
$params
[
"agent_id"
]))
{
$list
=
$userList
;
}
else
{
$clientService
=
new
ClientService
();
$list
=
[];
foreach
(
$userList
as
$k
=>
$v
)
{
$is_show
=
$clientService
->
dialTotal
(
$v
[
"user_id"
]);
if
(
$is_show
)
{
...
...
@@ -153,7 +172,7 @@ class User extends Basic
$vip_services
=
new
VipService
();
$data
[
'examine_vip'
]
=
$vip_services
->
vip
(
$this
->
agentId
);
$data
[
'user_date'
]
=
$
userL
ist
;
$data
[
'user_date'
]
=
$
l
ist
;
return
$this
->
response
(
"200"
,
'request success'
,
$data
);
}
...
...
application/model/Users.php
View file @
e3b5fc21
...
...
@@ -308,7 +308,7 @@ class Users extends Model
if
(
empty
(
$is_exist
))
{
$m_phone
=
new
AliYunPhone
();
$num
=
$m_phone
->
where
(
'phone_x'
,
$data
[
'user_phone'
])
->
count
();
//查询隐私号码
$num
=
$m_phone
->
where
(
'phone_x'
,
$data
[
'user_phone'
])
->
count
();
//查询隐私号码
if
(
$num
==
0
)
{
$insert_data
[
'source'
]
=
20
;
$insert_data
[
'status'
]
=
-
1
;
...
...
@@ -356,12 +356,12 @@ class Users extends Model
}
if
(
$data
[
'referrer_source'
]
==
20
)
{
$agent
=
new
AAgents
();
$referrer_user
=
$agent
->
field
(
'name,phone'
)
->
find
(
$data
[
'user_id'
]);
$data
[
'referrer_user'
]
=
$referrer_user
[
'name'
]
.
'-'
.
$referrer_user
[
'phone'
];
$agent
=
new
AAgents
();
$referrer_user
=
$agent
->
field
(
'name,phone'
)
->
find
(
$data
[
'user_id'
]);
$data
[
'referrer_user'
]
=
$referrer_user
[
'name'
]
.
'-'
.
$referrer_user
[
'phone'
];
}
elseif
(
$data
[
'referrer_source'
]
==
10
)
{
$referrer_user
=
$this
->
field
(
'user_name,user_phone'
)
->
find
(
$data
[
'user_id'
]);
$data
[
'referrer_user'
]
=
$referrer_user
[
'user_name'
]
.
'-'
.
$referrer_user
[
'user_phone'
];
$referrer_user
=
$this
->
field
(
'user_name,user_phone'
)
->
find
(
$data
[
'user_id'
]);
$data
[
'referrer_user'
]
=
$referrer_user
[
'user_name'
]
.
'-'
.
$referrer_user
[
'user_phone'
];
}
unset
(
$data
[
'other_pic'
]);
...
...
@@ -560,6 +560,8 @@ class Users extends Model
{
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"u_phone_follow_up b"
,
"a.id = b.user_id"
,
"left"
)
->
where
(
$params
)
->
order
(
$order
)
->
page
(
$pageNo
)
...
...
@@ -631,6 +633,7 @@ class Users extends Model
->
where
(
$params
)
->
select
();
}
public
function
getAgentByReferrer
(
$field
,
$params
)
{
$result
=
Db
::
name
(
$this
->
table
)
...
...
@@ -639,7 +642,7 @@ class Users extends Model
->
join
(
"a_agents b"
,
"a.referrer_id=b.id"
,
"left"
)
->
where
(
$params
)
->
select
();
// echo $this->getLastSql();
// echo $this->getLastSql();
return
$result
;
}
...
...
@@ -722,7 +725,7 @@ class Users extends Model
$where_
=
[];
if
(
isset
(
$params
[
"buyer_id"
]))
{
$where_
[
"buyer_id"
]
=
$params
[
"buyer_id"
];
}
else
{
//防止传入错误参数修改掉大面积数据此字段必填
}
else
{
//防止传入错误参数修改掉大面积数据此字段必填
return
0
;
}
if
(
isset
(
$params
[
"user_id"
]))
{
...
...
@@ -741,14 +744,14 @@ class Users extends Model
$data
=
$this
->
field
(
$fields
)
->
alias
(
"a"
)
->
join
(
"u_wx_info b"
,
"a.buyer_id=b.id"
,
"left"
)
->
join
(
"u_wx_info b"
,
"a.buyer_id=b.id"
,
"left"
)
->
where
(
$where_
)
->
select
();
return
$data
;
}
public
function
getLastOrNextUserID
(
$where
,
$field
,
$limit
,
$order
)
public
function
getLastOrNextUserID
(
$where
,
$field
,
$limit
,
$order
)
{
$return
=
Db
::
name
(
$this
->
table
)
...
...
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