| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Http;
- using Microsoft.Extensions.Logging;
- using Microsoft.Extensions.Options;
- using Microsoft.AspNetCore.Authorization;
- using System.Web;
- using MySystem.Models.Main1;
- using MySystem.Service.Main1;
- using LitJson;
- using Library;
- namespace MySystem.Areas.Api.Controllers.v1.Main1
- {
- [Area("Api")]
- [Route("/v1/QrCodePlateMain/[controller]/[action]")]
- public class PosMachinesTwoController : BaseController
- {
- public PosMachinesTwoController(IHttpContextAccessor accessor) : base(accessor)
- {
- }
- #region 重置交易额-直连重置码牌交易额
- [Authorize]
- public JsonResult DirectResetQrCodeAmount(string value)
- {
- value = PublicFunction.DesDecrypt(value); ;
- JsonData data = JsonMapper.ToObject(value);
- AppResultJson result = DirectResetQrCodeAmountDo(value);
- return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
- }
- private AppResultJson DirectResetQrCodeAmountDo(string value)
- {
- JsonData data = JsonMapper.ToObject(value);
- string PosSn = data["PosSn"].ToString(); //码牌Sn
- string TradeDate = data["TradeDate"].ToString(); //交易时间
- if (string.IsNullOrEmpty(data["PosSn"].ToString()) || string.IsNullOrEmpty(data["TradeDate"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "码牌Sn和交易时间不能为空" };
- }
- var pos = PosMachinesTwoService.Query(" and PosSn=" + PosSn + "");
- if (pos.Id == 0 || pos.OpId != 1)
- {
- return new AppResultJson() { Status = "-1", Info = "未找到该码牌Sn或该码牌通道不符" };
- }
- string[] datelist = TradeDate.Split(new string[] { " - " }, StringSplitOptions.None);
- string start = DateTime.Parse(datelist[0]).ToString("yyyyMMdd");
- string end = DateTime.Parse(datelist[1]).ToString("yyyyMMdd");
- string info = "{\"SnNo\":\"" + PosSn + "\",\"StartDate\":\"" + start + "\",\"EndDate\": \"" + end + "\"}";
- RedisDbconn.Instance.AddList("ResetSnStatDataQueue", info);
- Dictionary<string, object> Obj = new Dictionary<string, object>();
- return new AppResultJson() { Status = "1", Info = "", Data = Obj };
- }
- #endregion
- #region 重置交易额-银联重置码牌交易额
- [Authorize]
- public JsonResult UnionPayResetQrCodeAmount(string value)
- {
- value = PublicFunction.DesDecrypt(value); ;
- JsonData data = JsonMapper.ToObject(value);
- AppResultJson result = UnionPayResetQrCodeAmountDo(value);
- return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
- }
- private AppResultJson UnionPayResetQrCodeAmountDo(string value)
- {
- JsonData data = JsonMapper.ToObject(value);
- string PosSn = data["PosSn"].ToString(); //码牌Sn
- string TradeDate = data["TradeDate"].ToString(); //交易时间
- if (string.IsNullOrEmpty(data["PosSn"].ToString()) || string.IsNullOrEmpty(data["TradeDate"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "码牌Sn和交易时间不能为空" };
- }
- var pos = PosMachinesTwoService.Query(" and PosSn=" + PosSn + "");
- if (pos.Id == 0 || pos.OpId != 2)
- {
- return new AppResultJson() { Status = "-1", Info = "未找到该码牌Sn或该码牌通道不符" };
- }
- string[] datelist = TradeDate.Split(new string[] { " - " }, StringSplitOptions.None);
- string start = DateTime.Parse(datelist[0]).ToString("yyyyMMdd");
- string end = DateTime.Parse(datelist[1]).ToString("yyyyMMdd");
- string info = "{\"SnNo\":\"" + PosSn + "\",\"StartDate\":\"" + start + "\",\"EndDate\": \"" + end + "\"}";
- RedisDbconn.Instance.AddList("ResetSnStatDataQueue2", info);
- Dictionary<string, object> Obj = new Dictionary<string, object>();
- return new AppResultJson() { Status = "1", Info = "", Data = Obj };
- }
- #endregion
- }
- }
|