예제 #1
0
 /**
  * 手机栏目预览
  */
 public function mcategoryPreview($id, $page = 1)
 {
     $template = new PrintController('preview', 'mobile');
     return $template->categoryPreview($id, $page);
 }
예제 #2
0
 private function mcategoryhtml($ids = [])
 {
     $template = new PrintController('online', 'mobile');
     $result = [];
     $per_page = CustomerInfo::where('cus_id', $this->cus_id)->pluck('mobile_page_count');
     foreach ($ids as $id) {
         $c_ids = explode(',', $template->getChirldenCid($id));
         $total = Articles::whereIn('c_id', $c_ids)->where('cus_id', $this->cus_id)->where('mobile_show', '1')->count();
         $page_count = ceil($total / $per_page);
         $this->getPrecent();
         $path = public_path('customers/' . $this->customer . '/mobile/category/' . $id . '.html');
         $template->categoryPreview($id, 1);
         file_put_contents($path, ob_get_contents());
         ob_clean();
         $result[] = $path;
         for ($i = 2; $i <= $page_count; $i++) {
             $this->getPrecent();
             $path = public_path('customers/' . $this->customer . '/mobile/category/' . $id . '_' . $i . '.html');
             $template->categoryPreview($id, $i);
             file_put_contents($path, ob_get_contents());
             ob_clean();
             $result[] = $path;
         }
     }
     return $result;
 }