예제 #1
0
 /**
  * 栏目页静态文件生成并返回生成文件名的数组
  * 
  * @param array $ids
  * @return multitype:string
  */
 private function categoryhtml($ids = [], $type = 'pc')
 {
     $result = array();
     $template = new PrintController('online', $type);
     $per_page = CustomerInfo::where('cus_id', $this->cus_id)->pluck($type . "_page_count");
     if ($type == 'pc') {
         $publicdata = $this->pushpc;
     } else {
         $publicdata = $this->pushmobile;
     }
     foreach ((array) $ids as $id) {
         $c_ids = explode(',', $template->getChirldenCid($id, 1));
         $a_c_type = Classify::where('id', $id)->pluck('type');
         //取得栏目的type
         $pc_page_count_switch = CustomerInfo::where('cus_id', $this->cus_id)->pluck('pc_page_count_switch');
         //页面图文列表图文显示个数是否分开控制开关
         if (isset($pc_page_count_switch) && $pc_page_count_switch == 1 && $type == 'pc') {
             if ($a_c_type == 1) {
                 $page_number = CustomerInfo::where('cus_id', $this->cus_id)->pluck('pc_page_txt_count');
                 //每页文字显示个数
                 $total = Articles::whereIn('c_id', $c_ids)->where('cus_id', $this->cus_id)->where($type . '_show', '1')->count();
                 $page_count = ceil($total / $page_number);
             }
             if ($a_c_type == 3) {
                 $page_number = CustomerInfo::where('cus_id', $this->cus_id)->pluck('pc_page_imgtxt_count');
                 //每页图文显示个数
                 $total = Articles::whereIn('c_id', $c_ids)->where('cus_id', $this->cus_id)->where($type . '_show', '1')->count();
                 $page_count = ceil($total / $page_number);
             }
             if ($a_c_type == 2) {
                 $page_number = CustomerInfo::where('cus_id', $this->cus_id)->pluck('pc_page_img_count');
                 //每页图片显示个数
                 $total = Articles::whereIn('c_id', $c_ids)->where('cus_id', $this->cus_id)->where($type . '_show', '1')->count();
                 $page_count = ceil($total / $page_number);
             }
         } else {
             $total = Articles::whereIn('c_id', $c_ids)->where('cus_id', $this->cus_id)->where($type . '_show', '1')->count();
             $page_count = ceil($total / $per_page);
         }
         $paths = $template->categoryPush($id, $page_count, $publicdata, $this->last_html_precent, $this->html_precent);
         $this->last_html_precent += $this->html_precent * count($paths);
         $result = array_merge((array) $result, (array) $paths);
     }
     return $result;
 }