AdCategory.php 758 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace app\common\model\ad;
  3. use app\common\model\BaseModel;
  4. /**
  5. * 广告分类模型
  6. */
  7. class AdCategory extends BaseModel
  8. {
  9. protected $name = 'ad_category';
  10. protected $pk = 'category_id';
  11. /**
  12. * 所有分类
  13. * @return \think\Collection
  14. * @throws \think\db\exception\DataNotFoundException
  15. * @throws \think\db\exception\DbException
  16. * @throws \think\db\exception\ModelNotFoundException
  17. */
  18. public static function getALL($category_id=0)
  19. {
  20. $where = [];
  21. if($category_id){
  22. $where['category_id'] = $category_id;
  23. }
  24. $model = new static;
  25. return $model->where($where)->order(['create_time' => 'asc'])->select();
  26. }
  27. }