优化微信支付
This commit is contained in:
parent
8475dc5324
commit
4d27c8c84d
|
|
@ -104,6 +104,16 @@ public class PayServiceImpl implements IPayService {
|
||||||
*/
|
*/
|
||||||
public Object prepay(PaymentValidate params, Integer terminal) {
|
public Object prepay(PaymentValidate params, Integer terminal) {
|
||||||
try {
|
try {
|
||||||
|
String openId = null;
|
||||||
|
UserAuth userAuth = userAuthMapper.selectOne(new QueryWrapper<UserAuth>()
|
||||||
|
.eq("user_id", params.getUserId())
|
||||||
|
.eq("terminal", terminal)
|
||||||
|
.last("limit 1"));
|
||||||
|
|
||||||
|
if (StringUtils.isNotNull(userAuth)) {
|
||||||
|
openId = userAuth.getOpenid();
|
||||||
|
}
|
||||||
|
|
||||||
switch (params.getPayWay()) {
|
switch (params.getPayWay()) {
|
||||||
case 1: // 余额支付
|
case 1: // 余额支付
|
||||||
String attach = params.getAttach();
|
String attach = params.getAttach();
|
||||||
|
|
@ -113,7 +123,7 @@ public class PayServiceImpl implements IPayService {
|
||||||
case 2: // 微信支付
|
case 2: // 微信支付
|
||||||
PaymentRequestV3 requestV3 = new PaymentRequestV3();
|
PaymentRequestV3 requestV3 = new PaymentRequestV3();
|
||||||
requestV3.setTerminal(terminal);
|
requestV3.setTerminal(terminal);
|
||||||
requestV3.setOpenId("");
|
requestV3.setOpenId(openId);
|
||||||
requestV3.setAttach(params.getAttach());
|
requestV3.setAttach(params.getAttach());
|
||||||
requestV3.setOutTradeNo(params.getOutTradeNo());
|
requestV3.setOutTradeNo(params.getOutTradeNo());
|
||||||
requestV3.setOrderAmount(params.getOrderAmount());
|
requestV3.setOrderAmount(params.getOrderAmount());
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,11 @@ public class PaymentValidate implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@NotNull(message = "scene参数缺失")
|
@NotNull(message = "scene参数缺失")
|
||||||
@ApiModelProperty("支付场景")
|
@ApiModelProperty("支付场景: [recharge=充值,order=普通订单]")
|
||||||
private String scene;
|
private String scene;
|
||||||
|
|
||||||
@NotNull(message = "payWay参数缺失")
|
@NotNull(message = "payWay参数缺失")
|
||||||
@ApiModelProperty("支付方式")
|
@ApiModelProperty("支付方式: [1=余额支付,2=微信支付,3=支付宝支付]")
|
||||||
private Integer payWay;
|
private Integer payWay;
|
||||||
|
|
||||||
@NotNull(message = "orderId参数缺失")
|
@NotNull(message = "orderId参数缺失")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue