Post.php 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Description: 岗位
  4. // +----------------------------------------------------------------------
  5. // | Author:
  6. // +----------------------------------------------------------------------
  7. namespace app\admin\model;
  8. use app\admin\model\Common;
  9. class Post extends Common
  10. {
  11. /**
  12. * 为了数据库的整洁,同时又不影响Model和Controller的名称
  13. * 我们约定每个模块的数据表都加上相同的前缀,比如CRM模块用crm作为数据表前缀
  14. */
  15. protected $name = 'admin_post';
  16. protected $createTime = 'create_time';
  17. protected $updateTime = false;
  18. protected $autoWriteTimestamp = true;
  19. protected $insert = [
  20. 'status' => 1,
  21. ];
  22. /**
  23. * [getDataList 获取列表]
  24. * @return [array]
  25. */
  26. public function getDataList($request)
  27. {
  28. $request = $this->fmtRequest( $request );
  29. $map = $request['map'];
  30. if (isset($map['search'])) {
  31. $map['name'] = ['like', '%'.$map['search'].'%'];
  32. unset($map['search']);
  33. } else {
  34. $map = where_arr($map, 'member'); //高级筛选
  35. }
  36. $data = $this->where($map)->page($request['page'], $request['limit'])->select();
  37. return $data;
  38. }
  39. }