Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sunac-quanmin
Overview
Overview
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
HTML5-李恒逸
sunac-quanmin
Commits
d1ea0550
Commit
d1ea0550
authored
Jun 15, 2017
by
html5-李恒逸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs
parent
7d169742
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
113 additions
and
109 deletions
+113
-109
channeladmin.php
html/application/controllers/admin/channeladmin.php
+2
-2
kpiadmin.php
html/application/controllers/admin/kpiadmin.php
+36
-37
customer_model.php
html/application/models/customer_model.php
+70
-69
customerExport.php
html/application/views/admin/channel/customerExport.php
+2
-0
customerSearch.php
html/application/views/admin/channel/customerSearch.php
+3
-1
No files found.
html/application/controllers/admin/channeladmin.php
View file @
d1ea0550
...
...
@@ -376,7 +376,7 @@ class Channeladmin extends CI_Controller
$admins
=
array
();
$admins
=
$this
->
channel
->
get_all_info
(
$where
,
$page_no
,
self
::
PAGE_SIZE
);
$this
->
data
[
'customers'
]
=
$admins
;
$this
->
data
[
'num_start'
]
=
(
$page_no
-
1
)
*
self
::
PAGE_SIZE
+
1
;
//获取分页
$this
->
data
[
'num_link'
]
=
set_page1
(
$this
,
site_url
(
'admin/channeladmin/customerSearch?distributor_name='
.
$get
[
'distributor_name'
]
.
'&status='
.
$get
[
'status'
]
.
'&channel_id='
.
$get
[
'channel_id'
]
.
'&building_title='
.
$get
[
'building_title'
]
.
'&time='
.
$get
[
'time'
]),
...
...
@@ -467,7 +467,7 @@ class Channeladmin extends CI_Controller
$admins
=
array
();
$admins
=
$this
->
channel
->
get_all_info
(
$where
,
$page_no
,
self
::
PAGE_SIZE
);
$this
->
data
[
'customers'
]
=
$admins
;
$this
->
data
[
'num_start'
]
=
(
$page_no
-
1
)
*
self
::
PAGE_SIZE
+
1
;
//获取分页
$this
->
data
[
'num_link'
]
=
set_page1
(
$this
,
site_url
(
'admin/channeladmin/customerExport?distributor_name='
.
$get
[
'distributor_name'
]
.
'&status='
.
$get
[
'status'
]
.
'&channel_id='
.
$get
[
'channel_id'
]
.
'&building_title='
.
$get
[
'building_title'
]
.
'&time='
.
$get
[
'time'
]),
...
...
html/application/controllers/admin/kpiadmin.php
View file @
d1ea0550
...
...
@@ -9,7 +9,7 @@ class Kpiadmin extends CI_Controller
const
PAGE_SIZE
=
20
;
protected
$status
=
array
();
/**
* 构造器
*/
...
...
@@ -21,7 +21,7 @@ class Kpiadmin extends CI_Controller
//语言包
$this
->
lang
->
load
(
'op_log'
,
'chinese'
);
$this
->
u_name
=
$this
->
session
->
userdata
(
'user_name'
);
//加载菜单
$this
->
load
->
helper
(
'util'
);
$this
->
data
[
'menu'
]
=
newgenerate_menu
();
...
...
@@ -31,7 +31,7 @@ class Kpiadmin extends CI_Controller
//模型
$this
->
load
->
model
(
'activity_model'
,
'activity'
);
$is_admin
=
$this
->
session
->
userdata
(
'type'
)
==
1
&&
$this
->
session
->
userdata
(
'role'
)
?
true
:
false
;
$is_admin
=
$this
->
session
->
userdata
(
'type'
)
==
1
&&
$this
->
session
->
userdata
(
'role'
)
?
true
:
false
;
if
(
!
$this
->
session
->
userdata
(
'u_id'
)
||
!
$is_admin
)
{
alert_redirect
(
site_url
(
'admin/index/login'
));
...
...
@@ -89,7 +89,7 @@ class Kpiadmin extends CI_Controller
if
(
$con_arr
[
'building_title'
])
{
$where
.=
' and B.building_title like "%'
.
$con_arr
[
'building_title'
]
.
'%"'
;
}
//我是销管
$user_id
=
(
int
)
$this
->
session
->
userdata
(
'u_id'
);
...
...
@@ -101,11 +101,11 @@ class Kpiadmin extends CI_Controller
//获取所有的客户
$this
->
data
[
'customers'
]
=
array
();
if
(
$count
>
0
){
//获取客户信息
$customers
=
$this
->
customer
->
get_recommend_page
(
$where
,
$page_no
,
self
::
PAGE_SIZE
);
if
(
$customers
)
if
(
$customers
)
{
foreach
(
$customers
as
$key
=>
$customer
)
{
$customers
[
$key
][
'customers'
]
=
0
;
...
...
@@ -167,7 +167,7 @@ class Kpiadmin extends CI_Controller
}
if
(
$con_arr
[
'channel'
])
{
$where
.=
' and
D.channel
like "%'
.
$con_arr
[
'channel'
]
.
'%"'
;
$where
.=
' and
M.manager_name
like "%'
.
$con_arr
[
'channel'
]
.
'%"'
;
}
if
(
$con_arr
[
'customer_user'
])
{
...
...
@@ -190,12 +190,12 @@ class Kpiadmin extends CI_Controller
$where
.=
' and CB.create_time >= '
.
strtotime
(
$con_arr
[
'start_day'
]);
}
if
(
$con_arr
[
'end_day'
])
{
if
(
$con_arr
[
'end_day'
])
{
$where
.=
' and CB.create_time < '
.
(
strtotime
(
$con_arr
[
'end_day'
])
+
24
*
3600
-
1
);
}
//经纪人
if
(
$con_arr
[
'agent_name'
])
{
if
(
$con_arr
[
'agent_name'
])
{
$where
.=
' and (UPP.true_name like "%'
.
$con_arr
[
'agent_name'
]
.
'%" OR UPP.user_name like "%'
.
$con_arr
[
'agent_name'
]
.
'%")'
;
}
...
...
@@ -203,20 +203,20 @@ class Kpiadmin extends CI_Controller
$user_id
=
(
int
)
$this
->
session
->
userdata
(
'u_id'
);
$info
=
$this
->
manager
->
get
(
array
(
'id'
=>
$user_id
));
if
(
$info
[
'role_id'
]
==
10
)
if
(
$info
[
'role_id'
]
==
10
)
{
$where
.=
' and RR.user_id ='
.
$user_id
;
}
else
if
(
$info
[
'role_id'
]
==
11
){
$where
.=
' and D.manager_id ='
.
$user_id
;
}
$where
=
trim
(
$where
,
' and '
);
$where
=
trim
(
$where
,
' and '
);
//获取客户总数
$count
=
$this
->
customer
->
get_distributor_page_count
(
$where
);
//获取所有的客户
$this
->
data
[
'customers'
]
=
array
();
if
(
$count
>
0
){
//获取客户信息
$customers
=
$this
->
customer
->
get_distributor_page
(
$where
,
$page_no
,
self
::
PAGE_SIZE
);
...
...
@@ -224,7 +224,7 @@ class Kpiadmin extends CI_Controller
//获取分页
$this
->
data
[
'num_link'
]
=
set_page_new
(
$data_arr
,
$this
,
site_url
(
'admin/kpiadmin/distributor'
),
$count
,
self
::
PAGE_SIZE
,
4
,
''
,
true
);
}
$this
->
data
[
'num_start'
]
=
(
$page_no
-
1
)
*
self
::
PAGE_SIZE
+
1
;
//查询客户信息列表
$this
->
load
->
view
(
'admin/kpiadmin/distributor'
,
$this
->
data
);
...
...
@@ -276,20 +276,20 @@ class Kpiadmin extends CI_Controller
//分销商查看自己的经纪人
$uid
=
$this
->
session
->
userdata
(
'u_id'
);
$distributor
=
$this
->
distributor
->
get
(
array
(
'manager_id'
=>
$uid
));
$distributor
=
$this
->
distributor
->
get
(
array
(
'manager_id'
=>
$uid
));
if
(
$distributor
&&
$distributor
[
'uniqid_id'
])
{
$where
.=
' U.uniqid_id ='
.
$distributor
[
'uniqid_id'
];
}
}
$where
=
trim
(
$where
,
' and '
);
$count
=
$this
->
customer
->
get_agents_page_count
(
$where
);
//获取所有的客户
$this
->
data
[
'agents'
]
=
array
();
if
(
$count
>
0
){
$agents
=
$this
->
customer
->
get_agents_page
(
$where
,
$page_no
,
self
::
PAGE_SIZE
);
if
(
$agents
)
{
foreach
(
$agents
as
$key
=>
$agent
)
{
...
...
@@ -309,7 +309,7 @@ class Kpiadmin extends CI_Controller
//获取分页
$this
->
data
[
'num_link'
]
=
set_page_new
(
$data_arr
,
$this
,
site_url
(
'admin/kpiadmin/agents'
),
$count
,
self
::
PAGE_SIZE
,
4
,
''
,
true
);
}
$this
->
data
[
'num_start'
]
=
(
$page_no
-
1
)
*
self
::
PAGE_SIZE
+
1
;
$this
->
load
->
view
(
'admin/kpiadmin/agents'
,
$this
->
data
);
}
...
...
@@ -361,11 +361,11 @@ class Kpiadmin extends CI_Controller
//获取所有的客户
$this
->
data
[
'customers'
]
=
array
();
if
(
$count
>
0
){
//获取客户信息
$customers
=
$this
->
customer
->
get_recommend_page
(
$where
,
1
,
$count
);
if
(
$customers
)
if
(
$customers
)
{
foreach
(
$customers
as
$key
=>
$customer
)
{
$customers
[
$key
][
'customers'
]
=
0
;
...
...
@@ -387,7 +387,7 @@ class Kpiadmin extends CI_Controller
}
}
$data
=
array
();
if
(
$customers
)
{
foreach
(
$customers
as
$key
=>
$item
)
{
...
...
@@ -396,7 +396,7 @@ class Kpiadmin extends CI_Controller
$temp
[
'building_title'
]
=
iconv
(
'utf-8'
,
'gbk//IGNORE'
,
$item
[
'building_title'
]);
$temp
[
'customers'
]
=
$item
[
'customers'
];
$temp
[
'channel'
]
=
iconv
(
'utf-8'
,
'gbk'
,
$item
[
'channel_name'
]);
array_push
(
$data
,
$temp
);
}
}
...
...
@@ -463,19 +463,19 @@ class Kpiadmin extends CI_Controller
$user_id
=
(
int
)
$this
->
session
->
userdata
(
'u_id'
);
$info
=
$this
->
manager
->
get
(
array
(
'id'
=>
$user_id
));
if
(
$info
[
'role_id'
]
==
10
)
if
(
$info
[
'role_id'
]
==
10
)
{
$where
.=
' and RR.user_id ='
.
$user_id
;
}
else
if
(
$info
[
'role_id'
]
==
11
){
$where
.=
' and D.manager_id ='
.
$user_id
;
}
}
//获取客户总数
$count
=
$this
->
customer
->
get_distributor_page_count
(
$where
);
$customers
=
$this
->
customer
->
get_distributor_page
(
$where
,
1
,
$count
);
$data
=
array
();
if
(
$customers
)
{
foreach
(
$customers
as
$key
=>
$item
)
{
$item
[
'customer_type'
]
=
$item
[
'customer_type'
]
===
null
?
'0'
:
$item
[
'customer_type'
];
...
...
@@ -495,7 +495,7 @@ class Kpiadmin extends CI_Controller
$temp
[
'partner_name'
]
=
iconv
(
'utf-8'
,
'gbk'
,
$item
[
'partner_name'
]);
$temp
[
'pumobile'
]
=
iconv
(
'utf-8'
,
'gbk'
,
$item
[
'partner_user_mobile'
]);
$temp
[
'remark'
]
=
iconv
(
'utf-8'
,
'gbk'
,
$item
[
'remark'
]);
array_push
(
$data
,
$temp
);
}
}
...
...
@@ -548,11 +548,11 @@ class Kpiadmin extends CI_Controller
//分销商查看自己的经纪人
$uid
=
$this
->
session
->
userdata
(
'u_id'
);
$distributor
=
$this
->
distributor
->
get
(
array
(
'manager_id'
=>
$uid
));
$distributor
=
$this
->
distributor
->
get
(
array
(
'manager_id'
=>
$uid
));
if
(
$distributor
&&
$distributor
[
'uniqid_id'
])
{
$where
.=
' U.uniqid_id ='
.
$distributor
[
'uniqid_id'
];
}
}
$where
=
trim
(
$where
,
' and '
);
$count
=
$this
->
customer
->
get_agents_page_count
(
$where
);
...
...
@@ -577,7 +577,7 @@ class Kpiadmin extends CI_Controller
}
}
$data
=
array
();
if
(
$agents
)
{
foreach
(
$agents
as
$key
=>
$item
)
{
...
...
@@ -585,7 +585,7 @@ class Kpiadmin extends CI_Controller
$temp
[
'user_name'
]
=
iconv
(
'utf-8'
,
'gbk'
,
$item
[
'true_name'
]
?
:
$item
[
'user_name'
]);
$temp
[
'user_mobile'
]
=
$item
[
'user_mobile'
];
$temp
[
'building_title'
]
=
iconv
(
'utf-8'
,
'gbk'
,
$item
[
'building_title'
]);
$temp
[
'customers'
]
=
$item
[
'customers'
];
$temp
[
'customers'
]
=
$item
[
'customers'
];
array_push
(
$data
,
$temp
);
}
}
...
...
@@ -595,9 +595,9 @@ class Kpiadmin extends CI_Controller
$titles
=
iconv
(
'utf-8'
,
'gbk'
,
$titles
);
$file
=
iconv
(
'utf-8'
,
'gbk'
,
'经纪人数据列表.xls'
);
$this
->
export
->
export_excel
(
$file
,
$titles
,
$data
);
break
;
default
:
# code...
break
;
...
...
@@ -657,7 +657,7 @@ class Kpiadmin extends CI_Controller
//获取所有的客户
$this
->
data
[
'customers'
]
=
array
();
if
(
$count
>
0
){
//获取客户信息
$customers
=
$this
->
customer
->
get_channel_page
(
$where
,
$page_no
,
self
::
PAGE_SIZE
);
...
...
@@ -759,4 +759,4 @@ class Kpiadmin extends CI_Controller
$this
->
load
->
view
(
'admin/kpiadmin/customer'
,
$this
->
data
);
}
}
\ No newline at end of file
}
html/application/models/customer_model.php
View file @
d1ea0550
<?php
/**
* 客户模型
*
*
* @package application/model
* @version 2012-10-31
* @author wenhuijang
...
...
@@ -13,7 +13,7 @@ class Customer_model extends MY_Model{
* 使用到的表
*/
public
$table
=
'tb_customer'
;
/**
* 构造器
*/
...
...
@@ -25,7 +25,7 @@ class Customer_model extends MY_Model{
}
/**
*
*
* 总数
* @param int $where
* @return array 总数
...
...
@@ -56,7 +56,7 @@ class Customer_model extends MY_Model{
}
/**
*
*
* 后台管理 分页数据
* @param int $where
* @param int $offset 结果偏移量
...
...
@@ -86,7 +86,7 @@ class Customer_model extends MY_Model{
$this
->
db
->
where
(
$where
);
}
$this
->
db
->
order_by
(
'CB.id'
,
'desc'
);
$query
=
$this
->
db
->
get
(
null
,
$page_size
,
(
$page
-
1
)
*
$page_size
);
if
(
$query
->
num_rows
()
>
0
)
{
...
...
@@ -95,7 +95,7 @@ class Customer_model extends MY_Model{
return
false
;
}
/**
*
*
* 后台管理 统计客户分页数据
* @param int $where
* @param int $offset 结果偏移量
...
...
@@ -108,7 +108,7 @@ class Customer_model extends MY_Model{
{
$this
->
db
->
select
(
'C.customer_user, C.customer_mobile, C.create_time,
CB.id, CB.building_id, B.building_title, CB.distribution_status, CB.order_time, CB.deal_price, CB.payed_price, CB.payed_status,
CB.id, CB.building_id, B.building_title, CB.distribution_status, CB.order_time, CB.deal_price, CB.payed_price, CB.payed_status,
R.region_code, R.region_name,
CB.sale_id, UP.user_name sale_name,
CB.manager_id, UM.user_name manager_name,
...
...
@@ -130,7 +130,7 @@ class Customer_model extends MY_Model{
$this
->
db
->
where
(
$where
);
}
$this
->
db
->
order_by
(
'CB.id'
,
'desc'
);
$query
=
$this
->
db
->
get
(
null
,
$page_size
,
(
$page
-
1
)
*
$page_size
);
if
(
$query
->
num_rows
()
>
0
)
{
...
...
@@ -154,7 +154,7 @@ class Customer_model extends MY_Model{
{
$this
->
db
->
where
(
$where
);
}
$query
=
$this
->
db
->
get
();
if
(
$query
->
num_rows
()
>
0
)
{
...
...
@@ -164,7 +164,7 @@ class Customer_model extends MY_Model{
return
0
;
}
/**
*
*
* 后台管理 统计客户分页数据
* @param int $where
* @param int $offset 结果偏移量
...
...
@@ -200,19 +200,19 @@ class Customer_model extends MY_Model{
$this
->
db
->
where
(
$where
);
}
$this
->
db
->
order_by
(
'CB.user_id desc'
);
$query
=
$this
->
db
->
get
(
null
,
$page_size
,
(
$page
-
1
)
*
$page_size
);
if
(
$query
->
num_rows
()
>
0
)
{
return
$query
->
result_array
();
}
return
false
;
}
public
function
get_partner_page_statistics_count
(
$where
=
''
)
{
$this
->
db
->
select
(
'count(*) total'
);
$this
->
db
->
from
(
$this
->
table
.
' C'
);
$this
->
db
->
join
(
'tb_customer_building CB'
,
'CB.customer_id = C.id'
,
'left'
);
...
...
@@ -226,7 +226,7 @@ class Customer_model extends MY_Model{
{
$this
->
db
->
where
(
$where
);
}
$query
=
$this
->
db
->
get
();
if
(
$query
->
num_rows
()
>
0
)
{
...
...
@@ -238,7 +238,7 @@ class Customer_model extends MY_Model{
/**
*
*
* 后台管理 渠道分布分销列表
* @param int $where
* @param int $offset 结果偏移量
...
...
@@ -276,16 +276,16 @@ class Customer_model extends MY_Model{
}
$this
->
db
->
group_by
(
'CB.id'
);
$this
->
db
->
order_by
(
'CB.user_id desc'
);
$query
=
$this
->
db
->
get
(
null
,
$page_size
,
(
$page
-
1
)
*
$page_size
);
if
(
$query
->
num_rows
()
>
0
)
{
return
$query
->
result_array
();
}
return
false
;
}
public
function
get_channel_page_count
(
$where
=
''
)
{
$this
->
db
->
select
(
'count(*) total'
);
...
...
@@ -303,7 +303,7 @@ class Customer_model extends MY_Model{
{
$this
->
db
->
where
(
$where
);
}
$query
=
$this
->
db
->
get
();
if
(
$query
->
num_rows
()
>
0
)
{
...
...
@@ -314,7 +314,7 @@ class Customer_model extends MY_Model{
}
/**
*
*
* 后台管理 分销推荐客户列表
* @param int $where
* @param int $offset 结果偏移量
...
...
@@ -349,9 +349,9 @@ class Customer_model extends MY_Model{
}
$this
->
db
->
group_by
(
'CB.id'
);
$this
->
db
->
order_by
(
'CB.id desc'
);
$query
=
$this
->
db
->
get
(
null
,
$page_size
,
(
$page
-
1
)
*
$page_size
);
if
(
$query
->
num_rows
()
>
0
)
{
return
$query
->
result_array
();
...
...
@@ -362,7 +362,7 @@ class Customer_model extends MY_Model{
//统计所属分销客户的总数
public
function
get_distributor_page_count
(
$where
=
''
)
{
$this
->
db
->
select
(
'count(DISTINCT CB.id) total'
);
$this
->
db
->
from
(
'tb_customer_building CB'
);
$this
->
db
->
join
(
$this
->
table
.
' C'
,
'CB.customer_id = C.id'
,
'left'
);
...
...
@@ -372,13 +372,15 @@ class Customer_model extends MY_Model{
$this
->
db
->
join
(
'tb_user US'
,
'US.id = CB.sale_id'
,
'left'
);
$this
->
db
->
join
(
'tb_distributor D'
,
'D.id = CB.distributor_id'
,
'left'
);
$this
->
db
->
join
(
'tb_building_distributor_relate RR'
,
'RR.distributor_id = D.id'
,
'left'
);
$this
->
db
->
join
(
'tb_channel TC'
,
'TC.id = D.channel_id'
,
'left'
);
$this
->
db
->
join
(
'tb_manager M'
,
'M.id = TC.manager_id'
,
'left'
);
if
(
!
empty
(
$where
))
{
$this
->
db
->
where
(
$where
);
}
$query
=
$this
->
db
->
get
();
if
(
$query
->
num_rows
()
>
0
)
{
$return
=
$query
->
row_array
();
...
...
@@ -388,7 +390,7 @@ class Customer_model extends MY_Model{
}
/**
*
*
* 后台管理 统计销售分页数据
* @param int $where
* @param int $offset 结果偏移量
...
...
@@ -401,7 +403,7 @@ class Customer_model extends MY_Model{
{
$this
->
db
->
select
(
'C.customer_user, C.customer_mobile, C.create_time,
CB.id, CB.customer_id, CB.building_id, B.building_title, CB.distribution_status, CB.order_time, CB.deal_price, CB.payed_price, CB.payed_status,
CB.id, CB.customer_id, CB.building_id, B.building_title, CB.distribution_status, CB.order_time, CB.deal_price, CB.payed_price, CB.payed_status,
R.region_code, R.region_name,
CB.sale_id, UP.user_name sale_name, UP.user_mobile sale_user_mobile,
CB.manager_id, UM.user_name manager_name,
...
...
@@ -422,7 +424,7 @@ class Customer_model extends MY_Model{
$this
->
db
->
where
(
$where
);
}
$this
->
db
->
order_by
(
'CB.sale_id desc'
);
$query
=
$this
->
db
->
get
(
null
,
$page_size
,
(
$page
-
1
)
*
$page_size
);
if
(
$query
->
num_rows
()
>
0
)
{
...
...
@@ -446,7 +448,7 @@ class Customer_model extends MY_Model{
{
$this
->
db
->
where
(
$where
);
}
$query
=
$this
->
db
->
get
();
if
(
$query
->
num_rows
()
>
0
)
{
...
...
@@ -456,7 +458,7 @@ class Customer_model extends MY_Model{
return
0
;
}
/**
*
*
* 详情
* @param int $where
* @return array 包含统计起止时间的数组
...
...
@@ -490,8 +492,8 @@ class Customer_model extends MY_Model{
}
return
array
();
}
/**
*
* 前台 分页数据
...
...
@@ -516,7 +518,7 @@ class Customer_model extends MY_Model{
$this
->
db
->
where
(
$where
);
}
$this
->
db
->
order_by
(
'C.id'
,
'desc'
);
$query
=
$this
->
db
->
get
(
null
,
$page_size
,
(
$page
-
1
)
*
$page_size
);
if
(
$query
->
num_rows
()
>
0
)
{
...
...
@@ -549,9 +551,9 @@ class Customer_model extends MY_Model{
$this
->
db
->
where
(
$where
);
}
$this
->
db
->
order_by
(
'C.id'
,
'desc'
);
$query
=
$this
->
db
->
get
(
null
,
$page_size
,
(
$page
-
1
)
*
$page_size
);
if
(
$query
->
num_rows
()
>
0
)
{
return
$query
->
result_array
();
...
...
@@ -581,7 +583,7 @@ class Customer_model extends MY_Model{
$this
->
db
->
where
(
$where
);
}
$this
->
db
->
order_by
(
'U.id'
,
'desc'
);
$query
=
$this
->
db
->
get
(
null
,
$page_size
,
(
$page
-
1
)
*
$page_size
);
if
(
$query
->
num_rows
()
>
0
)
{
...
...
@@ -629,7 +631,7 @@ class Customer_model extends MY_Model{
$this
->
db
->
where
(
$where
);
}
$this
->
db
->
order_by
(
'U.id'
,
'desc'
);
$query
=
$this
->
db
->
get
(
null
,
$page_size
,
(
$page
-
1
)
*
$page_size
);
if
(
$query
->
num_rows
()
>
0
)
{
...
...
@@ -637,7 +639,7 @@ class Customer_model extends MY_Model{
}
return
false
;
}
/**
* 判断客户推荐是否存在
* @param string $where
...
...
@@ -666,7 +668,7 @@ class Customer_model extends MY_Model{
$this
->
db
->
select
(
'id'
)
->
from
(
$this
->
table
)
->
where
(
"customer_mobile = '
{
$mobile
}
'"
);
$query
=
$this
->
db
->
get
(
null
);
if
(
$query
->
num_rows
()
>
0
)
{
...
...
@@ -688,9 +690,9 @@ class Customer_model extends MY_Model{
public
function
get_customer_building_manager
(
$where
=
''
,
$page
=
1
,
$page_size
=
0
,
$order
=
NULL
)
{
$this
->
db
->
select
(
'C.id, C.user_id, C.customer_user, C.customer_mobile,
CB.id as cb_id, CB.customer_id, CB.building_id, CB.deal_price, CB.payed_price, CB.sale_id, CB.recommend_status, CB.order_time,
B.building_title,
'C.id, C.user_id, C.customer_user, C.customer_mobile,
CB.id as cb_id, CB.customer_id, CB.building_id, CB.deal_price, CB.payed_price, CB.sale_id, CB.recommend_status, CB.order_time,
B.building_title,
M.user_name manager_name, M.true_name manager_true_name,
S.user_name sale_name, S.true_name sale_true_name,
U.user_name user_name, U.true_name user_true_name,'
...
...
@@ -701,25 +703,25 @@ class Customer_model extends MY_Model{
->
join
(
'tb_user M'
,
'M.id = CB.manager_id'
,
'left'
)
->
join
(
'tb_user S'
,
'S.id = CB.sale_id'
,
'left'
)
->
join
(
'tb_user U'
,
'U.id = C.user_id'
,
'left'
);
if
(
!
empty
(
$where
))
{
$this
->
db
->
where
(
$where
);
}
$this
->
db
->
order_by
(
'C.id'
,
'desc'
);
$query
=
$this
->
db
->
get
(
null
,
$page_size
,
(
$page
-
1
)
*
$page_size
);
if
(
$query
->
num_rows
()
>
0
)
{
return
$query
->
result_array
();
}
return
false
;
}
/**
*
*
* 后台管理 统计经纪人数据
* @param int $where
* @param int $offset 结果偏移量
...
...
@@ -747,9 +749,9 @@ class Customer_model extends MY_Model{
//}
$this
->
db
->
order_by
(
'U.id desc'
);
$query
=
$this
->
db
->
get
(
null
,
$page_size
,
(
$page
-
1
)
*
$page_size
);
if
(
$query
->
num_rows
()
>
0
)
{
return
$query
->
result_array
();
...
...
@@ -758,7 +760,7 @@ class Customer_model extends MY_Model{
}
/**
*
*
* 后台管理 统计经纪人数据
* @param int $where
* @param int $offset 结果偏移量
...
...
@@ -783,9 +785,9 @@ class Customer_model extends MY_Model{
$this
->
db
->
group_by
(
'CB.user_id,R.building_id'
);
$this
->
db
->
order_by
(
'U.id desc'
);
$query
=
$this
->
db
->
get
();
if
(
$query
->
num_rows
()
>
0
)
{
$return
=
$query
->
row_array
();
...
...
@@ -796,7 +798,7 @@ class Customer_model extends MY_Model{
/**
*
*
* 后台管理 统计经纪人数据(新)
* @param int $where
* @param int $offset 结果偏移量
...
...
@@ -818,9 +820,9 @@ class Customer_model extends MY_Model{
}
$this
->
db
->
order_by
(
'U.id desc'
);
$query
=
$this
->
db
->
get
();
if
(
$query
->
num_rows
()
>
0
)
{
$return
=
$query
->
row_array
();
...
...
@@ -830,7 +832,7 @@ class Customer_model extends MY_Model{
}
/**
*
*
* 后台管理 统计经纪人数据(新)
* @param int $where
* @param int $offset 结果偏移量
...
...
@@ -859,8 +861,8 @@ class Customer_model extends MY_Model{
$query
=
$this
->
db
->
get
(
null
,
$page_size
,
(
$page
-
1
)
*
$page_size
);
}
else
{
$query
=
$this
->
db
->
get
();
}
}
if
(
$query
->
num_rows
()
>
0
)
{
$return
=
$query
->
result_array
();
...
...
@@ -868,9 +870,9 @@ class Customer_model extends MY_Model{
}
return
0
;
}
/**
*
*
* 后台管理 分销推荐客户列表统计
* @param int $where
* @param int $offset 结果偏移量
...
...
@@ -893,9 +895,9 @@ class Customer_model extends MY_Model{
$this
->
db
->
where
(
$where
);
}
$this
->
db
->
order_by
(
'R.id desc'
);
$query
=
$this
->
db
->
get
(
null
,
$page_size
,
(
$page
-
1
)
*
$page_size
);
if
(
$query
->
num_rows
()
>
0
)
{
return
$query
->
result_array
();
...
...
@@ -905,7 +907,7 @@ class Customer_model extends MY_Model{
public
function
get_recommend_page_count
(
$where
=
''
)
{
$this
->
db
->
select
(
'count(*) total'
);
$this
->
db
->
from
(
'tb_building_distributor_relate R'
);
$this
->
db
->
join
(
'tb_distributor D'
,
'R.distributor_id = D.id'
,
'left'
);
...
...
@@ -915,7 +917,7 @@ class Customer_model extends MY_Model{
{
$this
->
db
->
where
(
$where
);
}
$query
=
$this
->
db
->
get
();
if
(
$query
->
num_rows
()
>
0
)
{
...
...
@@ -935,7 +937,7 @@ class Customer_model extends MY_Model{
$this
->
db
->
from
(
'tb_customer C'
);
$this
->
db
->
where
(
'C.rongchuang_id <> " "'
);
$query
=
$this
->
db
->
get
();
if
(
$query
->
num_rows
()
>
0
)
{
$return
=
$query
->
result_array
();
...
...
@@ -948,7 +950,7 @@ class Customer_model extends MY_Model{
$this
->
db
->
from
(
'tb_customer C'
);
$this
->
db
->
where
(
'C.rongchuang_id'
,
$rcId
);
$query
=
$this
->
db
->
get
();
if
(
$query
->
num_rows
()
>
0
)
{
$return
=
$query
->
result_array
();
...
...
@@ -956,4 +958,4 @@ class Customer_model extends MY_Model{
}
return
0
;
}
}
\ No newline at end of file
}
html/application/views/admin/channel/customerExport.php
View file @
d1ea0550
...
...
@@ -90,6 +90,7 @@
<table
class=
"table table-striped table-bordered table-hover"
id=
"sample_1"
>
<thead>
<tr>
<th>
序号
</th>
<th>
用户ID
</th>
<th>
客户姓名
</th>
<th>
客户电话
</th>
...
...
@@ -109,6 +110,7 @@
foreach
(
$customers
as
$customer
)
:
?>
<tr>
<td>
<?php
echo
$num_start
++
;
?>
</td>
<td>
<?php
echo
$customer
[
'id'
];
?>
</td>
<td>
<?php
echo
$customer
[
'customer_user'
];
?>
</td>
<td>
<?php
echo
$customer
[
'customer_mobile'
]
?>
</td>
...
...
html/application/views/admin/channel/customerSearch.php
View file @
d1ea0550
...
...
@@ -88,6 +88,7 @@
<table
class=
"table table-striped table-bordered table-hover"
id=
"sample_1"
>
<thead>
<tr>
<th>
序号
</th>
<th>
用户ID
</th>
<th>
客户姓名
</th>
<th>
客户电话
</th>
...
...
@@ -107,6 +108,7 @@
foreach
(
$customers
as
$customer
)
:
?>
<tr>
<td>
<?php
echo
$num_start
++
;
?>
</td>
<td>
<?php
echo
$customer
[
'id'
];
?>
</td>
<td>
<?php
echo
$customer
[
'customer_user'
];
?>
</td>
<td>
<?php
echo
$customer
[
'customer_mobile'
]
?>
</td>
...
...
@@ -227,7 +229,7 @@
var
e
=
$
(
"#time"
).
val
=
""
;
location
.
href
=
"
<?php
echo
site_url
(
'admin/channeladmin/customerSearch'
)
?>
?distributor_name="
+
a
+
"&status="
+
b
+
"&channel_id="
+
c
+
"&building_title="
+
d
+
"&time="
+
e
})
});
...
...
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