| | |
| | | //设置微信支付参数 |
| | | WxPayConfig payConfig = new WxPayConfig(); |
| | | |
| | | payConfig.setAppId(StringUtils.trimToNull(wxConfig.getAppid())); |
| | | payConfig.setAppId(StringUtils.trimToNull(wxConfig.getAppappid())); |
| | | payConfig.setMchId(StringUtils.trimToNull(wxConfig.getMchId())); |
| | | payConfig.setMchKey(StringUtils.trimToNull(wxConfig.getPrivateKey())); |
| | | payConfig.setSubAppId(StringUtils.trimToNull(null)); |
| | | payConfig.setSubMchId(StringUtils.trimToNull(null)); |
| | | payConfig.setKeyPath(StringUtils.trimToNull(null)); |
| | | wxPayService.setConfig(payConfig); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //设置微信同一订单请求 |
| | |
| | | throw new BusinessException("找不到微信配置"); |
| | | } |
| | | WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); |
| | | config.setAppid(wxConfig.getAppid()); |
| | | config.setAppid(wxConfig.getAppappid()); |
| | | config.setSecret(wxConfig.getAppSecret()); |
| | | WxMaService service = new WxMaServiceImpl(); |
| | | service.setWxMaConfig(config); |
| | |
| | | |
| | | public String getOpenId(Long poleId, String wxCode) throws WxErrorException { |
| | | WxConfigEntity userConfig = wxPayConfigService.getConfigByPoleId(poleId); |
| | | WxConfigEntity wxConfig = new WxConfigEntity(); |
| | | wxConfig.setAppid(userConfig.getAppid()); |
| | | wxConfig.setMchId(userConfig.getMchId()); |
| | | wxConfig.setPrivateKey(userConfig.getPrivateKey()); |
| | | wxConfig.setAppSecret(userConfig.getAppSecret()); |
| | | if (wxConfig == null) { |
| | | if (userConfig == null) { |
| | | throw new BusinessException("找不到微信配置"); |
| | | } |
| | | WxMaJscode2SessionResult sessionInfo = this.getWxMaService(wxConfig).getUserService().getSessionInfo(wxCode); |
| | | WxMaJscode2SessionResult sessionInfo = this.getWxMaService(userConfig).getUserService().getSessionInfo(wxCode); |
| | | return sessionInfo.getOpenid(); |
| | | } |
| | | |