update 汇付

This commit is contained in:
2023-05-18 16:31:47 +08:00
parent 27bec35c7c
commit f04d92af37

View File

@@ -86,6 +86,37 @@ public class PayController extends BaseController {
return response;
}
/**
* 会员充值余额
*/
@PostMapping("/rechargeBalance")
public RestApiResponse<?> rechargeBalance(HttpServletRequest request, @RequestBody WeixinPayDTO dto) {
logger.info("微信支付 param:{}", dto.toString());
RestApiResponse<?> response;
try {
if (StringUtils.isBlank(dto.getCode()) || StringUtils.isBlank(dto.getAmount())) {
return new RestApiResponse<>(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());
if (StringUtils.isBlank(openId)) {
throw new BusinessException(ReturnCodeEnum.CODE_GET_OPEN_ID_BY_CODE_ERROR);
}
dto.setOpenId(openId);
// 充值余额 附加参数
Map<String, Object> weixinMap = memberService.rechargeBalanceWithAdapay(dto);
response = new RestApiResponse<>(ImmutableMap.of("weixinMap", weixinMap));
} catch (Exception e) {
response = new RestApiResponse<>();
}
return response;
}
/**
* 7002 支付订单
* http://localhost:8080/uniapp/pay/payOrder