This commit is contained in:
@@ -156,12 +156,16 @@ public class ProductController {
|
||||
@PostMapping("/categories/{categoryId}/attributes")
|
||||
public Result<Void> saveCategoryAttributes(
|
||||
@PathVariable String categoryId,
|
||||
@RequestBody List attributes,
|
||||
@RequestBody Map<String, Object> body,
|
||||
@RequestHeader(value = "X-User-Role", required = false) String role) {
|
||||
if (!"admin".equals(role)) {
|
||||
return Result.error("只有管理员可以操作");
|
||||
}
|
||||
categoryAttributeService.saveAttributes(categoryId, attributes);
|
||||
List attrs = (List) body.get("attributes");
|
||||
if (attrs == null) {
|
||||
attrs = (List) body.get("list");
|
||||
}
|
||||
categoryAttributeService.saveAttributes(categoryId, attrs);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user