mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
新增 用户绑定鉴权卡
This commit is contained in:
@@ -18,9 +18,11 @@ public class PileAuthCardDTO {
|
||||
|
||||
private String status;
|
||||
|
||||
private String secretKey;
|
||||
|
||||
private String memberId;
|
||||
|
||||
private String phoneNumber;
|
||||
|
||||
private String VerificationCode;
|
||||
private String verificationCode;
|
||||
}
|
||||
|
||||
@@ -119,4 +119,10 @@ public interface IPileAuthCardService {
|
||||
* @return
|
||||
*/
|
||||
List<AuthCardVO> getAuthCardListByMemberId(String memberId);
|
||||
|
||||
/**
|
||||
* 用户绑定鉴权卡 (小程序用)
|
||||
* @param dto
|
||||
*/
|
||||
int bindAuthCard(PileAuthCardDTO dto);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@ import java.util.Locale;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.MemberBasicInfo;
|
||||
import com.jsowell.pile.dto.MemberRegisterAndLoginDTO;
|
||||
import com.jsowell.pile.dto.PileAuthCardDTO;
|
||||
import com.jsowell.pile.service.IMemberBasicInfoService;
|
||||
import com.jsowell.pile.vo.uniapp.AuthCardVO;
|
||||
@@ -217,4 +219,31 @@ public class PileAuthCardServiceImpl implements IPileAuthCardService {
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户绑定鉴权卡
|
||||
* @param dto
|
||||
*/
|
||||
@Override
|
||||
public int bindAuthCard(PileAuthCardDTO dto) {
|
||||
String phoneNumber = dto.getPhoneNumber();
|
||||
// 判断此用户是否已注册小程序账号
|
||||
MemberBasicInfo memberBasicInfo = memberBasicInfoService.selectInfoByMobileNumber(phoneNumber);
|
||||
if (memberBasicInfo == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_USER_IS_NOT_REGISTER);
|
||||
}
|
||||
// 判断此卡是否已被绑定
|
||||
PileAuthCard pileAuthCard = selectCardInfoByLogicCard(dto.getLogicCard());
|
||||
if (!StringUtils.equals(pileAuthCard.getStatus(), "0")) { // 0-待激活
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_THIS_CARD_STATUS_ANOMALY);
|
||||
}
|
||||
// 验证密钥
|
||||
if (!StringUtils.equals(dto.getSecretKey(), pileAuthCard.getSecretKey())) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_SECRET_KEY_NOT_SAME);
|
||||
}
|
||||
// 绑定操作
|
||||
pileAuthCard.setMemberId(dto.getMemberId());
|
||||
pileAuthCard.setStatus("1");
|
||||
return updatePileAuthCard(pileAuthCard);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user