@@ -382,37 +382,44 @@ public WxEntPayQueryResult queryEntPay(String partnerTradeNo) throws WxErrorExce
382382
383383 @ Override
384384 public byte [] createScanPayQrcodeMode1 (String productId , File logoFile , Integer sideLength ) {
385- //weixin://wxpay/bizpayurl?sign=XXXXX&appid=XXXXX&mch_id=XXXXX&product_id=XXXXXX&time_stamp=XXXXXX&nonce_str=XXXXX
385+ String content = createScanPayQrcodeMode1 (productId );
386+ return createQrcode (content , logoFile , sideLength );
387+ }
388+
389+ @ Override
390+ public String createScanPayQrcodeMode1 (String productId ){
391+ //weixin://wxpay/bizpayurl?sign=XXXXX&appid=XXXXX&mch_id=XXXXX&product_id=XXXXXX&time_stamp=XXXXXX&nonce_str=XXXXX
386392 StringBuilder codeUrl = new StringBuilder ("weixin://wxpay/bizpayurl?" );
387393 Map <String , String > params = Maps .newHashMap ();
388394 params .put ("appid" , this .getConfig ().getAppId ());
389395 params .put ("mch_id" , this .getConfig ().getMchId ());
390396 params .put ("product_id" , productId );
391- params .put ("time_stamp" , String .valueOf (System .currentTimeMillis ()));
397+ params .put ("time_stamp" , String .valueOf (System .currentTimeMillis () / 1000 ));//这里需要秒,10位数字
392398 params .put ("nonce_str" , String .valueOf (System .currentTimeMillis ()));
393399
394400 String sign = this .createSign (params );
395401 params .put ("sign" , sign );
396402
403+
397404 for (String key : params .keySet ()) {
398405 codeUrl .append (key + "=" + params .get (key ) + "&" );
399406 }
400407
401408 String content = codeUrl .toString ().substring (0 , codeUrl .length () - 1 );
402- if (sideLength == null || sideLength < 1 ) {
403- return QrcodeUtils .createQrcode (content , logoFile );
404- }
405-
406- return QrcodeUtils .createQrcode (content , sideLength , logoFile );
409+ log .debug ("扫码支付模式一生成二维码的URL:{}" ,content );
410+ return content ;
407411 }
408412
409413 @ Override
410414 public byte [] createScanPayQrcodeMode2 (String codeUrl , File logoFile , Integer sideLength ) {
411- if (sideLength == null || sideLength < 1 ) {
412- return QrcodeUtils .createQrcode (codeUrl , logoFile );
415+ return createQrcode (codeUrl , logoFile , sideLength );
416+ }
417+
418+ private byte [] createQrcode (String content , File logoFile , Integer sideLength ) {
419+ if (sideLength == null || sideLength < 1 ) {
420+ return QrcodeUtils .createQrcode (content , logoFile );
413421 }
414-
415- return QrcodeUtils .createQrcode (codeUrl , sideLength , logoFile );
422+ return QrcodeUtils .createQrcode (content , sideLength , logoFile );
416423 }
417424
418425 public void report (WxPayReportRequest request ) throws WxErrorException {
0 commit comments