fix: 修复后台产品分类关联tco分类验证问题
All checks were successful
Gitea Actions Official-website / deploy-dev (push) Successful in 5s

This commit is contained in:
2025-12-08 09:34:56 +08:00
parent 276d901875
commit 4d34d76c4f
2 changed files with 4 additions and 3 deletions

View File

@@ -32,7 +32,8 @@ class ProductCategoryModel extends ProductCategoryBaseModel
// 所属产品目录分类id查询 // 所属产品目录分类id查询
public function scopeTcoId($query, $value) public function scopeTcoId($query, $value)
{ {
$query->where('related_tco_category', '=', $value); // $query->where('related_tco_category', '=', $value);
$query->whereRaw('FIND_IN_SET(:ref_id, related_tco_category)', ['ref_id' => $value]);
} }
/** /**

View File

@@ -23,7 +23,7 @@ class ProductCategoryValidate extends Validate
'name' => 'require|max:64', 'name' => 'require|max:64',
'icon' => 'max:125', 'icon' => 'max:125',
'desc' => 'max:255', 'desc' => 'max:255',
'related_tco_category' => 'integer', 'related_tco_category' => 'string',
'sort' => 'integer', 'sort' => 'integer',
'level' => 'integer', 'level' => 'integer',
'is_show' => 'in:0,1', 'is_show' => 'in:0,1',
@@ -51,7 +51,7 @@ class ProductCategoryValidate extends Validate
'name.max' => '名称最多不能超过64个字符', 'name.max' => '名称最多不能超过64个字符',
'icon.max' => '图标最多不能超过125个字符', 'icon.max' => '图标最多不能超过125个字符',
'desc.max' => '描述最多不能超过255个字符', 'desc.max' => '描述最多不能超过255个字符',
'related_tco_category.integer' => '关联TCO分类格式错误', 'related_tco_category.string' => '关联TCO分类格式错误',
'sort.integer' => '排序格式错误', 'sort.integer' => '排序格式错误',
'level.integer' => '级别格式错误', 'level.integer' => '级别格式错误',
'is_show.in' => '是否显示格式错误', 'is_show.in' => '是否显示格式错误',