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) {