From 27fb5ec5798a4dd30ba437a9a922a2d78544e301 Mon Sep 17 00:00:00 2001 From: 935090232@qq.com <ak473600000> Date: Sun, 20 Feb 2022 22:56:20 +0800 Subject: [PATCH] 配置文件改造 --- zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java | 28 +++++++++++++++++++--------- 1 files changed, 19 insertions(+), 9 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java index 5232255..9f0c799 100644 --- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java +++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java @@ -45,6 +45,15 @@ public class WxShareProductAction { @Autowired + WxacodeUtil wxacodeUtil; + + @Value("${file_storage_path}") + private String fileStoragePath; + + @Value("${static_resource_url}") + private String staticResourceUrl; + + @Autowired WeChatApiTools weChatApiTools; @Autowired private ShopProductDao shopProductDao; @@ -155,6 +164,7 @@ } + /** * 秒杀分享图片参数 * @param loginUser @@ -167,14 +177,14 @@ ShopProduct shopProduct = shopProductDao.selectById(seckillInfo.getGoodsId().intValue()); - String qrcodeSavePath = WxacodeUtil.getWxacode(qrcodeVo.getScene(), qrcodeVo.getPath(), UUIDUtil.getRandomID() + String qrcodeSavePath = wxacodeUtil.getWxacode(qrcodeVo.getScene(), qrcodeVo.getPath(), UUIDUtil.getRandomID() ,weChatApiTools.getAppid(loginUser.getCompanyId()),weChatApiTools.getSecret(loginUser.getCompanyId())); LogUtil.debug("qrcodeSavePath={}", qrcodeSavePath); // 图片保存目录路径 - String baseSavePath = PropertiesUtil.getString(AppConstance.FILES_TORAGE_PATH); + String baseSavePath = fileStoragePath; // 图片访问URL - String baseSaveUrl = PropertiesUtil.getString(AppConstance.NGINX_URL); + String baseSaveUrl = staticResourceUrl; String productImg = shopProduct.getImgMobile(); productImg = productImg.replace(baseSaveUrl, baseSavePath); String targetImg = UUIDUtil.getRandomID() + ".png"; @@ -206,14 +216,14 @@ ShopProduct shopProduct = shopProductDao.selectById(groupBuyVO.getGoodsId().intValue()); - String qrcodeSavePath = WxacodeUtil.getWxacode(qrcodeVo.getScene(), qrcodeVo.getPath(), UUIDUtil.getRandomID() + String qrcodeSavePath =wxacodeUtil.getWxacode(qrcodeVo.getScene(), qrcodeVo.getPath(), UUIDUtil.getRandomID() ,weChatApiTools.getAppid(loginUser.getCompanyId()),weChatApiTools.getSecret(loginUser.getCompanyId())); LogUtil.debug("qrcodeSavePath={}", qrcodeSavePath); // 图片保存目录路径 - String baseSavePath = PropertiesUtil.getString(AppConstance.FILES_TORAGE_PATH); + String baseSavePath =fileStoragePath; // 图片访问URL - String baseSaveUrl = PropertiesUtil.getString(AppConstance.NGINX_URL); + String baseSaveUrl =staticResourceUrl; String productImg = shopProduct.getImgMobile(); productImg = productImg.replace(baseSaveUrl, baseSavePath); String targetImg = UUIDUtil.getRandomID() + ".png"; @@ -238,14 +248,14 @@ - String qrcodeSavePath = WxacodeUtil.getWxacode(qrcodeVo.getScene(), qrcodeVo.getPath(), UUIDUtil.getRandomID() + String qrcodeSavePath = wxacodeUtil.getWxacode(qrcodeVo.getScene(), qrcodeVo.getPath(), UUIDUtil.getRandomID() ,weChatApiTools.getAppid(loginUser.getCompanyId()),weChatApiTools.getSecret(loginUser.getCompanyId())); LogUtil.debug("qrcodeSavePath={}", qrcodeSavePath); // 图片保存目录路径 - String baseSavePath = PropertiesUtil.getString(AppConstance.FILES_TORAGE_PATH); + String baseSavePath =fileStoragePath; // 图片访问URL - String baseSaveUrl = PropertiesUtil.getString(AppConstance.NGINX_URL); + String baseSaveUrl =staticResourceUrl; String productImg = shopProduct.getImgMobile(); String productPath = baseSavePath + "wxacode" + File.separatorChar + MD5Util.strToMD5(loginUser.getOpenId()) + "poster.png"; ImageUtil.downloadPicture(productImg, productPath); -- Gitblit v1.9.1