|
|
@@ -147,6 +147,7 @@ public class WxpayController {
|
|
|
logger.info("公众号支付缺少openId:--需要用户授权");
|
|
|
String url = WechatConnector.createAuthorizeUrl(WxConfig.oauthUserScope, wxPayApi.getConfig().getAppId(), URLEncoder.encode("http://lj.ubtob.com", "UTF-8"));
|
|
|
response.sendRedirect(url);
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
logger.info("公众号支付处理:openId=" + openId);
|
|
|
@@ -400,7 +401,7 @@ public class WxpayController {
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 获取token 这大概是基础支持token 一日上限2000次 用具体用户授权无关
|
|
|
+ * 获取token 基础支持token 一日上限2000次 与用户网页授权无关 与支付无关
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@@ -440,12 +441,6 @@ public class WxpayController {
|
|
|
logger.info("公众号获取:authCode=" + code + ",state=" + state);
|
|
|
//String xmlResult = IOUtils.toString(request.getInputStream(), request.getCharacterEncoding());
|
|
|
String openId = wxPayApi.authcode2Openid(code);
|
|
|
- User user = SystemSession.getUser();
|
|
|
- if (user == null) {
|
|
|
- user = new User();
|
|
|
- }
|
|
|
- user.setWxOpenId(openId);
|
|
|
- SystemSession.setUser(user);
|
|
|
} catch (WxPayException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
@@ -488,37 +483,6 @@ public class WxpayController {
|
|
|
//
|
|
|
|
|
|
|
|
|
-
|
|
|
-// /**
|
|
|
-// * 获取验签秘钥API
|
|
|
-// * https://pay.weixin.qq.com/wiki/doc/api/jsapi_sl.php?chapter=23_1
|
|
|
-// * mch_id 商户号
|
|
|
-// * partnerKey 商户平台设置的密钥key
|
|
|
-// * @return {String}
|
|
|
-// */
|
|
|
-// @ResponseBody
|
|
|
-// @RequestMapping("/getsignkey")
|
|
|
-// public String getsignkey() throws Exception {
|
|
|
-// Map<String, String> map =new HashMap<String, String>();
|
|
|
-// String mch_id = "";
|
|
|
-// String partnerKey = "";//商户平台设置的密钥key
|
|
|
-// String nonce_str = String.valueOf(System.currentTimeMillis());
|
|
|
-// map.put("mch_id", mch_id);//商户号
|
|
|
-// map.put("nonce_str", nonce_str);//随机字符串
|
|
|
-// map.put("sign", WxSign.createSign(map, partnerKey));
|
|
|
-//
|
|
|
-// String url = null;
|
|
|
-// if (isSandBox) {
|
|
|
-// url = WXPayConstants.SANDBOX_GETSINGKEY_URL;
|
|
|
-// }else {
|
|
|
-// //url = WXPayConstants.UGETSINGKEY_URL;
|
|
|
-// }
|
|
|
-// HttpUtil.Response result = HttpUtil.sendPostRequest(url, map);
|
|
|
-//
|
|
|
-// return result.getResponseText();
|
|
|
-// }
|
|
|
-//
|
|
|
-
|
|
|
private WxPayUnifiedOrderRequest createWxPayUnifiedOrderRequest(HttpServletRequest request, ProjectRecode projectRecode, String tradeType) {
|
|
|
//Project project = projectRecode.getProject();
|
|
|
WxPayUnifiedOrderRequest wxPayUnifiedOrderRequest = new WxPayUnifiedOrderRequest();
|