123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- <?php
- namespace catchAdmin\fences\model;
- use catcher\base\CatchModel as Model;
- use catchAdmin\fences\model\FencesGet;
- use catchAdmin\permissions\model\DataRangScopeTrait;
- class Fences extends Model
- {
- use FencesGet;
- use DataRangScopeTrait;
- // 表名
- public $name = 'fences';
- // 数据库字段映射
- public $field = array(
- 'id',
- // 围栏名称
- 'name',
- // 围栏类型
- 'fence_shape',
- // 围栏类别
- 'fence_type',
- // 围栏信息
- 'fence_info',
- // 作用部门
- 'departments',
- // 推送用户
- 'push_users',
- // 进围栏检测
- 'is_check_in',
- // 进围栏检测时间
- 'in_fence_time_area',
- // 出围栏检测
- 'is_check_out',
- // 出围栏检测时间
- 'out_fence_time_area',
- // 推送间隔
- 'sent_interval',
- // 备注
- 'remark',
- // 创建人ID
- 'creator_id',
- // 创建时间
- 'created_at',
- // 更新时间
- 'updated_at',
- // 软删除
- 'deleted_at',
- );
- public function getList()
- {
- // 不分页
- if (property_exists($this, 'paginate') && $this->paginate === false) {
- return $this->dataRange()
- ->catchSearch()
- ->field('*')
- ->catchOrder()
- ->where('fence_type', 0)
- ->append(['type_name','in_fence_time_area_text','out_fence_time_area_text','department_name','level'])
- ->creator()
- ->select();
- }
- // 分页列表
- return $this->dataRange()
- ->catchSearch()
- ->field('*')
- ->catchOrder()
- ->where('fence_type', 0)
- ->append(['type_name','in_fence_time_area_text','out_fence_time_area_text','department_name','level'])
- ->creator()
- ->paginate();
- }
- public function getSchoolFenceList()
- {
- // 不分页
- if (property_exists($this, 'paginate') && $this->paginate === false) {
- $res= $this->dataRange()
- ->catchSearch()
- ->field('*')
- ->catchOrder()
- ->where('fence_type', 2)
- ->append(['type_name','department_name','level'])
- ->creator()
- ->select();
- // var_dump($this->getLastSql());
- return $res;
- }
- // 分页列表
- $res= $this->dataRange()
- ->catchSearch()
- ->field('*')
- ->catchOrder()
- ->where('fence_type', 2)
- ->append(['type_name','department_name','level'])
- ->creator()
- ->paginate();
- // var_dump($this->getLastSql());
- return $res;
- }
- public function getKqFenceList()
- {
- // 不分页
- if (property_exists($this, 'paginate') && $this->paginate === false) {
- $res= $this->dataRange()
- ->catchSearch()
- ->field('*')
- ->catchOrder()
- ->where('fence_type', 3)
- ->append(['type_name','department_name','level'])
- ->creator()
- ->select();
- // var_dump($this->getLastSql());
- return $res;
- }
- // 分页列表
- $res= $this->dataRange()
- ->catchSearch()
- ->field('*')
- ->catchOrder()
- ->where('fence_type', 3)
- ->append(['type_name','department_name','level'])
- ->creator()
- ->paginate();
- // var_dump($this->getLastSql());
- return $res;
- }
- }
|