1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?php
-
-
- namespace app\model\system\log;
-
- use crmeb\basic\BaseModel;
- use crmeb\traits\ModelTrait;
- use think\Model;
-
- /**
- * 日志模型
- * Class SystemLog
- * @package app\model\system\log
- */
- class SystemLog extends BaseModel
- {
- use ModelTrait;
-
- /**
- * 数据表主键
- * @var string
- */
- protected $pk = 'id';
-
- /**
- * 模型名称
- * @var string
- */
- protected $name = 'system_log';
-
- protected $insert = ['add_time'];
-
- protected function setAddTimeAttr()
- {
- return time();
- }
-
- /**
- * @param $query
- * @param $value
- */
- public function searchStoreIdAttr($query, $value)
- {
- $query->where('store_id', $value);
- }
-
- /**
- * 访问方式搜索器
- * @param Model $query
- * @param $value
- */
- public function searchPagesAttr($query, $value)
- {
- $query->whereLike('page', '%' . $value . '%');
- }
-
- /**
- * 访问路径搜索器
- * @param Model $query
- * @param $value
- */
- public function searchPathAttr($query, $value)
- {
- $query->whereLike('path', '%' . $value . '%');
- }
-
- /**
- * ip搜索器
- * @param Model $query
- * @param $value
- */
- public function searchIpAttr($query, $value)
- {
- $query->where('ip', 'LIKE', "%$value%");
- }
-
- /**
- * 管理员id搜索器
- * @param Model $query
- * @param $value
- */
- public function searchAdminIdAttr($query, $value)
- {
- $query->whereIn('admin_id', $value);
- }
- }
|