Browse Source

新增web支付

刘韬 2 years ago
parent
commit
db5609e9d3

+ 2 - 1
PacsOnline_Wechat_Patient/src/main/java/com/zskk/controller/WeixinApiController.java

@@ -232,7 +232,8 @@ public class WeixinApiController extends ApiController {
         String str = "{\"expire_seconds\": 2592000, \"action_name\": \"QR_STR_SCENE\", \"action_info\": {\"scene\": {\"scene_str\": \"ReportQR_"
         String str = "{\"expire_seconds\": 2592000, \"action_name\": \"QR_STR_SCENE\", \"action_info\": {\"scene\": {\"scene_str\": \"ReportQR_"
 				+ reportId + "\"}}}";
 				+ reportId + "\"}}}";
 		ApiResult apiResult = QrcodeApi.create(str);
 		ApiResult apiResult = QrcodeApi.create(str);
-		renderJson(apiResult);
+//		renderJson(apiResult);
+		renderText(apiResult.getStr("url"));
 
 
     }
     }
     
     

+ 27 - 7
PacsOnline_Wechat_Patient/src/main/java/com/zskk/controller/WeixinPayController.java

@@ -533,22 +533,41 @@ public class WeixinPayController extends Controller {
 	public void wap2() {
 	public void wap2() {
 		Map<String, String> params = new HashMap<String, String>();
 		Map<String, String> params = new HashMap<String, String>();
 		params.put("appid", appid);
 		params.put("appid", appid);
-		params.put("mch_id", partner);
-		params.put("body", "JFinal2.0极速开发");
-		params.put("out_trade_no", "977773682111");
-		params.put("total_fee", "1");
+		params.put("mch_id", partner_jx);
+		String body = this.getPara("body");
+		if (body == null) {
+			renderText("need body");
+		}
+		params.put("body", body);
+		String out_trade_no = this.getPara("out_trade_no");
+		if (out_trade_no == null) {
+			renderText("need out_trade_no");
+		}
+		params.put("out_trade_no", out_trade_no);
+		String total_fee = this.getPara("total_fee");
+		if (total_fee == null) {
+			renderText("need total_fee");
+		}
+		
+		params.put("total_fee", total_fee);
 
 
 		String ip = IpKit.getRealIp(getRequest());
 		String ip = IpKit.getRealIp(getRequest());
 		if (StrKit.isBlank(ip)) {
 		if (StrKit.isBlank(ip)) {
 			ip = "127.0.0.1";
 			ip = "127.0.0.1";
 		}
 		}
-
+		if (ip.contains(",")) {
+			ip = ip.split(",")[0];
+		}
 		params.put("spbill_create_ip", ip);
 		params.put("spbill_create_ip", ip);
 		params.put("trade_type", TradeType.MWEB.name());
 		params.put("trade_type", TradeType.MWEB.name());
 		params.put("nonce_str", System.currentTimeMillis() / 1000 + "");
 		params.put("nonce_str", System.currentTimeMillis() / 1000 + "");
+		String notify_url = this.getPara("notify_url");
+		if (notify_url == null) {
+			renderText("need notify_url");
+		}
 		params.put("notify_url", notify_url);
 		params.put("notify_url", notify_url);
 
 
-		String sign = PaymentKit.createSign(params, paternerKey);
+		String sign = PaymentKit.createSign(params, paternerKey_jx);
 		params.put("sign", sign);
 		params.put("sign", sign);
 		String xmlResult = PaymentApi.pushOrder(params);
 		String xmlResult = PaymentApi.pushOrder(params);
 
 
@@ -568,9 +587,10 @@ public class WeixinPayController extends Controller {
 		}
 		}
 		// 以下字段在return_code 和result_code都为SUCCESS的时候有返回
 		// 以下字段在return_code 和result_code都为SUCCESS的时候有返回
 		String url = result.get("mweb_url");
 		String url = result.get("mweb_url");
+		renderText(url);
 
 
 		// 微信那边的开发建议用a标签打开该链接
 		// 微信那边的开发建议用a标签打开该链接
-		setAttr("url", url);
+//		setAttr("url", url);
 	}
 	}
 
 
 	public String getParamByUrl(String url, String name) {
 	public String getParamByUrl(String url, String name) {