Selaa lähdekoodia

微信二维码支付以及公众号内支付演示

小柒2012 7 vuotta sitten
vanhempi
commit
30637609f0

+ 9 - 2
README.md

@@ -1,5 +1,5 @@
 #spring-boot-pay
-支付服务:支付宝,微信,银联详细代码案例
+支付服务:支付宝,微信,银联详细代码案例(企业认证)
 
 ##支付宝
 
@@ -14,7 +14,11 @@
 - H5支付:https://pay.weixin.qq.com/wiki/doc/api/H5.php?chapter=15_1
 
 #注意
-由于工作原因,项目正在完善中 ,随时更新日志
+由于工作原因,项目正在完善中 ,随时更新日志,有疑问请留言或者加群
+
+- JAVA爱好者①:26490602
+- JAVA爱好者②:361526039
+- JAVA爱好者③:571607950
 
 ##2017年07月30日更新
 
@@ -26,4 +30,7 @@
 
 ##2017年07月31日更新
 - 微信支付基础组间
+- 支付相关参数wxinfo.properties,需要自行去阅读微信支付文档自行生成
+- 微信二维码支付Demo测试完成
+- 微信公众号支付(需要添加认证网址)
 

+ 3 - 1
src/main/java/com/itstyle/Application.java

@@ -1,5 +1,7 @@
 package com.itstyle;
 
+import java.io.IOException;
+
 import org.apache.log4j.Logger;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -26,7 +28,7 @@ public class Application  {
         return "index";
     }
 	
-	public static void main(String[] args) throws InterruptedException {
+	public static void main(String[] args) throws InterruptedException, IOException {
 		SpringApplication.run(Application.class, args);
 		//初始化 支付宝 微信参数 涉及机密 此文件不提交 请自行配置加载
 		//依赖 commons.configuration 修改会自动更新相关配置

+ 2 - 4
src/main/java/com/itstyle/common/constants/Constants.java

@@ -3,7 +3,7 @@ package com.itstyle.common.constants;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.springframework.web.context.ContextLoader;
+import org.springframework.util.ClassUtils;
 
 public class Constants {
 	
@@ -15,10 +15,8 @@ public class Constants {
 	public static final String SF_PATH_SEPARATOR = System.getProperty("path.separator");//路径分隔符
 	
 	
-	public static final String PATH = ContextLoader.getCurrentWebApplicationContext().getServletContext().getRealPath("/file")
-	         +Constants.SF_FILE_SEPARATOR;
 
-	public static final String QRCODE_PATH = PATH+"pay_qrCode"; 
+	public static final String QRCODE_PATH = ClassUtils.getDefaultClassLoader().getResource("static").getPath()+SF_FILE_SEPARATOR+"qrcode"; 
 	
 	public static final String WEIXIN_BILL = "tradetime, ghid, mchid, submch, deviceid, wxorder, bzorder, openid, tradetype, tradestatus, bank, currency, totalmoney, redpacketmoney, wxrefund, bzrefund, refundmoney, redpacketrefund, refundtype, refundstatus, productname, bzdatapacket, fee, rate";
 	

+ 20 - 0
src/main/java/com/itstyle/modules/alipay/controller/AliPayController.java

@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import com.alipay.api.AlipayApiException;
 import com.alipay.api.internal.util.AlipaySignature;
 import com.alipay.demo.trade.config.Configs;
+import com.itstyle.common.constants.Constants;
 import com.itstyle.common.model.Product;
 import com.itstyle.modules.alipay.service.IAliPayService;
 /**
@@ -44,6 +45,25 @@ public class AliPayController {
 		map.addAttribute("form", form);
 		return "alipay/pay";
     }
+	@RequestMapping("/mobilePay")
+    public String  mobilePay(Product product,ModelMap map) {
+		logger.info("手机H5支付");
+		String form  =  aliPayService.aliPayMobile(product);
+		map.addAttribute("form", form);
+		return "alipay/pay";
+    }
+	@RequestMapping("/qcPay")
+    public String  qcPay(Product product,ModelMap map) {
+		logger.info("二维码支付");
+		String message  =  aliPayService.aliPay(product);
+		if(Constants.SUCCESS.equals(message)){
+			String img= "../qrcode/"+product.getOutTradeNo()+".png";
+			map.addAttribute("img", img);
+		}else{
+			//失败
+		}
+		return "alipay/qcpay";
+    }
     /**
      * 支付宝支付回调(二维码、H5、网站)
      * @Author  科帮网

+ 10 - 7
src/main/java/com/itstyle/modules/alipay/service/impl/AliPayServiceImpl.java

@@ -7,6 +7,7 @@ import net.sf.json.JSONObject;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import com.alipay.api.AlipayApiException;
@@ -35,15 +36,18 @@ import com.itstyle.modules.alipay.util.AliPayConfig;
 public class AliPayServiceImpl implements IAliPayService {
 	private static final Logger logger = LoggerFactory.getLogger(AliPayServiceImpl.class);
 	
+	@Value("${alipay.notify.url}")
+	private String notify_url;
+	
 	@Override
 	public String aliPay(Product product) {
-		logger.info(product.getAttach()+"(订单号:"+product.getOutTradeNo()+"生成支付宝支付码)");
+		logger.info("订单号:{}生成支付宝支付码",product.getOutTradeNo());
 		String  message = Constants.SUCCESS;
-		//String imgPath= Constants.SF_FILE_SEPARATOR+"alipay_"+product.getOutTradeNo()+".png";
-		//二维码存放路径 自行定义
-		String imgPath= "D:\\"+product.getOutTradeNo()+".png";
+		//二维码存放路径
+		System.out.println(Constants.QRCODE_PATH);
+		String imgPath= Constants.QRCODE_PATH+Constants.SF_FILE_SEPARATOR+product.getOutTradeNo()+".png";
 		String outTradeNo = product.getOutTradeNo();
-		String subject = product.getBody();
+		String subject = product.getSubject();
 		String totalAmount =  CommonUtil.divide(product.getTotalFee(), "100").toString();
 		// 如果该字段为空,则默认为与支付宝签约的商户的PID,也就是appid对应的PID
 		String sellerId = "";
@@ -56,7 +60,6 @@ public class AliPayServiceImpl implements IAliPayService {
 		String body = product.getBody();
 		// 支付超时,定义为120分钟
 		String timeoutExpress = "120m";
-		String notifyUrl  =product.getFrontUrl();
 		// 创建扫码支付请求builder,设置请求参数
 		AlipayTradePrecreateRequestBuilder builder = new AlipayTradePrecreateRequestBuilder()
 		.setSubject(subject)
@@ -67,7 +70,7 @@ public class AliPayServiceImpl implements IAliPayService {
 		.setStoreId(storeId)
 		.setExtendParams(extendParams)
 		.setTimeoutExpress(timeoutExpress)
-        .setNotifyUrl(notifyUrl);//支付宝服务器主动通知商户服务器里指定的页面http路径,根据需要设置
+        .setNotifyUrl(notify_url);//支付宝服务器主动通知商户服务器里指定的页面http路径,根据需要设置
 		
 		AlipayF2FPrecreateResult result = AliPayConfig.getAlipayTradeService().tradePrecreate(builder);
 		switch (result.getTradeStatus()) {

+ 16 - 31
src/main/java/com/itstyle/modules/weixinpay/controller/WeixinMobilePayController.java

@@ -10,13 +10,16 @@ import javax.servlet.http.HttpServletResponse;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 
+import com.itstyle.common.model.Product;
 import com.itstyle.common.utils.AddressUtils;
 import com.itstyle.common.utils.DateUtil;
+import com.itstyle.modules.weixinpay.service.IWeixinPayService;
 import com.itstyle.modules.weixinpay.util.ConfigUtil;
 import com.itstyle.modules.weixinpay.util.HttpUtil;
 import com.itstyle.modules.weixinpay.util.PayCommonUtil;
@@ -32,7 +35,17 @@ import com.itstyle.modules.weixinpay.util.mobile.MobileUtil;
 @RequestMapping(value = "weixinMobile")
 public class WeixinMobilePayController {
 	private static final Logger logger = LoggerFactory.getLogger(WeixinMobilePayController.class);
+	@Autowired
+	private IWeixinPayService weixinPayService;
+	@Value("${server.context.url}")
+	private String server_url;
 	
+	@RequestMapping("/pay")
+    public String  pay(Product product,ModelMap map) {
+		logger.info("H5支付(需要公众号内支付)");
+		String url =  weixinPayService.weixinPayMobile(product);
+		return "redirect:"+url;
+    }
 	/**
 	 * 预下单(对于已经产生的订单)
 	 * @Author  科帮网
@@ -56,8 +69,7 @@ public class WeixinMobilePayController {
 		String code = request.getParameter("code");
 		//获取用户openID(JSAPI支付必须传openid)
 		String openId = MobileUtil.getOpenId(code);
-		String pay_url = "http://blog.52itstyle.com";
-		String notify_url =pay_url+"/weixinMobile/WXPayBack";//回调接口
+		String notify_url =server_url+"/weixinMobile/WXPayBack";//回调接口
 		String trade_type = "JSAPI";// 交易类型H5支付
 		SortedMap<Object, Object> packageParams = new TreeMap<Object, Object>();
 		ConfigUtil.commonParams(packageParams);
@@ -110,33 +122,6 @@ public class WeixinMobilePayController {
 		return url.toString();
 	}
 	/**
-	 * 支付请求
-	 * @Author  科帮网
-	 * @param request
-	 * @param response
-	 * @param orderNo
-	 * @param totalFee
-	 * @return
-	 * @throws Exception  String
-	 * @Date	2017年7月31日
-	 * 更新日志
-	 * 2017年7月31日  科帮网 首次创建
-	 *
-	 */
-	@RequestMapping(value = "pay/{orderNo}/{totalFee}", method=RequestMethod.GET)
-	public String pay(HttpServletRequest request, HttpServletResponse response,
-			          @PathVariable String orderNo,@PathVariable String totalFee) throws Exception {
-		StringBuffer url = new StringBuffer();
-		String pay_url = "http://blog.52itstyle.com";
-		url.append("http://open.weixin.qq.com/connect/oauth2/authorize?");
-		url.append("appid="+ConfigUtil.APP_ID);
-		url.append("&redirect_uri="+pay_url+"/weixinMobile/dopay");
-		url.append("&response_type=code&scope=snsapi_base&state=");
-		url.append(orderNo+"/"+totalFee);//订单号/金额(单位是分)
-		url.append("#wechat_redirect");
-		return "redirect:"+url.toString();
-	}
-	/**
 	 * 手机支付完成回调
 	 * @Author  科帮网
 	 * @param request

+ 23 - 1
src/main/java/com/itstyle/modules/weixinpay/controller/WeixinPayController.java

@@ -14,9 +14,14 @@ import javax.servlet.http.HttpServletResponse;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.RequestMapping;
 
+import com.itstyle.common.constants.Constants;
+import com.itstyle.common.model.Product;
+import com.itstyle.modules.weixinpay.service.IWeixinPayService;
 import com.itstyle.modules.weixinpay.util.ConfigUtil;
 import com.itstyle.modules.weixinpay.util.PayCommonUtil;
 import com.itstyle.modules.weixinpay.util.XMLUtil;
@@ -30,12 +35,29 @@ import com.itstyle.modules.weixinpay.util.XMLUtil;
 @RequestMapping(value = "weixin")
 public class WeixinPayController {
 	private static final Logger logger = LoggerFactory.getLogger(WeixinPayController.class);
+	@Autowired
+	private IWeixinPayService weixinPayService;
 	
 	@RequestMapping("/index")
     public String   index() {
         return "weixinpay/index";
     }
-	
+	@RequestMapping("/qcPay")
+    public String  qcPay(Product product,ModelMap map) {
+		logger.info("二维码支付");
+		//参数自定义  这只是个Demo
+		product.setProductId("20170721");
+		product.setBody("两个苹果八毛钱 ");
+		product.setSpbillCreateIp("192.168.1.66");
+		String message  =  weixinPayService.weixinPay(product);
+		if(Constants.SUCCESS.equals(message)){
+			String img= "../qrcode/"+product.getOutTradeNo()+".png";
+			map.addAttribute("img", img);
+		}else{
+			//失败
+		}
+		return "weixinpay/qcpay";
+    }
 	/**
 	 * 支付后台回调
 	 * @Author  科帮网

+ 34 - 30
src/main/java/com/itstyle/modules/weixinpay/service/impl/WeixinPayServiceImpl.java

@@ -3,13 +3,18 @@ package com.itstyle.modules.weixinpay.service.impl;
 import java.util.Map;
 import java.util.SortedMap;
 import java.util.TreeMap;
+
 import net.sf.json.JSONObject;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+
 import com.alipay.demo.trade.utils.ZxingUtils;
 import com.itstyle.common.constants.Constants;
 import com.itstyle.common.model.Product;
+import com.itstyle.common.utils.CommonUtil;
 import com.itstyle.modules.weixinpay.service.IWeixinPayService;
 import com.itstyle.modules.weixinpay.util.ClientCustomSSL;
 import com.itstyle.modules.weixinpay.util.ConfigUtil;
@@ -19,32 +24,34 @@ import com.itstyle.modules.weixinpay.util.XMLUtil;
 @Service("weixinPayService")
 public class WeixinPayServiceImpl implements IWeixinPayService {
 	private static final Logger logger = LoggerFactory.getLogger(WeixinPayServiceImpl.class);
+	
+	@Value("${wexinpay.notify.url}")
+	private String notify_url;
+	@Value("${server.context.url}")
+	private String server_url;
+	
 	@SuppressWarnings("rawtypes")
 	@Override
 	public String weixinPay(Product product) {
-		logger.info(product.getAttach()+"(订单号:"+product.getOutTradeNo()+"生成微信支付码)");
+		logger.info("订单号:{}生成微信支付码",product.getOutTradeNo());
 		String  message = Constants.SUCCESS;
 		try {
-			String imgPath= "D:\\"+product.getOutTradeNo()+".png";
+			String imgPath= Constants.QRCODE_PATH+Constants.SF_FILE_SEPARATOR+product.getOutTradeNo()+".png";
 			// 账号信息
 			String key = ConfigUtil.API_KEY; // key
-			// 回调接口
-			String notify_url = Constants.PAY_URL.get("weixin_pc_notify_url");
 			String trade_type = "NATIVE";// 交易类型 原生扫码支付
-
 			SortedMap<Object, Object> packageParams = new TreeMap<Object, Object>();
 			ConfigUtil.commonParams(packageParams);
 			packageParams.put("product_id", product.getProductId());// 商品ID
 			packageParams.put("body", product.getBody());// 商品描述
 			packageParams.put("out_trade_no", product.getOutTradeNo());// 商户订单号
 			String totalFee = product.getTotalFee();
-			if(totalFee.indexOf(".")>0){//去除小数点 invalide total_fee  报错
-				totalFee = totalFee.substring(0, totalFee.indexOf("."));
-			}
+			totalFee =  CommonUtil.subZeroAndDot(totalFee);
 			packageParams.put("total_fee", totalFee);// 总金额
 			packageParams.put("spbill_create_ip", product.getSpbillCreateIp());// 发起人IP地址
 			packageParams.put("notify_url", notify_url);// 回调地址
 			packageParams.put("trade_type", trade_type);// 交易类型
+			System.out.println(packageParams);
 			String sign = PayCommonUtil.createSign("UTF-8", packageParams, key);
 			packageParams.put("sign", sign);// 签名
 
@@ -55,22 +62,22 @@ public class WeixinPayServiceImpl implements IWeixinPayService {
 			if("SUCCESS".equals(returnCode)){
 				String resultCode = (String) map.get("result_code");
 				if("SUCCESS".equals(resultCode)){
-					logger.info(product.getAttach()+"(订单号:"+product.getOutTradeNo()+"生成微信支付码成功)");
+					logger.info("订单号:{}生成微信支付码成功",product.getOutTradeNo());
 					String urlCode = (String) map.get("code_url");
 					ConfigUtil.shorturl(urlCode);//转换为短链接
 					ZxingUtils.getQRCodeImge(urlCode, 256, imgPath);// 生成二维码
 				}else{
 					String errCodeDes = (String) map.get("err_code_des");
-					logger.info(product.getAttach()+"(订单号:"+product.getOutTradeNo()+"生成微信支付码(系统)失败["+errCodeDes+"])");
+					logger.info("订单号:{}生成微信支付码(系统)失败:{}",product.getOutTradeNo(),errCodeDes);
 					message = Constants.FAIL;
 				}
 			}else{
 				String returnMsg = (String) map.get("return_msg");
-				logger.info(product.getAttach()+"(订单号:"+product.getOutTradeNo()+"生成微信支付码(通信)失败["+returnMsg+"])");
+				logger.info("(订单号:{}生成微信支付码(通信)失败:{}",product.getOutTradeNo(),returnMsg);
 				message = Constants.FAIL;
 			}
 		} catch (Exception e) {
-			logger.error(product.getAttach()+"(订单号:"+product.getOutTradeNo()+"生成微信支付码失败(系统异常))", e);
+			logger.error("订单号:{}生成微信支付码失败(系统异常))",product.getOutTradeNo(),e);
 			message = Constants.FAIL;
 		}
 		return message;
@@ -78,7 +85,7 @@ public class WeixinPayServiceImpl implements IWeixinPayService {
 	@SuppressWarnings("rawtypes")
 	@Override
 	public String weixinRefund(Product product) {
-		logger.info("订单号:"+product.getOutTradeNo()+"微信退款");
+		logger.info("订单号:{}微信退款",product.getOutTradeNo());
 		String  message = Constants.SUCCESS;
 		try {
 			// 账号信息
@@ -105,19 +112,19 @@ public class WeixinPayServiceImpl implements IWeixinPayService {
 			if("SUCCESS".equals(returnCode)){
 				String resultCode = (String) map.get("result_code");
 				if("SUCCESS".equals(resultCode)){
-					logger.info("订单号:"+product.getOutTradeNo()+"微信退款成功并删除二维码");
+					logger.info("订单号:{}微信退款成功并删除二维码",product.getOutTradeNo());
 				}else{
 					String errCodeDes  = (String) map.get("err_code_des");
-					logger.info("订单号:"+product.getOutTradeNo()+"微信退款失败("+errCodeDes+")");
+					logger.info("订单号:{}微信退款失败:{}",product.getOutTradeNo(),errCodeDes);
 					message = Constants.FAIL;
 				}
 			}else{
 				String returnMsg = (String) map.get("return_msg");
-				logger.info("订单号:"+product.getOutTradeNo()+"微信退款失败("+returnMsg+")");
+				logger.info("订单号:{}微信退款失败:{}",product.getOutTradeNo(),returnMsg);
 				message = Constants.FAIL;
 			}
 		} catch (Exception e) {
-			logger.error("订单号:"+product.getOutTradeNo()+"微信支付失败(系统异常)", e);
+			logger.error("订单号:{}微信支付失败(系统异常)",product.getOutTradeNo(), e);
 			message = Constants.FAIL;
 		}
 		return message;
@@ -126,7 +133,7 @@ public class WeixinPayServiceImpl implements IWeixinPayService {
 	@SuppressWarnings("rawtypes")
 	@Override
 	public String weixinCloseorder(Product product) {
-		logger.info("订单号:"+product.getOutTradeNo()+"微信关闭订单");
+		logger.info("订单号:{}微信关闭订单",product.getOutTradeNo());
 		String  message = Constants.SUCCESS;
 		try {
 			String key = ConfigUtil.API_KEY; // key
@@ -142,24 +149,24 @@ public class WeixinPayServiceImpl implements IWeixinPayService {
 			if("SUCCESS".equals(returnCode)){
 				String resultCode =  (String) map.get("result_code");
 				if("SUCCESS".equals(resultCode)){
-					logger.info("订单号:"+product.getOutTradeNo()+"微信关闭订单成功");
+					logger.info("订单号:{}微信关闭订单成功",product.getOutTradeNo());
 				}else{
 					String errCode =  (String) map.get("err_code");
 					String errCodeDes =  (String) map.get("err_code_des");
 					if("ORDERNOTEXIST".equals(errCode)||"ORDERCLOSED".equals(errCode)){//订单不存在或者已经关闭
-						logger.info("订单号:"+product.getOutTradeNo()+"微信关闭订单("+errCodeDes+")");
+						logger.info("订单号:{}微信关闭订单:{}",product.getOutTradeNo(),errCodeDes);
 					}else{
-						logger.info("订单号:"+product.getOutTradeNo()+"微信关闭订单失败("+errCodeDes+")");
+						logger.info("订单号:{}微信关闭订单失败:{}",product.getOutTradeNo(),errCodeDes);
 						message = Constants.FAIL;
 					}
 				}
 			}else{
 				String returnMsg = (String) map.get("return_msg");
-				logger.info("订单号:"+product.getOutTradeNo()+"微信关闭订单失败"+returnMsg);
+				logger.info("订单号:{}微信关闭订单失败:{}",product.getOutTradeNo(),returnMsg);
 				message = Constants.FAIL;
 			}
 		} catch (Exception e) {
-			logger.error("订单号:"+product.getOutTradeNo()+"微信关闭订单失败(系统异常)", e);
+			logger.error("订单号:{}微信关闭订单失败(系统异常)", product.getOutTradeNo(),e);
 			message = Constants.FAIL;
 		}
 		return message;
@@ -192,12 +199,11 @@ public class WeixinPayServiceImpl implements IWeixinPayService {
             if(resXml.startsWith("<xml>")){
             	Map map = XMLUtil.doXMLParse(resXml);
     			String returnMsg = (String) map.get("return_msg");
-    			logger.info("微信查询订单失败("+returnMsg+")");
+    			logger.info("微信查询订单失败:{}",returnMsg);
 			}else{
 				 //入库
 			}
 		} catch (Exception e) {
-			e.printStackTrace();
 			logger.error("微信查询订单异常", e);
 		}
 		
@@ -210,13 +216,11 @@ public class WeixinPayServiceImpl implements IWeixinPayService {
 	public String weixinPayMobile(Product product) {
 		StringBuffer url = new StringBuffer();
 		String totalFee = product.getTotalFee();
-		if(totalFee.indexOf(".")>0){//去除小数点 invalide total_fee  报错
-			totalFee = totalFee.substring(0, totalFee.indexOf("."));
-		}
-		String pay_url = Constants.PAY_URL.get("pay_url");
+		//redirect_uri 需要在微信支付端添加认证网址
+		totalFee =  CommonUtil.subZeroAndDot(totalFee);
 		url.append("http://open.weixin.qq.com/connect/oauth2/authorize?");
 		url.append("appid="+ConfigUtil.APP_ID);
-		url.append("&redirect_uri="+pay_url+"/weixinMobile/dopay");
+		url.append("&redirect_uri="+server_url+"weixinMobile/dopay");
 		url.append("&response_type=code&scope=snsapi_base&state=");
 		url.append(product.getOutTradeNo()+"/"+totalFee);//订单号/金额(单位是分)
 		url.append("#wechat_redirect");

+ 8 - 1
src/main/resources/application-dev.properties

@@ -26,6 +26,13 @@ spring.thymeleaf.template.cache=false
 # \u9759\u6001\u6587\u4ef6\u8bf7\u6c42\u5339\u914d\u65b9\u5f0f
 spring.mvc.static-path-pattern=/**
 # \u4fee\u6539\u9ed8\u8ba4\u7684\u9759\u6001\u5bfb\u5740\u8d44\u6e90\u76ee\u5f55
-spring.resources.static-locations = classpath:/templates/,classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/
+spring.resources.static-locations = classpath:/templates/,classpath:/resources/,classpath:/static/
+
+#\u9879\u76ee\u5730\u5740
+server.context.url = http://192.168.1.66:8080/springboot_pay/
+#\u652f\u4ed8\u5b9d\u540e\u53f0\u56de\u8c03
+alipay.notify.url=https://blog.52itstyle.com/alipay/pay
+#\u5fae\u4fe1\u540e\u53f0\u56de\u8c03
+wexinpay.notify.url=https://blog.52itstyle.com/weixin/pay
 
 

+ 1 - 0
src/main/resources/static/qrcode/readme.txt

@@ -0,0 +1 @@
+支付宝 微信  二维码图片

+ 8 - 5
src/main/resources/templates/alipay/index.html

@@ -170,28 +170,28 @@
 				</dl>
 			</div>
 		</form>
-		<form name=alipayqc  method=post
+		<form name=alipayqc  action=qcPay method=post
 			target="_blank">
 			<div id="body6"  class="tab-content" name="divcontent">
 				<dl class="content">
 					<dt>商户订单号 :</dt>
 					<dd>
-						<input id="WIDout_trade_no" name="outTradeNo" />
+						<input id="WIDout_trade_no_qc" name="outTradeNo" />
 					</dd>
 					<hr class="one_line">
 					<dt>订单名称 :</dt>
 					<dd>
-						<input id="WIDsubject" name="subject" />
+						<input id="WIDsubject_qc" name="subject" />
 					</dd>
 					<hr class="one_line">
 					<dt>付款金额 :</dt>
 					<dd>
-						<input id="WIDtotal_amount" name="totalFee" />
+						<input id="WIDtotal_amount_qc" name="totalFee" />
 					</dd>
 					<hr class="one_line">
 					<dt>商品描述:</dt>
 					<dd>
-						<input id="WIDbody" name="body" />
+						<input id="WIDbody_qc" name="body" />
 					</dd>
 					<hr class="one_line">
 					<dt></dt>
@@ -246,6 +246,9 @@
 		document.getElementById("WIDout_trade_no").value =  sNow;
 		document.getElementById("WIDsubject").value = "科帮网测试支付";
 		document.getElementById("WIDtotal_amount").value = "100";
+		document.getElementById("WIDout_trade_no_qc").value =  sNow;
+		document.getElementById("WIDsubject_qc").value = "科帮网测试支付";
+		document.getElementById("WIDtotal_amount_qc").value = "100";
 	}
 	GetDateNow();
 </script>

+ 11 - 0
src/main/resources/templates/alipay/qcpay.html

@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<!-- 哈哈哈 我是个天才 -->
+<html xmlns:th="http://www.thymeleaf.org">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
+<title>支付宝二维码支付</title>
+</head>
+<body>
+	<img alt="支付二维码" th:src="${img}" >
+</body>
+</html>

+ 10 - 7
src/main/resources/templates/weixinpay/index.html

@@ -12,14 +12,14 @@
 	</header>
 	<div id="main">
 		<div id="tabhead" class="tab-head">
-			<h2 id="tab1" class="selected" name="tab">付</h2>
+			<h2 id="tab1" class="selected" name="tab">公众号内支付</h2>
 			<h2 id="tab2" name="tab">交 易 查 询</h2>
 			<h2 id="tab3" name="tab">退 款</h2>
 			<h2 id="tab4" name="tab">退 款 查 询</h2>
 			<h2 id="tab5" name="tab">交 易 关 闭</h2>
 			<h2 id="tab6" name="tab">扫码支付</h2>
 		</div>
-		<form name=alipayment action=pcPay method=post
+		<form name=alipayment action=../weixinMobile/pay method=post
 			target="_blank">
 			<div id="body1" class="show" name="divcontent">
 				<dl class="content">
@@ -170,28 +170,28 @@
 				</dl>
 			</div>
 		</form>
-		<form name=alipayqc  method=post
+		<form name=alipayqc action=qcPay method=post
 			target="_blank">
 			<div id="body6"  class="tab-content" name="divcontent">
 				<dl class="content">
 					<dt>商户订单号 :</dt>
 					<dd>
-						<input id="WIDout_trade_no" name="outTradeNo" />
+						<input id="WIDout_trade_no_qc" name="outTradeNo" />
 					</dd>
 					<hr class="one_line">
 					<dt>订单名称 :</dt>
 					<dd>
-						<input id="WIDsubject" name="subject" />
+						<input id="WIDsubject_qc" name="subject" />
 					</dd>
 					<hr class="one_line">
 					<dt>付款金额 :</dt>
 					<dd>
-						<input id="WIDtotal_amount" name="totalFee" />
+						<input id="WIDtotal_amount_qc" name="totalFee" />
 					</dd>
 					<hr class="one_line">
 					<dt>商品描述:</dt>
 					<dd>
-						<input id="WIDbody" name="body" />
+						<input id="WIDbody_qc" name="body" />
 					</dd>
 					<hr class="one_line">
 					<dt></dt>
@@ -246,6 +246,9 @@
 		document.getElementById("WIDout_trade_no").value =  sNow;
 		document.getElementById("WIDsubject").value = "科帮网测试支付";
 		document.getElementById("WIDtotal_amount").value = "100";
+		document.getElementById("WIDout_trade_no_qc").value =  sNow;
+		document.getElementById("WIDsubject_qc").value = "科帮网测试支付";
+		document.getElementById("WIDtotal_amount_qc").value = "100";
 	}
 	GetDateNow();
 </script>

+ 11 - 0
src/main/resources/templates/weixinpay/qcpay.html

@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<!-- 哈哈哈 我是个天才 -->
+<html xmlns:th="http://www.thymeleaf.org">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
+<title>微信二维码支付</title>
+</head>
+<body>
+	<img alt="支付二维码" th:src="${img}" >
+</body>
+</html>