QrCodeController.cs 1.87 KB
using Hh.Mes.POJO.Entity;
using Hh.Mes.Service;using Hh.Mes.Service.SystemAuth;
using Microsoft.AspNetCore.Hosting;using Microsoft.AspNetCore.Http;using Microsoft.AspNetCore.Http.Headers;
using Microsoft.AspNetCore.Mvc;// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace WebMvc{    [Route("api/[controller]/[action]")]    [ApiController]    public  class QrCodeController : BaseController    {        private readonly SysFileService sysFileService;        private readonly QrCodeListService qrCodeService;        public QrCodeController(IAuth authUtil, SysFileService sysfileService, QrCodeListService qrCodeListService, IHttpContextAccessor accessor):base(authUtil)        {            this.sysFileService = sysfileService;            this.qrCodeService = qrCodeListService;            this.context = accessor.HttpContext;        }

        /// <summary>        /// 读数据 http://127.0.0.1:6001/api/QrCode/ReadData        /// </summary>        /// <returns></returns>        [HttpGet]        [ActionName("ReadData")]        public string ReadData(string id)        {            return Serialize(qrCodeService.ReadData(id));        }                /// <summary>        /// 写数据 http://127.0.0.1:6001/api/QrCode/SaveData        /// </summary>        /// <returns></returns>        [HttpPost]        [ActionName("SaveData")]        public string SaveData(QrCodeList qrCodeList)        {            return Serialize(qrCodeService.SaveData(qrCodeList));        }        /// <summary>        /// 删除数据 http://127.0.0.1:6001/api/QrCode/DelData        /// </summary>        /// <returns></returns>        [HttpGet]        [ActionName("DelData")]        public string DelData(string id)        {            return Serialize(qrCodeService.DelData(id));        }    }}