QRcodeController.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using Business.Core.Utilities;
  2. using Microsoft.AspNetCore.Mvc;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using Volo.Abp.AspNetCore.Mvc;
  9. using Volo.Abp;
  10. namespace Business.Controllers
  11. {
  12. /// <summary>
  13. /// 二维码生成接口
  14. /// </summary>
  15. [RemoteService]
  16. [Area("Business")]
  17. [Route("api/business/code")]
  18. public class QRcodeController : AbpController
  19. {
  20. /// <summary>
  21. /// 生成二维码
  22. /// </summary>
  23. /// <param name="filePath">文件路径</param>
  24. /// <param name="context">二维码内容</param>
  25. /// <param name="x">x轴偏移量</param>
  26. /// <param name="y">y轴偏移量</param>
  27. [HttpGet]
  28. [Route("qrcode")]
  29. public void GenerateQrCode(string filePath, string context, int x, int y)
  30. {
  31. //二维码帮助类
  32. QRcodeHelper qRcode = new QRcodeHelper();
  33. //生成二维码
  34. qRcode.GenerateQrCode(filePath, context, x, y);
  35. }
  36. /// <summary>
  37. /// 生成条形码
  38. /// </summary>
  39. /// <param name="filePath">文件路径</param>
  40. /// <param name="context">挑衅码内容</param>
  41. /// <param name="x">x轴偏移量</param>
  42. /// <param name="y">y轴偏移量</param>
  43. [HttpGet]
  44. [Route("barcode")]
  45. public void GenerateBarcode(string filePath, string context, int x, int y)
  46. {
  47. QRcodeHelper qRcode = new QRcodeHelper();
  48. qRcode.GenerateBarcode(filePath, context, x, y);
  49. }
  50. }
  51. }