From 517291387ba412a406a5152e2dbf96c98c39460c Mon Sep 17 00:00:00 2001 From: wtp <1813748440@qq.com> Date: Wed, 29 Nov 2023 11:40:33 +0800 Subject: [PATCH] 1 --- GDZZ.Application/Service/Auth/AuthService.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/GDZZ.Application/Service/Auth/AuthService.cs b/GDZZ.Application/Service/Auth/AuthService.cs index 2f6c1f0..80a660b 100644 --- a/GDZZ.Application/Service/Auth/AuthService.cs +++ b/GDZZ.Application/Service/Auth/AuthService.cs @@ -511,17 +511,18 @@ namespace GDZZ.Application.Service.Auth } var res = await this._wechatOAuth.GetShareCodeAsync(value,scene, page); var fileName = Path.Combine("/" + UserManager.UserId + ".png"); - var filePath = Path.Combine(App.WebHostEnvironment.WebRootPath, _options.QRCode.path); - if (!Directory.Exists(filePath)) - Directory.CreateDirectory(filePath); + try { + var filePath = Path.Combine(App.WebHostEnvironment.WebRootPath, _options.QRCode.path); + if (!Directory.Exists(filePath)) + Directory.CreateDirectory(filePath); MemoryStream ms = new MemoryStream(res); FileStream fs = new FileStream(filePath + fileName, FileMode.OpenOrCreate); ms.WriteTo(fs); ms.Close(); fs.Close(); - await this.cacheService.SetQRCodeAsync(UserManager.UserId, filePath + fileName); + await this.cacheService.SetQRCodeAsync(UserManager.UserId,fileName); } catch (Exception e) {