using QRCoder;
// 版本 1.4.1
/// <summary> /// 获取二维码地址 /// </summary> /// <param name="url"></param> /// <param name="pixelsPerModule"></param> /// <returns></returns> public async Task<string> GetQRCode(string url, int pixelsPerModule) { string QRCodePath = string.Empty; QRCodeGenerator qrGenerator = new QRCodeGenerator(); QRCodeData qrCodeData = qrGenerator.CreateQrCode(url, QRCodeGenerator.ECCLevel.Q); BitmapByteQRCode qrCode = new BitmapByteQRCode(qrCodeData); var qrCodeBytes = qrCode.GetGraphic(pixelsPerModule); using (MemoryStream ms = new MemoryStream(qrCodeBytes)) { var r = await BlobFileStorageProvider.SaveAsync(ms, $"payqcode/{DateTime.Now.ToString("yyyyMMddHHmmssfff")}.jpg"); QRCodePath = BlobFileStorageProvider.GetUploadPath(r); } return QRCodePath; }