diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index 0145fa2d0..c2f0225ff 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -71,12 +71,26 @@ class PromoteController extends BaseController $logCount = M('protect_log','tab_')->count(); $readLogCount = M('protect_log_read','tab_')->where("promote_id = {$promote_id}")->count(); - $gg_Count = M("document", "sys_")->where("category_id=56 and status=1")->count(); - $gg_ReadDocument = M("document_read", "sys_")->where("promote_id = {$promote_id} and category_id=56")->count(); + $gg_data = M("document", "sys_")->where("category_id=56 and status=1")->order("update_time desc")->select(); + $gg_Count = count($gg_data); + $gg_data = implode(',',array_column($gg_data,'id')); + + $gg_where = "promote_id = {$promote_id} and category_id=56"; + if ($gg_data) { + $gg_where .= " and document_id IN({$gg_data})"; + } + $gg_ReadDocument = M("document_read", "sys_")->where($gg_where)->count(); +// var_dump($gg_ReadDocument);die(); - $zx_Count = M("document", "sys_")->where("category_id=51 and status=1")->count(); - $zx_ReadDocument = M("document_read", "sys_")->where("promote_id = {$promote_id} and category_id=51")->count(); + $zx_data = M("document", "sys_")->where("category_id=51 and status=1")->order("update_time desc")->select(); + $zx_Count = count($zx_data); + $zx_data = implode(',',array_column($zx_data,'id')); + $zx_where = "promote_id = {$promote_id} and category_id=51"; + if ($zx_data) { + $zx_where .= " and document_id IN({$zx_data})"; + } + $zx_ReadDocument = M("document_read", "sys_")->where($zx_where)->count(); $xx_list = null; $today_start = mktime(0, 0, 0, date('m'), date('d'), date('Y')); @@ -511,11 +525,26 @@ class PromoteController extends BaseController $logCount = M('protect_log','tab_')->count(); $readLogCount = M('protect_log_read','tab_')->where("promote_id = {$promote_id}")->count(); - $gg_Count = M("document", "sys_")->where("category_id=56 and status=1")->count(); - $gg_ReadDocument = M("document_read", "sys_")->where("promote_id = {$promote_id} and category_id=56")->count(); + $gg_data = M("document", "sys_")->where("category_id=56 and status=1")->order("update_time desc")->select(); + $gg_Count = count($gg_data); + $gg_data = implode(',',array_column($gg_data,'id')); - $zx_Count = M("document", "sys_")->where("category_id=51 and status=1")->count(); - $zx_ReadDocument = M("document_read", "sys_")->where("promote_id = {$promote_id} and category_id=51")->count(); + $gg_where = "promote_id = {$promote_id} and category_id=56"; + if ($gg_data) { + $gg_where .= " and document_id IN({$gg_data})"; + } + $gg_ReadDocument = M("document_read", "sys_")->where($gg_where)->count(); +// var_dump($gg_ReadDocument);die(); + + + $zx_data = M("document", "sys_")->where("category_id=51 and status=1")->order("update_time desc")->select(); + $zx_Count = count($zx_data); + $zx_data = implode(',',array_column($zx_data,'id')); + $zx_where = "promote_id = {$promote_id} and category_id=51"; + if ($zx_data) { + $zx_where .= " and document_id IN({$zx_data})"; + } + $zx_ReadDocument = M("document_read", "sys_")->where($zx_where)->count(); $parameter['p'] = I('get.p', 1); $parameter['row'] = I('get.row');