|
|
@@ -127,12 +127,15 @@ public class ProductService {
|
|
|
if (!product.getVendorId().equals(vendorId)) {
|
|
|
return Result.error("无权操作");
|
|
|
}
|
|
|
- if (!"approved".equals(product.getStatus())) {
|
|
|
- return Result.error("商品未通过审核,无法上下架");
|
|
|
- }
|
|
|
if ("shelve".equals(action)) {
|
|
|
+ if (!"approved".equals(product.getStatus()) && !"off_shelf".equals(product.getStatus())) {
|
|
|
+ return Result.error("商品未通过审核,无法上架");
|
|
|
+ }
|
|
|
product.setStatus("on_shelf");
|
|
|
} else if ("unshelve".equals(action)) {
|
|
|
+ if (!"on_shelf".equals(product.getStatus())) {
|
|
|
+ return Result.error("商品未上架,无法下架");
|
|
|
+ }
|
|
|
product.setStatus("off_shelf");
|
|
|
} else {
|
|
|
return Result.error("操作类型错误");
|