😎修改微信小程序生成保存路径,若不配置则默认保存在项目根目录

This commit is contained in:
zuohuaijun 2025-03-24 00:28:11 +08:00
parent 512d05099b
commit 5fae7dfe0c
2 changed files with 2 additions and 1 deletions

View File

@ -12,7 +12,7 @@
"WxOpenAppSecret": "",
"WxToken": "", // (Token)
"WxEncodingAESKey": "", // (EncodingAESKey)
"QRImagePath": "" // eg: D:\\Web\\wwwroot\\upload\\QRImage
"QRImagePath": "" // eg: D:\\Web\\wwwroot\\upload\\QRImage, wwwroot\\upload\\QRImage
},
//
"WechatPay": {

View File

@ -297,6 +297,7 @@ public class SysWxOpenService : IDynamicApiController, ITransient
if (response.IsSuccessful())
{
var QRImagePath = App.GetConfig<string>("Wechat:QRImagePath");
QRImagePath = string.IsNullOrEmpty(QRImagePath) ? Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "QRImage") : QRImagePath;
// 判断文件存放路径是否存在
if (!Directory.Exists(QRImagePath))
Directory.CreateDirectory(QRImagePath);