47 lines
		
	
	
		
			966 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
		
		
			
		
	
	
			47 lines
		
	
	
		
			966 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| 
								 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								namespace app\adminapi\model;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								use app\common\model\BaseModel;
							 | 
						||
| 
								 | 
							
								use think\Model;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class AuthGroup extends BaseModel
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    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;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 |