12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace app\models\article;
- use crmeb\traits\ModelTrait;
- use crmeb\basic\BaseModel;
- class ArticleCategory extends BaseModel
- {
-
- protected $pk = 'id';
-
- protected $name = 'article_category';
- use ModelTrait;
-
- public static function getArticleCategory()
- {
- return self::where('hidden', 0)->where('is_del', 0)->where('status', 1)->where('pid', 0)->order('sort DESC')->field('id,title')->select();
- }
-
- public static function getArticleCategoryField($id, $field = 'title')
- {
- if (!$id) return '';
- return self::where('id', $id)->value($field);
- }
-
- public static function cidByArticleList($cid, $first, $limit, $field = '*')
- {
- $model = new Article();
- if ($cid) $model->where('cid', $cid);
- return $model->field($field)->where('status', 1)->where('hide', 0)->order('sort DESC,add_time DESC')->limit($first, $limit)->select();
- }
- }
|