Station.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. namespace catchAdmin\device\model;
  3. use catcher\base\CatchModel as Model;
  4. use catchAdmin\permissions\model\DataRangScopeTrait;
  5. use catchAdmin\device\model\get\StationGet;
  6. class Station extends Model
  7. {
  8. use DataRangScopeTrait;
  9. use StationGet;
  10. // 表名
  11. public $name = 'stations';
  12. // 数据库字段映射
  13. public $field = array(
  14. 'id',
  15. // 基站Mac
  16. 'mac',
  17. // 基站简码
  18. 'shortcode',
  19. // 基站名称
  20. 'name',
  21. // 基站型号
  22. 'model',
  23. // 基站序列号
  24. 'serial_number',
  25. // 所属部门
  26. 'department_id',
  27. // 版本号
  28. 'version',
  29. // 开局状态
  30. 'open_status',
  31. // SIM卡号
  32. 'sim_no',
  33. // 经度
  34. 'longitude',
  35. // 纬度
  36. 'latitude',
  37. // 在线时间
  38. 'online_time',
  39. // 安装地址
  40. 'address',
  41. // 备注
  42. 'remark',
  43. // 开局时间
  44. 'open_time',
  45. // 开局用户
  46. 'open_user_id',
  47. // 创建人ID
  48. 'creator_id',
  49. // 创建时间
  50. 'created_at',
  51. // 更新时间
  52. 'updated_at',
  53. // 软删除
  54. 'deleted_at',
  55. );
  56. /**
  57. * 获取基站列表
  58. */
  59. public function getStationList($field, $order)
  60. {
  61. $res = $this->dataRange()
  62. ->catchSearch()
  63. ->append(['depart_name', 'net_state', 'open_user_name', 'creator_name', 'model_text'])
  64. ->order($this->aliasField($field), $order)
  65. ->paginate();
  66. return $res;
  67. }
  68. /**
  69. * 获取基站导出列表
  70. */
  71. public function getStationExportList()
  72. {
  73. $res = $this->dataRange()
  74. ->catchSearch()
  75. ->append(['depart_name', 'net_state','open_user_name', 'creator_name', 'model_text'])
  76. ->order($this->aliasField('id'), 'desc')
  77. ->select();
  78. return $res;
  79. }
  80. }