update 卖家删除钱包,修改钱包。删除店铺修改店铺均加了谷歌验证码
This commit is contained in:
@@ -7,7 +7,7 @@ import com.m2pool.lease.dto.v2.ShopWalletInfoDto;
|
||||
import com.m2pool.lease.entity.LeaseShop;
|
||||
import com.m2pool.lease.vo.*;
|
||||
import com.m2pool.lease.vo.v2.ShopWalletInfoVo;
|
||||
import com.m2pool.lease.vo.v2.WalletIdAndCodeVo;
|
||||
import com.m2pool.lease.vo.v2.GoogleCodeVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -64,7 +64,7 @@ public interface LeaseShopService extends IService<LeaseShop> {
|
||||
* @param baseVo
|
||||
* @return
|
||||
*/
|
||||
Result<String> deleteShop(BaseVo baseVo);
|
||||
Result<String> deleteShop(GoogleCodeVo baseVo);
|
||||
|
||||
|
||||
/**
|
||||
@@ -101,7 +101,7 @@ public interface LeaseShopService extends IService<LeaseShop> {
|
||||
* @param baseVo
|
||||
* @return
|
||||
*/
|
||||
Result<String> deleteShopConfig(WalletIdAndCodeVo baseVo);
|
||||
Result<String> deleteShopConfig(GoogleCodeVo baseVo);
|
||||
|
||||
/**
|
||||
* 获取链和链列表
|
||||
|
||||
@@ -19,8 +19,8 @@ import com.m2pool.lease.service.LeaseShopConfigService;
|
||||
import com.m2pool.lease.service.LeaseShopService;
|
||||
import com.m2pool.lease.utils.*;
|
||||
import com.m2pool.lease.vo.*;
|
||||
import com.m2pool.lease.vo.v2.GoogleCodeVo;
|
||||
import com.m2pool.lease.vo.v2.ShopWalletInfoVo;
|
||||
import com.m2pool.lease.vo.v2.WalletIdAndCodeVo;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -113,9 +113,19 @@ public class LeaseShopServiceImpl extends ServiceImpl<LeaseShopMapper, LeaseShop
|
||||
@Override
|
||||
public Result<String> updateShop(ShopVo shopVo) {
|
||||
|
||||
String userEmail = SecurityUtils.getUsername();
|
||||
|
||||
if (shopVo.getId() == null || shopVo.getId() == 0){
|
||||
return Result.fail("id不能为空或0");
|
||||
}
|
||||
GoogleInfo googleInfo = leaseUserMapper.getGoogleInfoByEmail(userEmail);
|
||||
if(googleInfo == null || StringUtils.isBlank(googleInfo.getSecret())){
|
||||
//未绑定定谷歌验证器
|
||||
return Result.fail("您的账号未开启双重验证,请先开启验证!");
|
||||
}
|
||||
if(!GoogleAuthenticator.checkCode(googleInfo.getSecret(), shopVo.getGCode(), System.currentTimeMillis())){
|
||||
return Result.fail("谷歌验证码错误");
|
||||
}
|
||||
|
||||
LeaseShop leaseShop = LeaseShop.builder()
|
||||
.id(shopVo.getId())
|
||||
@@ -205,11 +215,23 @@ public class LeaseShopServiceImpl extends ServiceImpl<LeaseShopMapper, LeaseShop
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Result<String> deleteShop(BaseVo baseVo) {
|
||||
public Result<String> deleteShop(GoogleCodeVo baseVo) {
|
||||
LeaseShop byId = getById(baseVo.getId());
|
||||
String userEmail = SecurityUtils.getUsername();
|
||||
GoogleInfo googleInfo = leaseUserMapper.getGoogleInfoByEmail(userEmail);
|
||||
if (byId.getDel()){
|
||||
return Result.fail("删除店铺失败,店铺已删除,请刷新页面");
|
||||
}
|
||||
//校验谷歌验证码
|
||||
//1.1谷歌验证
|
||||
if(googleInfo == null || StringUtils.isBlank(googleInfo.getSecret())){
|
||||
//未绑定定谷歌验证器
|
||||
return Result.fail("您的账号未开启双重验证,请先开启验证!");
|
||||
}
|
||||
if(!GoogleAuthenticator.checkCode(googleInfo.getSecret(), baseVo.getGCode(), System.currentTimeMillis())){
|
||||
return Result.fail("谷歌验证码错误");
|
||||
}
|
||||
|
||||
updateMachineInfoV1(baseVo.getId());
|
||||
updateMachineInfoV2(baseVo.getId());
|
||||
boolean b = updateById(LeaseShop.builder().id(baseVo.getId()).del(true).build());
|
||||
@@ -473,7 +495,7 @@ public class LeaseShopServiceImpl extends ServiceImpl<LeaseShopMapper, LeaseShop
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> deleteShopConfig(WalletIdAndCodeVo baseVo) {
|
||||
public Result<String> deleteShopConfig(GoogleCodeVo baseVo) {
|
||||
String userEmail = SecurityUtils.getUsername();
|
||||
//1.根据id找到要删除的钱包配置
|
||||
LeaseShopConfig config = leaseShopConfigMapper.selectById(baseVo.getId());
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.m2pool.lease.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.nacos.common.utils.StringUtils;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
@@ -31,10 +30,7 @@ import com.m2pool.lease.utils.email.EmailTemplateEntity;
|
||||
import com.m2pool.lease.utils.text.Convert;
|
||||
import com.m2pool.lease.utils.uuid.IdUtils;
|
||||
import com.m2pool.lease.vo.*;
|
||||
import com.m2pool.lease.vo.v2.CloseAccountVo;
|
||||
import com.m2pool.lease.vo.v2.GoogleBindVo;
|
||||
import com.m2pool.lease.vo.v2.GoogleCloseVo;
|
||||
import com.m2pool.lease.vo.v2.UserGoogleAuthInfo;
|
||||
import com.m2pool.lease.vo.v2.*;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -42,7 +38,6 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
|
||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.thymeleaf.TemplateEngine;
|
||||
import org.thymeleaf.context.Context;
|
||||
|
||||
@@ -51,7 +46,6 @@ import javax.mail.MessagingException;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
@@ -382,7 +376,6 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
|
||||
@Transactional
|
||||
public Result<String> closeAccount(CloseAccountVo closeAccountVo) {
|
||||
String userEmail = SecurityUtils.getUsername();
|
||||
//1.
|
||||
GoogleInfo googleInfo = leaseUserMapper.getGoogleInfoByEmail(userEmail);
|
||||
//1.1谷歌验证
|
||||
if(googleInfo == null || StringUtils.isBlank(googleInfo.getSecret())){
|
||||
@@ -409,9 +402,10 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
|
||||
leaseShoppingCartInfoMapper.delete(new LambdaQueryWrapper<LeaseShoppingCartInfo>()
|
||||
.eq(LeaseShoppingCartInfo::getUserId, userEmail));
|
||||
//删除用户店铺,矿机,店铺配置(钱包)相关信息
|
||||
BaseVo baseVo = new BaseVo();
|
||||
baseVo.setId(leaseShop.getId());
|
||||
Result<String> stringResult = leaseShopService.deleteShop(baseVo);
|
||||
GoogleCodeVo googleCodeVo = new GoogleCodeVo();
|
||||
googleCodeVo.setId(leaseShop.getId());
|
||||
googleCodeVo.setGCode(closeAccountVo.getGCode());
|
||||
Result<String> stringResult = leaseShopService.deleteShop(googleCodeVo);
|
||||
//删除钱包
|
||||
leaseUserWalletDataMapper.update(LeaseUserWalletData.builder().del(true).build(),
|
||||
new LambdaUpdateWrapper<LeaseUserWalletData>()
|
||||
|
||||
Reference in New Issue
Block a user