From 51ff5ce4f1456fdd8919e4c0cba6550bd11bca3b Mon Sep 17 00:00:00 2001 From: wtp <1813748440@qq.com> Date: Wed, 29 Nov 2023 11:25:33 +0800 Subject: [PATCH] 1 --- GDZZ.Application/Service/Auth/AuthService.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/GDZZ.Application/Service/Auth/AuthService.cs b/GDZZ.Application/Service/Auth/AuthService.cs index 7126a01..2f6c1f0 100644 --- a/GDZZ.Application/Service/Auth/AuthService.cs +++ b/GDZZ.Application/Service/Auth/AuthService.cs @@ -510,28 +510,24 @@ namespace GDZZ.Application.Service.Auth value = token.Result.AccessToken; } 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); - var Imageurl = filePath + fileName; - Console.WriteLine(Imageurl); try { MemoryStream ms = new MemoryStream(res); - FileStream fs = new FileStream(Imageurl, FileMode.OpenOrCreate); + FileStream fs = new FileStream(filePath + fileName, FileMode.OpenOrCreate); ms.WriteTo(fs); ms.Close(); fs.Close(); - await this.cacheService.SetQRCodeAsync(UserManager.UserId, Imageurl); + await this.cacheService.SetQRCodeAsync(UserManager.UserId, filePath + fileName); } catch (Exception e) { throw Oops.Oh(e.Message); } - return Imageurl; + return fileName; }