diff --git a/app/admin/model/v1/ProductCategoryModel.php b/app/admin/model/v1/ProductCategoryModel.php index eb4dabaf..b642190a 100644 --- a/app/admin/model/v1/ProductCategoryModel.php +++ b/app/admin/model/v1/ProductCategoryModel.php @@ -32,7 +32,8 @@ class ProductCategoryModel extends ProductCategoryBaseModel // 所属产品目录分类id查询 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]); } /** diff --git a/app/admin/validate/v1/ProductCategoryValidate.php b/app/admin/validate/v1/ProductCategoryValidate.php index d1bf3df3..6d14513a 100644 --- a/app/admin/validate/v1/ProductCategoryValidate.php +++ b/app/admin/validate/v1/ProductCategoryValidate.php @@ -23,7 +23,7 @@ class ProductCategoryValidate extends Validate 'name' => 'require|max:64', 'icon' => 'max:125', 'desc' => 'max:255', - 'related_tco_category' => 'integer', + 'related_tco_category' => 'string', 'sort' => 'integer', 'level' => 'integer', 'is_show' => 'in:0,1', @@ -51,7 +51,7 @@ class ProductCategoryValidate extends Validate 'name.max' => '名称最多不能超过64个字符', 'icon.max' => '图标最多不能超过125个字符', 'desc.max' => '描述最多不能超过255个字符', - 'related_tco_category.integer' => '关联TCO分类格式错误', + 'related_tco_category.string' => '关联TCO分类格式错误', 'sort.integer' => '排序格式错误', 'level.integer' => '级别格式错误', 'is_show.in' => '是否显示格式错误',