2025-04-01 16:23:28 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace app\adminapi\model;
|
|
|
|
|
2025-04-21 18:24:02 +08:00
|
|
|
use app\common\model\BaseModel;
|
2025-04-01 16:23:28 +08:00
|
|
|
use think\Model;
|
|
|
|
|
2025-04-21 18:24:02 +08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2025-04-21 18:24:02 +08:00
|
|
|
|
|
|
|
|
|
|
|
/** 通用详情(后台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
|
|
|
}
|