using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; using Common.Http; using Common.Model; using JCSoft.WX.Framework.Api; using LigerRM.Common; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Primitives; using ZcPeng.PublicLibrary; namespace SupplierWeb.Controllers { [Route("api/home")] [ApiController] public class HomeController : BaseController { public HomeController(IMemoryCache cache, IApiClient client) : base(cache, client) { } [HttpGet] public JsonResult Index() { var sql = $" select count(case when u.state=1 then 1 end) fill, count(case when u.state=0 then 1 end) unfill, count(case when u.state=2 then 1 end) lessthan, count(case when u.state = 3 then 1 end) genpro, count(case when u.state = 4 then 1 end) genord from sup_pushfeedback u "; var dt = new DataTable(); var param = new List(); DataAccess.GetValues(sql, ref dt, param.ToArray(), out _); IList result = new List(); if (dt != null && dt.Rows.Count > 0) { result = ModelConvertHelper.ConvertToModel(dt); } //string staffId = ""; //HttpRequest request = MyHttpContext.Current.Request; //StringValues oo; //request.Headers.TryGetValue("Sso-Token", out oo); //if (oo.Count > 0 && oo.ToArray()[0] != "") //{ // staffId = oo.ToArray()[0]; //} Object token = ""; //MyHttpContext.Cache.TryGetValue(staffId, out token); // token = CookieHelper.GetCookie("token"); return new JsonResult(new { data = result, test = token }); } public class Temp { public int fill { get; set; } public int unfill { get; set; } public int lessthan { get; set; } public int genpro { get; set; } public int genord { get; set; } } } }