pull/1/head
parent
a4b5fc1cff
commit
886b1e4710
@ -0,0 +1,53 @@ |
||||
<?php |
||||
declare (strict_types=1); |
||||
|
||||
namespace app\api\model\Server; |
||||
|
||||
use app\api\model\UploadFile; |
||||
use app\common\model\server\RecoveryCategory as BaseRecoveryCategory; |
||||
use think\db\exception\DataNotFoundException; |
||||
use think\db\exception\DbException; |
||||
use think\db\exception\ModelNotFoundException; |
||||
use think\model\relation\HasOne; |
||||
|
||||
class RecoveryCategory extends BaseRecoveryCategory |
||||
{ |
||||
/** |
||||
* 隐藏字段 |
||||
* @var array |
||||
*/ |
||||
protected $hidden = [ |
||||
'store_id', |
||||
'create_time', |
||||
'update_time', |
||||
'status', |
||||
'image_id', |
||||
]; |
||||
|
||||
/** |
||||
* 分类图片 |
||||
* @return HasOne |
||||
*/ |
||||
public function image(): HasOne |
||||
{ |
||||
return $this->hasOne(UploadFile::class, 'file_id', 'image_id') |
||||
->bind(['image_url' => 'preview_url']); |
||||
} |
||||
|
||||
/** |
||||
* @notes:获取全部记录 |
||||
* @return array |
||||
* @throws DataNotFoundException |
||||
* @throws DbException |
||||
* @throws ModelNotFoundException |
||||
* @author: wanghousheng |
||||
*/ |
||||
public function list(): array |
||||
{ |
||||
return $this->with(['image']) |
||||
->where(['status' => 1]) |
||||
->order(['sort', 'create_time']) |
||||
->select() |
||||
->toArray(); |
||||
} |
||||
} |
@ -0,0 +1,21 @@ |
||||
<?php |
||||
|
||||
namespace app\api\model\Server; |
||||
|
||||
use app\common\model\server\ServerRecovery as BaseServerRecovery; |
||||
|
||||
class ServerRecovery extends BaseServerRecovery |
||||
{ |
||||
/** |
||||
* 隐藏字段 |
||||
* @var array |
||||
*/ |
||||
protected $hidden = [ |
||||
'store_id', |
||||
'create_time', |
||||
'update_time', |
||||
'status', |
||||
'image_id', |
||||
'delete_time', |
||||
]; |
||||
} |
Loading…
Reference in new issue