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
5941cb98
Commit
5941cb98
authored
Apr 21, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
绑定客户优化
parent
b48f8344
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
15 deletions
+25
-15
User.php
application/api_broker/controller/User.php
+3
-2
UserService.php
application/index/service/UserService.php
+10
-13
Users.php
application/model/Users.php
+12
-0
No files found.
application/api_broker/controller/User.php
View file @
5941cb98
...
...
@@ -195,13 +195,14 @@ class User extends Basic
}
}
}
big_log
(
json_encode
(
$conditions
));
//
big_log(json_encode($conditions));
$field
=
"id as user_id,sex,user_name,city,user_phone,user_status,agent_id,create_time,industry_type,price_demand,area_demand,vip,user_label,source_intro,site_ids"
;
$return_user_list
=
$this
->
userModel
->
selectUserList
(
$field
,
$conditions
,
$pageNo
,
$pageSize
,
"id desc"
);
if
(
empty
(
$return_user_list
))
{
return
$this
->
response
(
"200"
,
"此条件没有找到数据"
);
}
// big_log(json_encode($return_user_list));
//todo 将经纪人所在城市的客户拍前面
if
(
$app_request_source_type
==
0
)
{
...
...
@@ -254,7 +255,7 @@ class User extends Basic
public
function
userSequenceByCity
(
$user_list
,
$site_id
)
{
if
(
!
$user_list
or
!
$site_id
)
{
return
false
;
return
$user_list
;
}
$user_list_temp
=
[];
...
...
application/index/service/UserService.php
View file @
5941cb98
...
...
@@ -614,8 +614,6 @@ class UserService
* @return int
*/
public
function
addUserBind
(
$user_id
,
$bind_id
){
// big_log($user_id);
// big_log($bind_id);
if
(
!
$user_id
or
!
$bind_id
){
return
1
;
}
...
...
@@ -624,32 +622,32 @@ class UserService
return
6
;
}
// 先查当前用户bind_id是否等于0
//user_id 当前详情页客户
// 先查当前用户bind_id是否等于0 user_id 当前详情页客户
$user_info
=
$this
->
user
->
getUserById
(
$field
=
'bind_id'
,
$user_id
);
if
(
$user_info
[
'bind_id'
]
!=
0
){
return
2
;
//排除主账号
$user_bind_count
=
$this
->
user
->
getBindCount
(
$bind_id
);
if
(
$user_bind_count
>
0
){
return
2
;
//当前客户已经存在绑定关系
}
$user_id
=
$bind_id
;
$bind_id_
=
$user_info
[
'bind_id'
];
}
else
{
// 不等于0 查bind_id=当前bind_id 同时查id=bind_id
$user_bind
=
$this
->
userBindInfo
(
$user_id
);
if
(
count
(
$user_bind
)
>
0
){
return
3
;
//
防止是主账号
return
3
;
//
存在绑定关系
}
//bind_id 要绑定的对象
$b_user_bind
=
$this
->
userBindInfo
(
$bind_id
);
// big_log(count($b_user_bind));
// big_log('=======================');
if
(
count
(
$b_user_bind
)
>
3
){
return
4
;
}
//
$b_user_info
=
$this
->
user
->
getUserById
(
$field
=
'bind_id'
,
$bind_id
);
if
(
$b_user_info
[
'bind_id'
]
==
0
){
$bind_id_
=
$bind_id
;
}
else
{
$bind_id_
=
$b_user_info
[
'bind_id'
];
}
}
$params_
[
'bind_id'
]
=
$bind_id_
;
$res
=
$this
->
user
->
updateUsers
(
$user_id
,
$params_
);
if
(
$res
==
1
){
...
...
@@ -658,7 +656,6 @@ class UserService
return
5
;
}
}
}
/**
* 解除绑定关系
...
...
application/model/Users.php
View file @
5941cb98
...
...
@@ -663,6 +663,7 @@ class Users extends Model
->
limit
(
$pageSize
)
->
select
();
//echo $this->getLastSql();
// big_log($this->getLastSql());
return
$result
;
}
...
...
@@ -1027,5 +1028,16 @@ class Users extends Model
// big_log($this->getLastSql());
return
$result
;
}
public
function
getBindCount
(
$user_id
){
$where_
=
[];
$where_
[
"bind_id"
]
=
$user_id
;
$result
=
Db
::
table
(
$this
->
table
)
->
where
(
$where_
)
->
count
();
dump
(
$this
->
getLastSql
());
return
$result
;
}
}
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