development
温天培 1 year ago
parent 51ff5ce4f1
commit 517291387b

@ -511,17 +511,18 @@ namespace GDZZ.Application.Service.Auth
} }
var res = await this._wechatOAuth.GetShareCodeAsync(value,scene, page); var res = await this._wechatOAuth.GetShareCodeAsync(value,scene, page);
var fileName = Path.Combine("/" + UserManager.UserId + ".png"); 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 try
{ {
var filePath = Path.Combine(App.WebHostEnvironment.WebRootPath, _options.QRCode.path);
if (!Directory.Exists(filePath))
Directory.CreateDirectory(filePath);
MemoryStream ms = new MemoryStream(res); MemoryStream ms = new MemoryStream(res);
FileStream fs = new FileStream(filePath + fileName, FileMode.OpenOrCreate); FileStream fs = new FileStream(filePath + fileName, FileMode.OpenOrCreate);
ms.WriteTo(fs); ms.WriteTo(fs);
ms.Close(); ms.Close();
fs.Close(); fs.Close();
await this.cacheService.SetQRCodeAsync(UserManager.UserId, filePath + fileName); await this.cacheService.SetQRCodeAsync(UserManager.UserId,fileName);
} }
catch (Exception e) catch (Exception e)
{ {

Loading…
Cancel
Save