2019-12-06 09:17:40 +08:00
|
|
|
<?php
|
|
|
|
namespace catcher\base;
|
|
|
|
|
2020-02-06 12:02:38 +08:00
|
|
|
use catcher\CatchQuery;
|
2019-12-06 09:17:40 +08:00
|
|
|
use catcher\traits\db\BaseOptionsTrait;
|
|
|
|
use catcher\traits\db\TransTrait;
|
|
|
|
use think\model\concern\SoftDelete;
|
2020-06-21 10:50:05 +08:00
|
|
|
use catcher\traits\db\ScopeTrait;
|
2019-12-06 09:17:40 +08:00
|
|
|
|
2020-02-06 12:02:38 +08:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @mixin CatchQuery
|
|
|
|
* Class CatchModel
|
|
|
|
* @package catcher\base
|
|
|
|
*/
|
2019-12-12 09:14:08 +08:00
|
|
|
abstract class CatchModel extends \think\Model
|
2019-12-06 09:17:40 +08:00
|
|
|
{
|
2020-06-21 10:50:05 +08:00
|
|
|
use SoftDelete, TransTrait, BaseOptionsTrait, ScopeTrait;
|
2019-12-06 09:17:40 +08:00
|
|
|
|
2019-12-07 17:31:38 +08:00
|
|
|
protected $createTime = 'created_at';
|
2019-12-06 09:17:40 +08:00
|
|
|
|
2019-12-07 17:31:38 +08:00
|
|
|
protected $updateTime = 'updated_at';
|
2019-12-06 09:17:40 +08:00
|
|
|
|
2019-12-07 17:31:38 +08:00
|
|
|
protected $deleteTime = 'deleted_at';
|
2019-12-06 09:17:40 +08:00
|
|
|
|
2019-12-13 17:26:54 +08:00
|
|
|
protected $defaultSoftDelete = 0;
|
|
|
|
|
2019-12-07 17:31:38 +08:00
|
|
|
protected $autoWriteTimestamp = true;
|
|
|
|
|
2020-01-21 17:57:33 +08:00
|
|
|
public const LIMIT = 10;
|
2019-12-07 17:31:38 +08:00
|
|
|
|
|
|
|
// 开启
|
|
|
|
public const ENABLE = 1;
|
|
|
|
// 禁用
|
|
|
|
public const DISABLE = 2;
|
2020-11-23 19:57:49 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 是否有 field
|
|
|
|
*
|
|
|
|
* @time 2020年11月23日
|
|
|
|
* @param string $field
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function hasField(string $field)
|
|
|
|
{
|
|
|
|
return property_exists($this, 'field') ? in_array($field, $this->field) : false;
|
|
|
|
}
|
2019-12-06 09:17:40 +08:00
|
|
|
}
|