You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.0 KiB
48 lines
1.0 KiB
11 months ago
|
<?php
|
||
|
declare (strict_types=1);
|
||
|
|
||
|
namespace app\store\model\server;
|
||
|
|
||
|
use app\common\model\server\RecoveryCategory as BaseRecoveryCategory;
|
||
|
|
||
|
class RecoveryCategory extends BaseRecoveryCategory
|
||
|
{
|
||
|
/**
|
||
|
* @notes:新增
|
||
|
* @param $data
|
||
|
* @return bool
|
||
|
* @author: wanghousheng
|
||
|
*/
|
||
|
public function add($data): bool
|
||
|
{
|
||
|
$data['store_id'] = self::$storeId;
|
||
|
return $this->save($data);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @notes:编辑
|
||
|
* @param $data
|
||
|
* @return bool
|
||
|
* @author: wanghousheng
|
||
|
*/
|
||
|
public function edit($data): bool
|
||
|
{
|
||
|
// 是否删除图片
|
||
|
!isset($data['image_id']) && $data['image_id'] = 0;
|
||
|
return $this->save($data) !== false;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @notes:删除
|
||
|
* @return bool
|
||
|
* @author: wanghousheng
|
||
|
*/
|
||
|
public function remove(): bool
|
||
|
{
|
||
|
if (!static::detail(['category_id' => $this['category_id']])) {
|
||
|
$this->error = '记录不存在';
|
||
|
return false;
|
||
|
}
|
||
|
return $this->delete();
|
||
|
}
|
||
|
}
|