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
2a2692a7
Commit
2a2692a7
authored
Apr 19, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
客户列表搜索
parent
68c6f704
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
149 additions
and
58 deletions
+149
-58
Agent.php
application/index/controller/Agent.php
+1
-1
Member.php
application/index/controller/Member.php
+120
-55
ADistrict.php
application/model/ADistrict.php
+13
-0
Users.php
application/model/Users.php
+14
-0
route.php
application/route.php
+1
-2
No files found.
application/index/controller/Agent.php
View file @
2a2692a7
...
@@ -239,7 +239,7 @@ class Agent extends Basic
...
@@ -239,7 +239,7 @@ class Agent extends Basic
}
else
{
}
else
{
$data
[
$k
][
'district_id'
]
=
0
;
/*部门Id 对应部门表*/
$data
[
$k
][
'district_id'
]
=
0
;
/*部门Id 对应部门表*/
}
}
$data
[
$k
][
'store_name'
]
=
trim
(
$v
[
'
agentshopname'
])
.
'-'
.
trim
(
$v
[
'
sub_shopname'
]);
/*门店名*/
$data
[
$k
][
'store_name'
]
=
trim
(
$v
[
'sub_shopname'
]);
/*门店名*/
$data
[
$k
][
'scale'
]
=
$v
[
'scale'
];
/*门店规模 如1-22人*/
$data
[
$k
][
'scale'
]
=
$v
[
'scale'
];
/*门店规模 如1-22人*/
if
(
$v
[
'province'
]
==
'上海市'
)
{
if
(
$v
[
'province'
]
==
'上海市'
)
{
$data
[
$k
][
'province'
]
=
rtrim
(
$v
[
'province'
],
'市'
);
/*省*/
$data
[
$k
][
'province'
]
=
rtrim
(
$v
[
'province'
],
'市'
);
/*省*/
...
...
application/index/controller/Member.php
View file @
2a2692a7
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
namespace
app\index\controller
;
namespace
app\index\controller
;
use
app\index\extend\Basic
;
use
app\index\extend\Basic
;
use
app\model\AAgents
;
use
app\model\AAgents
;
use
app\model\ADistrict
;
use
app\model\AStore
;
use
app\model\Users
;
use
app\model\Users
;
use
app\model\UPhoneFollowPp
;
use
app\model\UPhoneFollowPp
;
use
think\Request
;
use
think\Request
;
...
@@ -39,76 +41,139 @@ class Member extends Basic{
...
@@ -39,76 +41,139 @@ class Member extends Basic{
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getUserList
()
{
public
function
getUserList
()
{
$data
[
'status'
]
=
200
;
if
(
$this
->
request
->
isAjax
())
{
$data
[
'msg'
]
=
''
;
$data
[
'status'
]
=
200
;
$data
[
'msg'
]
=
''
;
$params
=
$this
->
request
->
param
();
$params
=
$this
->
request
->
param
();
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
$where
=
''
;
$where
=
[];
$type
=
0
;
$type
=
0
;
if
(
!
empty
(
$params
[
'activate'
])
&&
$params
[
'activate'
]
!=
-
1
)
{
if
(
$params
[
'activate'
]
==
1
)
{
//APP状态
$where
.=
' a.status = 0'
;
if
(
!
empty
(
$params
[
'activate'
])
&&
$params
[
'activate'
]
!=
-
1
)
{
if
(
$params
[
'activate'
]
==
1
)
{
$where
[
'a.status'
]
=
0
;
}
else
{
$where
[
'a.status'
]
=
-
1
;
}
}
else
{
}
else
{
$where
.=
' a.status = -1'
;
$where
[
'a.status'
]
=
[
'<>'
,
1
]
;
}
}
}
else
{
$where
=
' (a.status = 0 or a.status = -1)'
;
}
if
(
!
empty
(
$params
[
'phone'
]))
{
//客户手机号
$where
.=
' AND concat(a.user_phone,a.user_nick) like "%'
.
$this
->
params
[
'phone'
]
.
'%"'
;
if
(
!
empty
(
$params
[
'phone'
]))
{
}
elseif
(
!
empty
(
$params
[
'invite_phone'
]))
{
$where
[
'concat(a.user_phone,a.user_nick)'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'phone'
]
.
'%'
];
$where
.=
' AND referrer_source = 10'
;
}
$where
.=
' AND referrer_id = (SELECT ID FROM u_users where user_phone LIKE "%'
.
$params
[
'invite_phone'
]
.
'%" LIMIT 1)'
;
$type
=
1
;
}
if
(
!
empty
(
$params
[
'start_date'
])
&&
empty
(
$params
[
'end_date'
]))
{
//是否公客
$where
.=
' AND a.create_time > "'
.
$params
[
'start_date'
]
.
' 00:00:00"'
;
if
(
!
empty
(
$params
[
'public_user'
])
&&
$params
[
'public_user'
]
!=
-
1
)
{
}
if
(
$params
[
'public_user'
]
==
1
)
{
$where
[
'a.referrer_id'
]
=
[
'NULL'
];
}
else
{
$where
[
'a.referrer_id'
]
=
[
'NOT NULL'
];
}
}
if
(
!
empty
(
$params
[
'end_date'
])
&&
empty
(
$params
[
'start_date'
]))
{
//邀请人
$where
.=
' AND a.create_time < "'
.
$params
[
'end_date'
]
.
' 23:59:59"'
;
if
(
!
empty
(
$params
[
'invite_phone'
]))
{
}
$where
[
'a.referrer_id'
]
=
[
'NOT NULL'
];
//覆盖上面的值
$referrer_id
=
$this
->
user
->
findUserByPhone
(
'id'
,
$params
[
'invite_phone'
]);
$where
[
'a.referrer_id'
]
=
$referrer_id
[
'id'
];
//覆盖上面的值
$where
[
'referrer_source'
]
=
10
;
$type
=
1
;
}
if
(
!
empty
(
$params
[
'start_date'
])
&&
!
empty
(
$params
[
'end_date'
]))
{
//创建开始时间
$where
.=
' AND a.create_time > "'
.
$params
[
'start_date'
]
.
' 00:00:00'
.
'" and a.create_time < "'
.
$params
[
'end_date'
]
.
' 23:59:59"'
;
if
(
!
empty
(
$params
[
'start_date'
])
&&
empty
(
$params
[
'end_date'
]))
{
}
$where
[
'a.create_time'
]
=
[
'> time'
,
$params
[
'start_date'
]
.
'00:00:00'
];
}
if
(
!
empty
(
$params
[
'follow_start'
])
&&
empty
(
$params
[
'follow_end'
]))
{
//创建结束时间
$where
.=
' AND b.create_time > "'
.
$params
[
'follow_start'
]
.
' 00:00:00"'
;
if
(
!
empty
(
$params
[
'end_date'
])
&&
empty
(
$params
[
'start_date'
]))
{
$type
=
2
;
$where
[
'a.create_time'
]
=
[
'< time'
,
$params
[
'end_date'
]
.
'23:59:59'
]
;
}
}
if
(
!
empty
(
$params
[
'follow_end'
])
&&
empty
(
$params
[
'follow_start'
]))
{
//创建开始时间
$where
.=
' AND b.create_time < "'
.
$params
[
'follow_end'
]
.
' 23:59:59"'
;
if
(
!
empty
(
$params
[
'start_date'
])
&&
!
empty
(
$params
[
'end_date'
]))
{
$type
=
2
;
$where
[
'a.create_time'
]
=
[
'between time'
,
[
$params
[
'start_date'
]
.
' 00:00:00'
,
$params
[
'end_date'
]
.
' 23:59:59'
]]
;
}
}
if
(
!
empty
(
$params
[
'follow_start'
])
&&
!
empty
(
$params
[
'follow_end'
]))
{
//跟进结束时间
$where
.=
' AND b.create_time > "'
.
$params
[
'follow_start'
]
.
' 00:00:00'
.
'" and b.create_time < "'
.
$params
[
'follow_end'
]
.
' 23:59:59"'
;
if
(
!
empty
(
$params
[
'follow_start'
])
&&
empty
(
$params
[
'follow_end'
]))
{
$type
=
2
;
$where
[
'b.create_time'
]
=
[
'> time'
,
$params
[
'follow_start'
]
.
' 00:00:00'
];
}
$type
=
2
;
}
if
(
!
empty
(
$params
[
'id'
]))
{
//跟进时间
$where
.=
' AND a.id = '
.
$params
[
'id'
];
if
(
!
empty
(
$params
[
'follow_end'
])
&&
empty
(
$params
[
'follow_start'
]))
{
}
$where
[
'b.create_time'
]
=
[
'< time'
,
$params
[
'follow_end'
]
.
' 23:59:59'
];
$type
=
2
;
}
if
(
!
empty
(
$params
[
'login_status'
])
&&
$params
[
'login_status'
]
!=
-
1
)
{
//跟进时间
if
(
$params
[
'login_status'
]
==
1
)
{
if
(
!
empty
(
$params
[
'follow_start'
])
&&
!
empty
(
$params
[
'follow_end'
]))
{
$where
.=
' AND a.last_login_ip is not null'
;
$where
[
'b.create_time'
]
=
[
'between time'
,
[
$params
[
'follow_start'
]
.
' 00:00:00'
,
$params
[
'follow_end'
]
.
' 23:59:59'
]];
}
else
{
$type
=
2
;
$where
.=
' AND a.last_login_ip is null'
;
}
//客户编号
if
(
!
empty
(
$params
[
'id'
]))
{
$where
[
'a.id'
]
=
$params
[
'id'
];
}
//是否登录过
if
(
!
empty
(
$params
[
'login_status'
])
&&
$params
[
'login_status'
]
!=
-
1
)
{
if
(
$params
[
'login_status'
]
==
1
)
{
$where
[
'a.last_login_ip'
]
=
[
'NOT NULL'
];
}
else
{
$where
[
'a.last_login_ip'
]
=
[
'NULL'
];
}
}
//客户状态(0:求租;1:已租;-1:无效)
if
(
!
empty
(
$params
[
'rent_user'
]))
{
$where
[
'a.user_status'
]
=
$params
[
'user_rent'
];
}
}
/* //最后登录开始时间
if (!empty($params['login_time_start']) && empty($params['login_time_end'])) {
$where['a.last_login_time'] = ['> time',$params['last_login_time']. ' 00:00:00'];
}
//最后登录结束时间
if (!empty($params['login_time_end']) && empty($params['login_time_start'])) {
$where['a.last_login_time'] = ['< time',$params['login_time_end']. ' 23:59:59'];
}
//最后登录时间
if (!empty($params['login_time_end']) && !empty($params['login_time_start'])) {
$where['a.last_login_time'] = ['between time', [$params['login_time_start']. ' 00:00:00', $params['login_time_end']. ' 23:59:59']];
}*/
if
(
!
empty
(
$params
[
'store_name'
]))
{
$store
=
new
AStore
();
$where
[
'b.store_id'
]
=
$store
->
getStoreKeyById
([
'store_name'
=>
$params
[
'store_name'
]]);
$type
=
3
;
}
if
(
!
empty
(
$params
[
'district_name'
]))
{
$district
=
new
ADistrict
();
$where
[
'b.district_id'
]
=
$district
->
getDistrictKeyById
([
'district_name'
=>
$params
[
'district_name'
]]);
$type
=
3
;
}
$fields
=
'a.id,a.user_nick,a.user_phone,a.user_pic,a.create_time,a.user_pswd,a.referrer_id,a.registration_time,a.user_name,a.last_login_ip,a.status'
;
$data
[
'list'
]
=
$this
->
user
->
getUserAgent
(
$pageNo
,
$pageSize
,
'a.id DESC'
,
$fields
,
$where
,
$type
);
$data
[
'total'
]
=
$this
->
user
->
getUserAgentTotal
(
$where
,
$type
);
$return
=
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
);
}
else
{
$return
=
view
(
'member/users_list'
);
}
}
$fields
=
'a.id,a.user_nick,a.user_phone,a.user_pic,a.create_time,a.user_pswd,a.referrer_id,a.registration_time,a.user_name,a.last_login_ip,a.status'
;
return
$return
;
$data
[
'list'
]
=
$this
->
user
->
getUserAgent
(
$pageNo
,
$pageSize
,
'a.id DESC'
,
$fields
,
$where
,
$type
);
$data
[
'total'
]
=
$this
->
user
->
getUserAgentTotal
(
$where
,
$type
);
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
);
}
}
/**
/**
...
...
application/model/ADistrict.php
View file @
2a2692a7
...
@@ -197,4 +197,16 @@ class ADistrict extends BaseModel
...
@@ -197,4 +197,16 @@ class ADistrict extends BaseModel
}
}
return
$data
;
return
$data
;
}
}
/**
* 查询部门单个字段信息
*
* @param $field
* @param $where
* @return mixed
*/
public
function
getDistrictKeyById
(
$field
,
$where
)
{
return
$this
->
where
(
$where
)
->
value
(
$field
);
}
}
}
\ No newline at end of file
application/model/Users.php
View file @
2a2692a7
...
@@ -85,6 +85,15 @@ class Users extends Model
...
@@ -85,6 +85,15 @@ class Users extends Model
->
limit
(
$pageSize
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
page
(
$pageNo
)
->
select
();
->
select
();
}
elseif
(
$type
==
3
)
{
$result
=
$this
->
field
(
$fields
)
->
alias
(
'a'
)
->
join
(
'a_agents b'
,
'a.agent_id = b.id'
,
'left'
)
->
where
(
$params
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
}
else
{
}
else
{
$result
=
$this
->
field
(
$fields
)
->
alias
(
'a'
)
$result
=
$this
->
field
(
$fields
)
->
alias
(
'a'
)
->
where
(
$params
)
->
where
(
$params
)
...
@@ -132,6 +141,11 @@ class Users extends Model
...
@@ -132,6 +141,11 @@ class Users extends Model
->
join
(
'u_phone_follow_up b'
,
'a.id = b.user_id'
,
'left'
)
->
join
(
'u_phone_follow_up b'
,
'a.id = b.user_id'
,
'left'
)
->
where
(
$params
)
->
where
(
$params
)
->
count
();
->
count
();
}
elseif
(
$type
==
3
)
{
$result
=
$this
->
alias
(
'a'
)
->
join
(
'a_agents b'
,
'a.agent_id = b.id'
,
'left'
)
->
where
(
$params
)
->
count
();
}
else
{
}
else
{
$result
=
$this
->
alias
(
'a'
)
$result
=
$this
->
alias
(
'a'
)
->
where
(
$params
)
->
where
(
$params
)
...
...
application/route.php
View file @
2a2692a7
...
@@ -61,8 +61,7 @@ Route::group('index', [
...
@@ -61,8 +61,7 @@ Route::group('index', [
'upIsShow'
=>
[
'index/banner/upIsShow'
,
[
'method'
=>
'post'
]
],
'upIsShow'
=>
[
'index/banner/upIsShow'
,
[
'method'
=>
'post'
]
],
//user列表
//user列表
'usersList'
=>
[
'index/member/getUserList'
,[
'method'
=>
'get'
]],
'users_list'
=>
[
'index/member/getUserList'
,[
'method'
=>
'get'
]],
'users_list'
=>
[
'index/member/index'
],
'user_add'
=>
[
'index/member/user_add'
,[
'method'
=>
'post'
]],
'user_add'
=>
[
'index/member/user_add'
,[
'method'
=>
'post'
]],
'del_user'
=>
[
'index/member/delUser'
,[
'method'
=>
'post'
]],
'del_user'
=>
[
'index/member/delUser'
,[
'method'
=>
'post'
]],
'pcAddFollow'
=>
[
'index/member/pcAddFollow'
,[
'method'
=>
'post'
]],
'pcAddFollow'
=>
[
'index/member/pcAddFollow'
,[
'method'
=>
'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