12345678910111213141516171819202122232425262728293031323334353637383940 |
- using Cksoft.Data;
- using Cksoft.Data.Repository;
- using DllEapDal;
- using DllEapEntity.Dtos;
- using Microsoft.AspNetCore.Mvc;
- using System;
- using System.Threading.Tasks;
- namespace WebLogViewer.Controller
- {
- [ApiController]
- [Route("api/machinelog/[action]")]
- public class MachineLogController : ControllerBase
- {
- public async Task<LayuiModel<MachineLog>> Get(string macCode,
- DateTime? startTime, DateTime? endTime, int pageIndex = 1, int pageSize = 10, string sortField = "a.FCode", string sortOrder = "ascend")
- {
- if (string.IsNullOrEmpty(macCode))
- return LayuiModel<MachineLog>.CreateEmptyList("机台号是必须的");
- if (startTime == null || endTime == null)
- return LayuiModel<MachineLog>.CreateEmptyList("开始时间和结束时间是必须的");
- using (IDatabase db = DbFactory.Base("eapslave"))
- {
- db.BeginTrans();
- var dal = new MachineLogDal(db);
- var total = 0;
- string errorinfo = string.Empty;
- var roles = dal.GetPaged(macCode, startTime, endTime, ref errorinfo, out total,
- pageIndex, pageSize);
- return await Task.FromResult(new LayuiModel<MachineLog>
- {
- code = 1,
- count = total,
- data = roles,
- msg = ""
- });
- }
- }
- }
- }
|