using System; using System.Collections.Generic; using System.Linq; using System.Web; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Http; using System.IO; using Library; using LitJson; namespace MySystem.Areas.Api.Controllers { [Area("Api")] [Route("Api/v1/[controller]/[action]")] public class KssController : Admin.Controllers.BaseController { public KssController(IHttpContextAccessor accessor, ILogger logger, IOptions setting) : base(accessor, logger, setting) { } #region 接收绑定记录 [HttpPost] [Route("/kss/flux/{BrandId:int}")] public Dictionary Bind(int BrandId) { StreamReader sr = new StreamReader(Request.Body); string requestMes = sr.ReadToEnd(); if (string.IsNullOrEmpty(requestMes)) { return new Dictionary(); } RedisDbconn.Instance.AddList("kss_bind_list_" + BrandId, requestMes); Dictionary obj = new Dictionary(); obj.Add("code", 200); obj.Add("message", ""); return obj; } #endregion #region 接收首刷记录 [HttpPost] [Route("/kss/first/{BrandId:int}")] public Dictionary First(int BrandId) { StreamReader sr = new StreamReader(Request.Body); string requestMes = sr.ReadToEnd(); if (string.IsNullOrEmpty(requestMes)) { return new Dictionary(); } RedisDbconn.Instance.AddList("kss_first_list_" + BrandId, requestMes); Dictionary obj = new Dictionary(); obj.Add("code", 200); obj.Add("message", ""); return obj; } #endregion #region 接收免押记录 [HttpPost] [Route("/kss/freedeposit/{BrandId:int}")] public Dictionary FreeDeposit(int BrandId) { StreamReader sr = new StreamReader(Request.Body); string requestMes = sr.ReadToEnd(); if (string.IsNullOrEmpty(requestMes)) { return new Dictionary(); } RedisDbconn.Instance.AddList("kss_free_deposit_list_" + BrandId, requestMes); Dictionary obj = new Dictionary(); obj.Add("code", 200); obj.Add("message", ""); return obj; } #endregion #region 接收返押记录 [HttpPost] [Route("/kss/returndeposit/{BrandId:int}")] public Dictionary ReturnDeposit(int BrandId) { StreamReader sr = new StreamReader(Request.Body); string requestMes = sr.ReadToEnd(); if (string.IsNullOrEmpty(requestMes)) { return new Dictionary(); } RedisDbconn.Instance.AddList("kss_return_deposit_list_" + BrandId, requestMes); Dictionary obj = new Dictionary(); obj.Add("code", 200); obj.Add("message", ""); return obj; } #endregion #region 接收商户在网达标记录 [HttpPost] [Route("/kss/stagerwd/{BrandId:int}")] public Dictionary StageRwd(int BrandId) { StreamReader sr = new StreamReader(Request.Body); string requestMes = sr.ReadToEnd(); if (string.IsNullOrEmpty(requestMes)) { return new Dictionary(); } RedisDbconn.Instance.AddList("kss_stage_rwd_list_" + BrandId, requestMes); Dictionary obj = new Dictionary(); obj.Add("code", 200); obj.Add("message", ""); return obj; } #endregion #region 接收商户注册记录 [HttpPost] [Route("/kss/merchant/{BrandId:int}")] public Dictionary Merchant(int BrandId) { StreamReader sr = new StreamReader(Request.Body); string requestMes = sr.ReadToEnd(); if (string.IsNullOrEmpty(requestMes)) { return new Dictionary(); } RedisDbconn.Instance.AddList("kss_merchant_list_" + BrandId, requestMes); Dictionary obj = new Dictionary(); obj.Add("code", 200); obj.Add("message", ""); return obj; } #endregion #region 解析get请求键值对 private Dictionary GetParams(string data) { Dictionary result = new Dictionary(); string[] datalist = data.Split('&'); foreach (string sub in datalist) { string[] subdatalist = sub.Split('='); result.Add(subdatalist[0], subdatalist[1]); } return result; } #endregion } }