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; }

 

posted on 2021-04-15 19:03  不知勿言  阅读(177)  评论(0编辑  收藏  举报