添加pcpay 支付

This commit is contained in:
牛叉闪闪
2024-09-12 14:34:19 +08:00
parent 73bad5713a
commit 6a9f084df1
2 changed files with 13 additions and 2 deletions

View File

@@ -1897,6 +1897,16 @@ public class PayService {
public Result createOrder(String ip,String userId,String payType,String shopId,BigDecimal amount) throws JsonProcessingException {
if(ObjectUtil.isNull(userId)||ObjectUtil.isEmpty(userId)||ObjectUtil.isEmpty(payType)||ObjectUtil.isNull(payType)
||ObjectUtil.isNull(shopId)||ObjectUtil.isEmpty(shopId)||ObjectUtil.isNull(shopId)||ObjectUtil.isNull(amount)||ObjectUtil.isEmpty(amount)
){
return Result.fail(CodeEnum.PARAM);
}
if(!"WECHAT".equals(payType)||!"ALIPAY".equals(payType)){
return Result.fail(CodeEnum.PARAM);
}
TbShopInfo shopInfo= tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(shopId));
if(ObjectUtil.isNull(shopInfo)){

View File

@@ -104,7 +104,7 @@ public class WechatUtil {
public static JSONObject getSessionKeyOrOpenId(String code, String appId, String secrete) {
String requestUrl = "https://api.weixin.qq.com/sns/jscode2session";
String requestUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?";
Map<String, String> requestUrlParam = new HashMap<>();
// https://mp.weixin.qq.com/wxopen/devprofile?action=get_profile&token=164113089&lang=zh_CN
//小程序appId
@@ -112,10 +112,11 @@ public class WechatUtil {
//小程序secret
requestUrlParam.put("secret", secrete);
//小程序端返回的code
requestUrlParam.put("js_code", code);
requestUrlParam.put("code", code);
//默认参数
requestUrlParam.put("grant_type", "authorization_code");
//发送post请求读取调用微信接口获取openid用户唯一标识
log.info("请求参数:{}",JSONUtil.toJSONString(requestUrlParam));
JSONObject jsonObject = JSON.parseObject(HttpClientUtil.doPost(requestUrl,requestUrlParam));
return jsonObject;
}