|
|
@@ -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();
|
|
|
}
|
|
|
|