47 lines
966 B
PHP
Raw Normal View History

2025-04-01 16:23:28 +08:00
<?php
namespace app\adminapi\model;
use app\common\model\BaseModel;
2025-04-01 16:23:28 +08:00
use think\Model;
class AuthGroup extends BaseModel
2025-04-01 16:23:28 +08:00
{
protected $name = 'api_auth_group';
// 开启自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
public function getNameAttr($value, $data)
{
return __($value);
}
/** 通用详情(后台api版本)
* @param $params
* @param $trans
* @return $this
* @throws \Exception
*/
public function detail($id,$show_field=[],$except_field=[]){
$row = $this->get($id);
if (!$row) {
throw new \Exception(__('No Results were found'));
}
if($show_field){
$row->visible($show_field);
}
if($except_field){
$row->hidden($except_field);
}
return $row;
}
2025-04-01 16:23:28 +08:00
}