1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace catchAdmin\logs\model;
- use catcher\base\CatchModel as Model;
- use catchAdmin\system\model\SysDictData;
- class ConfigLog extends Model
- {
- // 表名
- public $name = 'send_config_log';
- // 数据库字段映射
- public $field = array(
- 'id',
- // 下发内容
- 'send_contents',
- // 响应内容
- 'resp_contents',
- // 下发结果 0-待下发 1-下发中 2-下发成功 3-下发失败
- 'result',
- // 创建人ID
- 'creator_id',
- // 创建时间
- 'created_at',
- // 更新时间
- 'updated_at',
- // 软删除
- 'deleted_at',
- );
- public function getList(){
- return $this->catchSearch()
- ->order($this->aliasField('id'), 'desc')
- ->paginate();
- }
- public function searchDeviceIdAttr($query, $value, $data)
- {
- return $query->where('device_id',$value);
- }
- public function getCreatedAtAttr($value)
- {
- if($value){
- return date('Y-m-d H:i:s',$value);
- }
- return '';
- }
- public function getUpdatedAtAttr($value)
- {
- if($value){
- return date('Y-m-d H:i:s',$value);
- }
- return '';
- }
- public function getResultAttr($value)
- {
- return (new SysDictData)->getValueByCode('SendConfigResult',$value);
- }
- }
|