Beispiel #1
0
 public function getAll()
 {
     $count = $this->join('category c', 'article.cid', '=', 'c.id')->count('article.id');
     $page = Page::row(5)->pageNum(5)->make($count);
     $data = $this->table('article a')->field('a.title,a.id,c.catname,a.addtime')->join('category c', 'a.cid', '=', 'c.id')->limit(Page::limit())->get();
     // $data[] = $this->where('notice',1)->get();
     return array('page' => $page, 'data' => $data);
 }
Beispiel #2
0
 public function getDelAll()
 {
     $cate_id = Q('cate_id');
     if ($cate_id) {
         $page = Page::row(20)->make($this->where('cate_id', $cate_id)->where('is_delete', 1)->count());
         $data = $this->where('cate_id', $cate_id)->where('is_delete', 1)->limit(Page::limit())->get();
     } else {
         $page = Page::row(20)->make($this->where('is_delete', 1)->count());
         $data = $this->where('is_delete', 1)->limit(Page::limit())->get();
     }
     foreach ($data as $k => $v) {
         $brand = Db::table('shop_brand')->where('brand_id', $v['brand_id'])->first();
         $data[$k]['brand'] = $brand;
         $cate = Db::table('shop_cate')->where('cate_id', $v['cate_id'])->first();
         $data[$k]['cate'] = $cate;
     }
     $goods['data'] = $data;
     $goods['page'] = $page;
     return $goods;
 }