feat: 新增产品分类增/删/改/查接口
This commit is contained in:
@@ -4,6 +4,7 @@ declare (strict_types = 1);
|
||||
namespace app\admin\model\v1;
|
||||
|
||||
use app\common\model\ProductCategoryBaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
/**
|
||||
* 产品分类模型
|
||||
@@ -11,5 +12,25 @@ use app\common\model\ProductCategoryBaseModel;
|
||||
*/
|
||||
class ProductCategoryModel extends ProductCategoryBaseModel
|
||||
{
|
||||
//
|
||||
// 启用软件删除
|
||||
use SoftDelete;
|
||||
// 软件字段
|
||||
protected $deleteTime = 'deleted_at';
|
||||
// 修改自动写入时间格式
|
||||
protected $autoWriteTimestamp = 'datetime';
|
||||
|
||||
// 根据pid查询
|
||||
public function scopePid($query, $pid)
|
||||
{
|
||||
$query->where('pid', $pid);
|
||||
}
|
||||
|
||||
// 搜索分类名称
|
||||
public function searchNameNullableAttr($query, $value, $data)
|
||||
{
|
||||
if (is_null($value)) {
|
||||
return;
|
||||
}
|
||||
$query->where('name', 'like', '%' . $value . '%');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user