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
10f6e07b
Commit
10f6e07b
authored
Aug 14, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后台客户跟进列表优化
parent
f3ce19ef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
32 deletions
+57
-32
Remark.php
application/index/controller/Remark.php
+26
-23
UPhoneFollowPp.php
application/model/UPhoneFollowPp.php
+31
-9
No files found.
application/index/controller/Remark.php
View file @
10f6e07b
...
...
@@ -35,73 +35,76 @@ class Remark extends Basic
$data
[
'status'
]
=
200
;
$data
[
'msg'
]
=
''
;
$where_user
=
$agent_where
=
[];
$pageNo
=
empty
(
$this
->
params
[
'pageNo'
])
?
1
:
$this
->
params
[
'pageNo'
];
$pageSize
=
empty
(
$this
->
params
[
'pageSize'
])
?
15
:
$this
->
params
[
'pageSize'
];
$u_phone_follow
=
new
UPhoneFollowPp
();
if
(
!
empty
(
$this
->
params
[
'start_date'
])
&&
empty
(
$this
->
params
[
'end_date'
]))
{
$where
[
'
a.
create_time'
]
=
[
'> time'
,
$this
->
params
[
'start_date'
]
.
' 00:00:00'
];
$where
[
'create_time'
]
=
[
'> time'
,
$this
->
params
[
'start_date'
]
.
' 00:00:00'
];
}
if
(
!
empty
(
$this
->
params
[
'end_date'
])
&&
empty
(
$this
->
params
[
'start_date'
]))
{
$where
[
'
a.
create_time'
]
=
[
'< time'
,
$this
->
params
[
'end_date'
]
.
' 23:59:59'
];;
$where
[
'create_time'
]
=
[
'< time'
,
$this
->
params
[
'end_date'
]
.
' 23:59:59'
];;
}
if
(
!
empty
(
$this
->
params
[
'end_date'
])
&&
!
empty
(
$this
->
params
[
'start_date'
]))
{
$where
[
'a.create_time'
]
=
[
'between'
,[
$this
->
params
[
'start_date'
]
.
' 00:00:00'
,
$this
->
params
[
'end_date'
]
.
' 23:59:59'
]];
}
if
(
!
empty
(
$this
->
params
[
'customer'
]))
{
$where
[
'c.user_name'
]
=
$this
->
params
[
'customer'
];
}
if
(
!
empty
(
$this
->
params
[
'phone'
]))
{
$where
[
'c.user_phone'
]
=
$this
->
params
[
'phone'
];
$where
[
'create_time'
]
=
[
'between'
,[
$this
->
params
[
'start_date'
]
.
' 00:00:00'
,
$this
->
params
[
'end_date'
]
.
' 23:59:59'
]];
}
if
(
!
empty
(
$this
->
params
[
'content'
]))
{
$where
[
'
a.content'
]
=
[
'like
'
,
"%
{
$this
->
params
[
'content'
]
}
%"
];
$where
[
'
content'
]
=
[
'LIKE
'
,
"%
{
$this
->
params
[
'content'
]
}
%"
];
}
//跟进人名字
if
(
!
empty
(
$this
->
params
[
'remark_name'
]))
{
$
where
[
'b.name'
]
=
[
'like'
,
"%
{
$this
->
params
[
'remark_name'
]
}
%"
];
$
agent_where
[
'name'
]
=
$this
->
params
[
'remark_name'
];
}
//跟进人手机号
if
(
!
empty
(
$this
->
params
[
'remark_phone'
]))
{
$
where
[
'b.phone'
]
=
[
'like'
,
"%
{
$this
->
params
[
'remark_phone'
]
}
%"
];
$
agent_where
[
'phone'
]
=
$this
->
params
[
'remark_phone'
];
}
//跟进人门店
if
(
!
empty
(
$this
->
params
[
'remark_store_id'
]))
{
$
where
[
'b.
store_id'
]
=
$this
->
params
[
'remark_store_id'
];
$
agent_where
[
'
store_id'
]
=
$this
->
params
[
'remark_store_id'
];
}
//跟进人部门
if
(
!
empty
(
$this
->
params
[
'remark_district_id'
]))
{
$
where
[
'b.
district_id'
]
=
$this
->
params
[
'remark_district_id'
];
$
agent_where
[
'
district_id'
]
=
$this
->
params
[
'remark_district_id'
];
}
if
(
!
empty
(
$this
->
params
[
'province'
]))
{
$where
[
'
c.
province'
]
=
$this
->
params
[
'province'
];
$where
[
'province'
]
=
$this
->
params
[
'province'
];
}
if
(
!
empty
(
$this
->
params
[
'city'
]))
{
$where
[
'c
.c
ity'
]
=
$this
->
params
[
'city'
];
$where
[
'city'
]
=
$this
->
params
[
'city'
];
}
if
(
!
empty
(
$this
->
params
[
'disc'
]))
{
$where
[
'
c.
disc'
]
=
$this
->
params
[
'disc'
];
$where
[
'disc'
]
=
$this
->
params
[
'disc'
];
}
$field
=
'c.id,a.create_time,a.content,b.name as admin,d.name as label_name,c.user_name,c.user_phone,a.user_status'
;
$data
[
'data'
][
'list'
]
=
$u_phone_follow
->
getFollowList
(
$pageNo
,
$pageSize
,
$order_
=
'a.id desc'
,
$field
,
$where
);
if
(
!
empty
(
$this
->
params
[
'id'
]))
{
$where
[
'user_id'
]
=
$this
->
params
[
'id'
];
}
if
(
!
empty
(
$where_user
))
{
$m_agent
=
new
AAgents
();
$agent_id_arr
=
$m_agent
->
getAgentById
(
'id'
,
$agent_where
);
if
(
!
empty
(
$agent_id_arr
))
{
$where
[
'agent_id'
]
=
[
'in'
,
$agent_id_arr
];
}
}
$field
=
'user_id,create_time,content,user_status,labels_id,agent_id'
;
$data
[
'data'
][
'list'
]
=
$u_phone_follow
->
getFollowList
(
$pageNo
,
$pageSize
,
$order_
=
'id desc'
,
$field
,
$where
);
foreach
(
$data
[
'data'
][
'list'
]
as
$k
=>
$v
)
{
$data
[
'data'
][
'list'
][
$k
][
'user_phone'
]
=
hide_customer_phone
(
$data
[
'data'
][
'list'
][
$k
][
'user_phone'
]
);
$data
[
'data'
][
'list'
][
$k
][
'user_phone'
]
=
substr_replace
(
$data
[
'data'
][
'list'
][
$k
][
'user_phone'
],
'****'
,
3
,
4
);
}
$data
[
'data'
][
'total'
]
=
$u_phone_follow
->
getFollowTotal
(
$where
);
...
...
application/model/UPhoneFollowPp.php
View file @
10f6e07b
...
...
@@ -264,16 +264,41 @@ class UPhoneFollowPp extends BaseModel
* @throws \think\exception\DbException
*/
public
function
getFollowList
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
=
''
,
$params
=
''
)
{
return
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'a_agents b'
,
'a.agent_id = b.id'
,
'left'
)
->
join
(
'u_users c'
,
'a.user_id = c.id'
,
'left'
)
->
join
(
'u_labels d'
,
'd.id = a.labels_id'
,
'left'
)
$data
=
$this
->
field
(
$field
)
->
where
(
$params
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
$m_label
=
new
ULabels
();
$m_user
=
new
Users
();
$m_agent
=
new
AAgents
();
$label_data
=
$m_label
->
field
(
'id,name'
)
->
where
(
'type'
,
1
)
->
select
();
foreach
(
$data
as
$k
=>
$v
)
{
if
(
!
empty
(
$v
[
'agent_id'
]))
{
$data
[
$k
][
'admin'
]
=
$m_agent
->
getAgentsById
(
$v
[
'agent_id'
],
'name'
);
}
if
(
!
empty
(
$v
[
'user_id'
]))
{
$user_data
=
$m_user
->
getUserById
(
'user_name,user_phone'
,
$v
[
'user_id'
]);
$data
[
$k
][
'user_name'
]
=
$user_data
[
'user_name'
];
$data
[
$k
][
'user_phone'
]
=
$user_data
[
'user_phone'
];
}
if
(
!
isset
(
$v
[
'labels_id'
]))
{
continue
;
}
foreach
(
$label_data
as
$k2
=>
$v2
)
{
if
(
$v2
[
'id'
]
==
$v
[
'labels_id'
])
{
$data
[
$k
][
'label_name'
]
=
$v2
[
'name'
];
}
}
}
return
$data
;
}
/**
...
...
@@ -284,10 +309,7 @@ class UPhoneFollowPp extends BaseModel
*/
public
function
getFollowTotal
(
$params
)
{
return
$this
->
alias
(
'a'
)
->
join
(
'a_agents b'
,
'a.agent_id = b.id'
,
'left'
)
->
join
(
'u_users c'
,
'a.user_id = c.id'
,
'left'
)
->
where
(
$params
)
return
$this
->
where
(
$params
)
->
count
();
}
...
...
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