后台更新礼物log

This commit is contained in:
2025-09-26 10:43:56 +08:00
parent b208651ed3
commit bc30048c64

View File

@@ -245,7 +245,7 @@ public class GiftAdminService extends AbstractCoreService<Gift, GiftExample> {
@SneakyThrows
@Override
public int save(Gift entity, boolean isEdit, boolean isSelective) {
log.info("更新礼物: entity:{}, isEdit:{},isSelective:{}", gson.toJson(entity), isEdit, isSelective);
// 新增福袋时默认下线
if (entity.getGiftId() == null && entity.getGiftType().equals(Constant.GiftType.LUCKY_BAG)) {
entity.setGiftStatus(Constant.status.invalid);
@@ -305,12 +305,15 @@ public class GiftAdminService extends AbstractCoreService<Gift, GiftExample> {
}
int result = super.save(entity, isEdit, isSelective);
log.info("更新礼物-刷新缓存前: entity:{}", gson.toJson(entity));
if (Constant.status.valid.equals(entity.getGiftStatus())) {
Object id = getId(entity);
if (isEdit) {
entity = super.get(id);
}
jedisService.hwrite(RedisKey.gift.getKey(), id.toString(), gson.toJson(entity));
String json = gson.toJson(entity);
log.info("更新礼物缓存: id:{},entity:{}", id, json);
jedisService.hwrite(RedisKey.gift.getKey(), id.toString(), json);
}
return result;
}