店铺修改操作密码校验验证码

This commit is contained in:
张松
2025-03-05 15:42:09 +08:00
parent 6de7f4e044
commit fb9346cd5d
3 changed files with 50 additions and 1 deletions

View File

@@ -3,14 +3,17 @@ package com.czg.service.account.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import com.czg.account.dto.PageDTO;
import com.czg.account.dto.shopinfo.*;
import com.czg.account.entity.*;
import com.czg.account.service.*;
import com.czg.config.RedisCst;
import com.czg.enums.StatusEnum;
import com.czg.exception.ApiNotPrintException;
import com.czg.exception.CzgException;
import com.czg.sa.StpKit;
import com.czg.service.RedisService;
import com.czg.service.account.mapper.ShopInfoMapper;
import com.czg.utils.AssertUtil;
import com.czg.utils.GeoUtil;
@@ -48,6 +51,8 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
private ShopUserService shopUserService;
@Resource
private ShopExtendService shopExtendService;
@Resource
private RedisService redisService;
@Override
@Cacheable(key = "#id")
@@ -140,6 +145,16 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
if (shopInfoEditDTO.getActivateCode() != null) {
activateShop(shopInfo, shopInfoEditDTO.getActivateCode());
}
if (shopInfoEditDTO.getOperationPwd() != null) {
String key = "%s%s:%s".formatted(RedisCst.SMS_CODE, shopInfo.getPhone(), "editShopInfoOpePwd");
Object val = redisService.get(key);
if (val instanceof String code && !shopInfoEditDTO.getCode().equals(code)) {
throw new ApiNotPrintException("验证码错误");
}
shopInfo.setOperationPwd(SecureUtil.md5(shopInfo.getId() + shopInfoEditDTO.getOperationPwd()));
}
return updateById(shopInfo);
}