zoujiajian 2 سال پیش
والد
کامیت
8cddfc82ae

+ 4 - 6
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/shop/YhShopUserController.java

@@ -89,18 +89,16 @@ public class YhShopUserController {
 	 * 设置是否展示广告位
 	 */
 	@PutMapping("/set/shop/ad")
-	public Result<String> setShopAd(@RequestBody YhShop yhShop) {
+	public Result<String> setShopAd() {
 		long userId = StpYhShopManageUser.getLoginIdAsLong();
 		YhShop dbShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
 				.eq(YhShop::getUserId, userId).last("limit 1"));
 		if (dbShop == null) {
 			throw BusinessRuntimeException.getInstance("店铺不存在");
 		}
-		if (yhShop.getIsShowAd() != null && dbShop.getIsShowAd() != yhShop.getIsShowAd()) {
-			dbShop.setIsShowAd(yhShop.getIsShowAd());
-			yhShopMapper.updateById(dbShop);
-			refreshCacheService.refreshUserShopMangeCache(dbShop.getCustomId());
-		}
+		dbShop.setIsShowAd(!dbShop.getIsShowAd());
+		yhShopMapper.updateById(dbShop);
+		refreshCacheService.refreshUserShopMangeCache(dbShop.getCustomId());
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}