实现后台操作日志记录;

This commit is contained in:
augushong
2019-09-06 13:42:38 +08:00
parent 6715b4b09b
commit c487090181
9 changed files with 253 additions and 4 deletions

40
app/model/AdminLog.php Normal file
View File

@@ -0,0 +1,40 @@
<?php
namespace app\model;
use think\Model;
use think\model\concern\SoftDelete;
/**
* @mixin think\Model
*/
class AdminLog extends Model
{
//
use SoftDelete;
protected $defaultSoftDelete = 0;
public function admin()
{
return $this->belongsTo('Admin','admin_id');
}
public function getUrlAttr()
{
return AdminPermission::where([
'app'=>$this->getData('app'),
'controller'=>$this->getData('controller'),
'action'=>$this->getData('action'),
])->find();
}
public function setParamAttr($value)
{
return json_encode($value,JSON_UNESCAPED_UNICODE);
}
public function getParamAttr($value)
{
return \mb_substr($value,0,30);
}
}

View File

@@ -11,4 +11,14 @@ use think\Model;
class AdminPermission extends Model
{
//
public function getIsLogAttr($value)
{
$status = [
0=>'不记录',
1=>'记录',
];
return $status[intval($value)];
}
}