mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
支付宝登录
This commit is contained in:
@@ -61,47 +61,47 @@ public class PayController extends BaseController {
|
||||
* http://localhost:8080/uniapp/pay/weixinPay
|
||||
* @deprecated 使用汇付支付,充值余额
|
||||
*/
|
||||
@PostMapping("/weixinPay")
|
||||
public RestApiResponse<?> weixinPay(HttpServletRequest request, @RequestBody WeixinPayDTO dto) {
|
||||
logger.info("微信支付 param:{}", dto.toString());
|
||||
RestApiResponse<?> response;
|
||||
try {
|
||||
if (dto != null) {
|
||||
throw new BusinessException("00500005", "充值功能维护,已有余额可用,推荐使用在线支付");
|
||||
}
|
||||
if (StringUtils.isBlank(dto.getCode()) || StringUtils.isBlank(dto.getAmount())) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
// 鉴权
|
||||
String memberId = getMemberIdByAuthorization(request);
|
||||
if (StringUtils.isBlank(memberId)) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_TOKEN_ERROR);
|
||||
}
|
||||
dto.setMemberId(memberId);
|
||||
// String openId = memberService.getOpenIdByCode(dto.getCode());
|
||||
MemberBasicInfo memberBasicInfo = memberBasicInfoService.selectInfoByMemberId(memberId);
|
||||
if (memberBasicInfo == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_GET_OPEN_ID_BY_CODE_ERROR);
|
||||
}
|
||||
String openId = memberBasicInfo.getOpenId();
|
||||
dto.setOpenId(openId);
|
||||
// 充值余额 附加参数
|
||||
PaymentScenarioDTO paymentScenarioDTO = new PaymentScenarioDTO();
|
||||
paymentScenarioDTO.setType(ScenarioEnum.BALANCE.getValue());
|
||||
paymentScenarioDTO.setMemberId(memberId);
|
||||
dto.setAttach(JSON.toJSONString(paymentScenarioDTO));
|
||||
dto.setDescription("会员充值余额");
|
||||
Map<String, Object> weixinMap = orderService.weixinPayV3(dto);
|
||||
response = new RestApiResponse<>(ImmutableMap.of("weixinMap", weixinMap));
|
||||
} catch (BusinessException e) {
|
||||
logger.warn("充值余额支付warn", e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.warn("充值余额支付error", e);
|
||||
response = new RestApiResponse<>();
|
||||
}
|
||||
return response;
|
||||
}
|
||||
// @PostMapping("/weixinPay")
|
||||
// public RestApiResponse<?> weixinPay(HttpServletRequest request, @RequestBody WeixinPayDTO dto) {
|
||||
// logger.info("微信支付 param:{}", dto.toString());
|
||||
// RestApiResponse<?> response;
|
||||
// try {
|
||||
// if (dto != null) {
|
||||
// throw new BusinessException("00500005", "充值功能维护,已有余额可用,推荐使用在线支付");
|
||||
// }
|
||||
// if (StringUtils.isBlank(dto.getCode()) || StringUtils.isBlank(dto.getAmount())) {
|
||||
// throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
// }
|
||||
// // 鉴权
|
||||
// String memberId = getMemberIdByAuthorization(request);
|
||||
// if (StringUtils.isBlank(memberId)) {
|
||||
// throw new BusinessException(ReturnCodeEnum.CODE_TOKEN_ERROR);
|
||||
// }
|
||||
// dto.setMemberId(memberId);
|
||||
// // String openId = memberService.getOpenIdByCode(dto.getCode());
|
||||
// MemberBasicInfo memberBasicInfo = memberBasicInfoService.selectInfoByMemberId(memberId);
|
||||
// if (memberBasicInfo == null) {
|
||||
// throw new BusinessException(ReturnCodeEnum.CODE_GET_OPEN_ID_BY_CODE_ERROR);
|
||||
// }
|
||||
// String openId = memberBasicInfo.getOpenId();
|
||||
// dto.setOpenId(openId);
|
||||
// // 充值余额 附加参数
|
||||
// PaymentScenarioDTO paymentScenarioDTO = new PaymentScenarioDTO();
|
||||
// paymentScenarioDTO.setType(ScenarioEnum.BALANCE.getValue());
|
||||
// paymentScenarioDTO.setMemberId(memberId);
|
||||
// dto.setAttach(JSON.toJSONString(paymentScenarioDTO));
|
||||
// dto.setDescription("会员充值余额");
|
||||
// Map<String, Object> weixinMap = orderService.weixinPayV3(dto);
|
||||
// response = new RestApiResponse<>(ImmutableMap.of("weixinMap", weixinMap));
|
||||
// } catch (BusinessException e) {
|
||||
// logger.warn("充值余额支付warn", e);
|
||||
// response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
// } catch (Exception e) {
|
||||
// logger.warn("充值余额支付error", e);
|
||||
// response = new RestApiResponse<>();
|
||||
// }
|
||||
// return response;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 7002 支付订单
|
||||
|
||||
Reference in New Issue
Block a user