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
edd6fbcf
Commit
edd6fbcf
authored
Jul 18, 2017
by
HTML5-侯张振
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复 保护期分页bug
parent
726c86c0
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
13 deletions
+70
-13
report.php
html/application/controllers/admin/report.php
+17
-8
building_distributor_model.php
html/application/models/building_distributor_model.php
+28
-3
distributor_model.php
html/application/models/distributor_model.php
+25
-0
protection.php
html/application/views/admin/report/protection.php
+0
-2
No files found.
html/application/controllers/admin/report.php
View file @
edd6fbcf
...
@@ -988,7 +988,7 @@ class Report extends CI_Controller
...
@@ -988,7 +988,7 @@ class Report extends CI_Controller
$uid
=
$this
->
session
->
userdata
[
'u_id'
];
$uid
=
$this
->
session
->
userdata
[
'u_id'
];
$info
=
$this
->
manager
->
get
(
array
(
'id'
=>
$uid
));
$info
=
$this
->
manager
->
get
(
array
(
'id'
=>
$uid
));
$this
->
data
[
'building_title'
]
=
$building
=
$get
[
'
building_titl
e'
];
$this
->
data
[
'building_title'
]
=
$building
=
$get
[
'
company_nam
e'
];
$where1
=
"B.building_title like '%
$building
%'"
;
$where1
=
"B.building_title like '%
$building
%'"
;
...
@@ -1005,10 +1005,10 @@ class Report extends CI_Controller
...
@@ -1005,10 +1005,10 @@ class Report extends CI_Controller
$con_arr
=
array
();
$con_arr
=
array
();
if
(
$get
)
{
if
(
$get
)
{
$con_arr
=
array
(
$con_arr
=
array
(
'company_name'
=>
$get
[
'
building_titl
e'
]
?
:
''
'company_name'
=>
$get
[
'
company_nam
e'
]
?
:
''
);
);
if
(
isset
(
$get
[
'
building_title'
])
&&
$get
[
'building_titl
e'
])
{
if
(
isset
(
$get
[
'
company_name'
])
&&
$get
[
'company_nam
e'
])
{
$where
.=
' and D.company_name like "%'
.
trim
(
$get
[
'
building_titl
e'
])
.
'%"'
;
$where
.=
' and D.company_name like "%'
.
trim
(
$get
[
'
company_nam
e'
])
.
'%"'
;
}
}
// if (isset($get['uniqid_id'])) {
// if (isset($get['uniqid_id'])) {
...
@@ -1022,13 +1022,13 @@ class Report extends CI_Controller
...
@@ -1022,13 +1022,13 @@ class Report extends CI_Controller
$where
.=
' and A.id ='
.
$user_data
[
'u_id'
];
$where
.=
' and A.id ='
.
$user_data
[
'u_id'
];
};
};
$admins
=
$this
->
distributor
->
get_
distributor_new
(
$where
,
$page_no
,
self
::
PAGE_SIZE
);
$admins
=
$this
->
distributor
->
get_
protection_new
(
$where
);
$der
=
explode
(
','
,
$info
[
'building_id'
]);
$der
=
explode
(
','
,
$info
[
'building_id'
]);
$protection_arr
=
array
();
$protection_arr
=
array
();
foreach
(
$admins
as
$admin
){
foreach
(
$admins
as
$admin
){
$data_arrid
=
$this
->
relate
->
protection_list
(
array
(
'distributor_id'
=>
$admin
[
'distributor_id'
]));
$data_arrid
=
$this
->
relate
->
protection_list
_count
(
array
(
'distributor_id'
=>
$admin
[
'distributor_id'
]));
foreach
(
$data_arrid
as
$k
=>
$id
){
foreach
(
$data_arrid
as
$k
=>
$id
){
if
(
in_array
(
$data_arrid
[
$k
][
'building_id'
],
$der
)){
if
(
in_array
(
$data_arrid
[
$k
][
'building_id'
],
$der
)){
$protection_arr
[]
=
$data_arrid
[
$k
];
$protection_arr
[]
=
$data_arrid
[
$k
];
...
@@ -1036,9 +1036,18 @@ class Report extends CI_Controller
...
@@ -1036,9 +1036,18 @@ class Report extends CI_Controller
}
}
}
}
$this
->
data
[
'count'
]
=
$count
;
$count
=
count
(
$protection_arr
);
$this
->
data
[
'buildings'
]
=
$protection_arr
;
$where3
=
'BD.is_deleted ='
.
'0'
;
$where3
.=
" and BD.building_id in("
.
$info
[
'building_id'
]
.
")"
;
if
(
$user_data
[
'role'
]
==
12
){
$where3
.=
' and A.id ='
.
$user_data
[
'u_id'
];
};
$protection_list
=
$this
->
relate
->
protection_list
(
$where3
,
$page_no
,
self
::
PAGE_SIZE
);
$this
->
data
[
'buildings'
]
=
$protection_list
;
$this
->
data
[
'count'
]
=
$count
;
$data_arr
=
'?company_name='
.
$building
;
$data_arr
=
'?company_name='
.
$building
;
$this
->
data
[
'num_start'
]
=
(
$page_no
-
1
)
*
self
::
PAGE_SIZE
+
1
;
$this
->
data
[
'num_start'
]
=
(
$page_no
-
1
)
*
self
::
PAGE_SIZE
+
1
;
...
...
html/application/models/building_distributor_model.php
View file @
edd6fbcf
...
@@ -204,7 +204,7 @@ class Building_distributor_model extends MY_Model{
...
@@ -204,7 +204,7 @@ class Building_distributor_model extends MY_Model{
return
array
();
return
array
();
}
}
//获取保护期查看列表
//获取保护期查看列表
public
function
protection_list
(
$where
){
public
function
protection_list
(
$where
,
$page
=
1
,
$page_size
=
0
,
$order
=
NULL
){
$this
->
db
->
select
(
'set_protection, B.building_title building_title, D.company_name company_name, BD.building_id building_id'
);
$this
->
db
->
select
(
'set_protection, B.building_title building_title, D.company_name company_name, BD.building_id building_id'
);
$this
->
db
->
from
(
'tb_building_distributor_relate BD'
);
$this
->
db
->
from
(
'tb_building_distributor_relate BD'
);
$this
->
db
->
join
(
'tb_building B'
,
'B.id = BD.building_id'
,
'left'
);
$this
->
db
->
join
(
'tb_building B'
,
'B.id = BD.building_id'
,
'left'
);
...
@@ -213,11 +213,36 @@ class Building_distributor_model extends MY_Model{
...
@@ -213,11 +213,36 @@ class Building_distributor_model extends MY_Model{
{
{
$this
->
db
->
where
(
$where
);
$this
->
db
->
where
(
$where
);
}
}
if
(
!
$page
)
{
$query
=
$this
->
db
->
get
();
$query
=
$this
->
db
->
get
();
if
(
$query
->
num_rows
()
>
0
)
}
else
{
$query
=
$this
->
db
->
get
(
null
,
$page_size
,
(
$page
-
1
)
*
$page_size
);
}
//$query = $this->db->get();
if
(
$query
->
num_rows
()
>
0
){
return
$query
->
result_array
();
}
return
array
();
}
public
function
protection_list_count
(
$where
){
$this
->
db
->
select
(
'set_protection, B.building_title building_title, D.company_name company_name, BD.building_id building_id'
);
$this
->
db
->
from
(
'tb_building_distributor_relate BD'
);
$this
->
db
->
join
(
'tb_building B'
,
'B.id = BD.building_id'
,
'left'
);
$this
->
db
->
join
(
'tb_distributor D'
,
'D.id = BD.distributor_id'
,
'left'
);
if
(
!
empty
(
$where
))
{
{
$this
->
db
->
where
(
$where
);
}
$query
=
$this
->
db
->
get
();
//$query = $this->db->get();
if
(
$query
->
num_rows
()
>
0
){
return
$query
->
result_array
();
return
$query
->
result_array
();
}
}
return
false
;
return
array
()
;
}
}
}
}
html/application/models/distributor_model.php
View file @
edd6fbcf
...
@@ -175,7 +175,32 @@ class Distributor_model extends MY_Model{
...
@@ -175,7 +175,32 @@ class Distributor_model extends MY_Model{
return
array
();
return
array
();
}
}
//保护期查看统计列表
public
function
get_protection_new
(
$where
=
''
)
{
$this
->
db
->
select
(
'D.id distributor_id'
)
->
from
(
'tb_distributor D'
)
->
join
(
'tb_channel CH'
,
'CH.id=D.channel_id'
,
'left'
)
->
join
(
'tb_manager M'
,
'M.id=D.manager_id'
,
'left'
)
->
join
(
'tb_manager A'
,
'CH.manager_id=A.id'
,
'left'
)
->
join
(
'tb_building_distributor_relate R'
,
'R.distributor_id=D.id'
,
'left'
)
->
join
(
'tb_building B'
,
'B.id=R.building_id'
,
'left'
);
if
(
!
empty
(
$where
)){
$this
->
db
->
where
(
$where
);
}
$this
->
db
->
group_by
(
'D.id'
);
$this
->
db
->
order_by
(
'D.id desc'
);
$query
=
$this
->
db
->
get
();
if
(
$query
->
num_rows
()
>
0
){
return
$query
->
result_array
();
}
return
array
();
}
//后台分销商管理统计列表
//后台分销商管理统计列表
public
function
get_distributor
(
$where
=
''
,
$page
=
1
,
$page_size
=
0
,
$order
=
NULL
)
public
function
get_distributor
(
$where
=
''
,
$page
=
1
,
$page_size
=
0
,
$order
=
NULL
)
{
{
...
...
html/application/views/admin/report/protection.php
View file @
edd6fbcf
...
@@ -69,8 +69,6 @@
...
@@ -69,8 +69,6 @@
<td>
<?php
echo
$building
[
'building_title'
];
?>
</td>
<td>
<?php
echo
$building
[
'building_title'
];
?>
</td>
<td>
<?php
echo
$building
[
'company_name'
];
?>
</td>
<td>
<?php
echo
$building
[
'company_name'
];
?>
</td>
<td>
<?php
echo
$building
[
'set_protection'
]
?
$building
[
'set_protection'
]
:
7
;
?>
</td>
<td>
<?php
echo
$building
[
'set_protection'
]
?
$building
[
'set_protection'
]
:
7
;
?>
</td>
</tr>
</tr>
<?php
<?php
endforeach
;
endforeach
;
...
...
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