Notice.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace catchAdmin\wechat\model;
  3. use catcher\base\CatchModel as Model;
  4. use catchAdmin\wechat\model\NoticeGet;
  5. use catchAdmin\wechat\model\search\NoticeSearchTrait;
  6. use catchAdmin\permissions\model\DataRangScopeTrait;
  7. class Notice extends Model
  8. {
  9. use NoticeGet;
  10. use NoticeSearchTrait;
  11. use DataRangScopeTrait;
  12. // 表名
  13. public $name = 'notice';
  14. // 数据库字段映射
  15. public $field = array(
  16. 'id',
  17. // 标题
  18. 'title',
  19. // 内容
  20. 'content',
  21. // 作者
  22. 'author',
  23. // 发布时间
  24. 'put_time',
  25. // 显示开始时间
  26. 'start_time',
  27. // 显示结束时间
  28. 'end_time',
  29. // 0-学校公告 1-班级公告
  30. 'type',
  31. // 学校id
  32. 'school_id',
  33. // 年级id
  34. 'grade_id',
  35. // 班级id
  36. 'class_id',
  37. // 0-禁用 1-启用
  38. 'enable',
  39. // 创建人ID
  40. 'creator_id',
  41. // 创建时间
  42. 'created_at',
  43. // 更新时间
  44. 'updated_at',
  45. // 软删除
  46. 'deleted_at',
  47. );
  48. /**
  49. * 获取公告列表
  50. */
  51. public function getList(){
  52. return $this->dataRange()
  53. ->catchSearch()
  54. ->append(['department_id','school_name','grade_name','class_name','type_text','enable_text'])
  55. ->order($this->aliasField('id'), 'desc')
  56. ->paginate();
  57. }
  58. }