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 { public class YcCardOnlineController : Admin.Controllers.BaseController { public YcCardOnlineController(IHttpContextAccessor accessor, ILogger logger, IOptions setting) : base(accessor, logger, setting) { } #region 接收订单通知 [Route("/yc/order/notice")] 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("yc_order_list", requestMes); Dictionary obj = new Dictionary(); obj.Add("resultCode", 1); return obj; } #endregion #region 设备信息初始化回传接口 [Route("/yc/device/init")] public Dictionary Init() { StreamReader sr = new StreamReader(Request.Body); string requestMes = sr.ReadToEnd(); if (string.IsNullOrEmpty(requestMes)) { return new Dictionary(); } LogHelper.Instance.WriteLog(DateTime.Now.ToString() + "\n" + requestMes, "WIFI设备信息初始化回传接口推送消息"); RedisDbconn.Instance.AddList("yc_device", "init#cut#" + requestMes); Dictionary obj = new Dictionary(); obj.Add("resultCode", 1); obj.Add("errorCode", null); obj.Add("errorDesc", null); return obj; } #endregion #region 设备信息变更回传接口 [Route("/yc/device/change")] public Dictionary Change() { StreamReader sr = new StreamReader(Request.Body); string requestMes = sr.ReadToEnd(); if (string.IsNullOrEmpty(requestMes)) { return new Dictionary(); } LogHelper.Instance.WriteLog(DateTime.Now.ToString() + "\n" + requestMes, "WIFI设备信息变更回传接口推送消息"); RedisDbconn.Instance.AddList("yc_device", "change#cut#" + requestMes); Dictionary obj = new Dictionary(); obj.Add("resultCode", 1); obj.Add("errorCode", null); obj.Add("errorDesc", null); return obj; } #endregion #region 订单信息初始化回传接口 [Route("/yc/order/init")] public Dictionary OrderInit() { StreamReader sr = new StreamReader(Request.Body); string requestMes = sr.ReadToEnd(); if (string.IsNullOrEmpty(requestMes)) { return new Dictionary(); } LogHelper.Instance.WriteLog(DateTime.Now.ToString() + "\n" + requestMes, "WIFI订单信息初始化回传接口推送消息"); RedisDbconn.Instance.AddList("yc_order", "init#cut#" + requestMes); Dictionary obj = new Dictionary(); obj.Add("resultCode", 1); obj.Add("errorCode", null); obj.Add("errorDesc", null); return obj; } #endregion #region 订单状态变更回传接口 [Route("/yc/order/change")] public Dictionary OrderChange() { StreamReader sr = new StreamReader(Request.Body); string requestMes = sr.ReadToEnd(); if (string.IsNullOrEmpty(requestMes)) { return new Dictionary(); } LogHelper.Instance.WriteLog(DateTime.Now.ToString() + "\n" + requestMes, "WIFI订单状态变更回传接口推送消息"); RedisDbconn.Instance.AddList("yc_order", "change#cut#" + requestMes); Dictionary obj = new Dictionary(); obj.Add("resultCode", 1); obj.Add("errorCode", null); obj.Add("errorDesc", null); return obj; } #endregion } }