development
温天培 1 year ago
parent 1f77bcfaee
commit 51ff5ce4f1

@ -510,28 +510,24 @@ namespace GDZZ.Application.Service.Auth
value = token.Result.AccessToken; value = token.Result.AccessToken;
} }
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); var filePath = Path.Combine(App.WebHostEnvironment.WebRootPath, _options.QRCode.path);
if (!Directory.Exists(filePath)) if (!Directory.Exists(filePath))
Directory.CreateDirectory(filePath); Directory.CreateDirectory(filePath);
var Imageurl = filePath + fileName;
Console.WriteLine(Imageurl);
try try
{ {
MemoryStream ms = new MemoryStream(res); MemoryStream ms = new MemoryStream(res);
FileStream fs = new FileStream(Imageurl, 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, Imageurl); await this.cacheService.SetQRCodeAsync(UserManager.UserId, filePath + fileName);
} }
catch (Exception e) catch (Exception e)
{ {
throw Oops.Oh(e.Message); throw Oops.Oh(e.Message);
} }
return Imageurl; return fileName;
} }

Loading…
Cancel
Save