12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- 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<SqlParameter>();
- DataAccess.GetValues(sql, ref dt, param.ToArray(), out _);
- IList<Temp> result = new List<Temp>();
- if (dt != null && dt.Rows.Count > 0)
- {
- result = ModelConvertHelper<Temp>.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; }
- }
- }
- }
|