|
@@ -9,6 +9,7 @@ import com.kym.common.constant.ResponseEnum;
|
|
|
import com.kym.common.exception.BusinessException;
|
|
import com.kym.common.exception.BusinessException;
|
|
|
import com.kym.common.utils.OrderUtils;
|
|
import com.kym.common.utils.OrderUtils;
|
|
|
import com.kym.entity.miniapp.PayLog;
|
|
import com.kym.entity.miniapp.PayLog;
|
|
|
|
|
+import com.kym.entity.miniapp.WalletDetail;
|
|
|
import com.kym.service.miniapp.PayLogService;
|
|
import com.kym.service.miniapp.PayLogService;
|
|
|
import com.kym.service.miniapp.WalletDetailService;
|
|
import com.kym.service.miniapp.WalletDetailService;
|
|
|
import com.kym.service.wechat.WxPayService;
|
|
import com.kym.service.wechat.WxPayService;
|
|
@@ -106,8 +107,17 @@ public class WxPayServiceImpl implements WxPayService {
|
|
|
}
|
|
}
|
|
|
var rechargeAmount = params.getInteger("amount");
|
|
var rechargeAmount = params.getInteger("amount");
|
|
|
var openid = StpUtil.getSession().getString("openid");
|
|
var openid = StpUtil.getSession().getString("openid");
|
|
|
|
|
+ var userId = StpUtil.getLoginIdAsLong();
|
|
|
// 生成订单号
|
|
// 生成订单号
|
|
|
String outTradeNo = OrderUtils.getOrderNo();
|
|
String outTradeNo = OrderUtils.getOrderNo();
|
|
|
|
|
+ // 创建支付记录
|
|
|
|
|
+ var walletDetail = new WalletDetail()
|
|
|
|
|
+ .setType(WalletDetail.TYPE_充值)
|
|
|
|
|
+ .setUserId(userId)
|
|
|
|
|
+ .setAmount(rechargeAmount)
|
|
|
|
|
+ .setOrderNo(outTradeNo);
|
|
|
|
|
+ walletDetailService.save(walletDetail);
|
|
|
|
|
+
|
|
|
// request.setXxx(val)设置所需参数,具体参数可见Request定义
|
|
// request.setXxx(val)设置所需参数,具体参数可见Request定义
|
|
|
PrepayRequest request = new PrepayRequest();
|
|
PrepayRequest request = new PrepayRequest();
|
|
|
Amount amount = new Amount();
|
|
Amount amount = new Amount();
|