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.Main; using LitJson; using Library; using System.Data; using MySystem.Service.Main; /// /// 商户服务费退还 /// namespace MySystem.Areas.Api.Controllers.v1 { [Area("Api")] [Route("Api/v1/[controller]/[action]")] public class MerchantDepositBackController : BaseController { public MerchantDepositBackController(IHttpContextAccessor accessor) : base(accessor) { } #region 商户激活—商户服务费退还 [Authorize] public JsonResult AddMerchantDepositBack(string value) { value = DesDecrypt(value); JsonData data = JsonMapper.ToObject(value); AppResultJson result = AddMerchantDepositBackDo(value); return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data }); } private AppResultJson AddMerchantDepositBackDo(string value) { JsonData data = JsonMapper.ToObject(value); int MerchantId = int.Parse(function.CheckInt(data.getItem("MerchantId").ToString())); //商户Id int ReturnWay = int.Parse(function.CheckInt(data.getItem("ReturnWay").ToString())); //退还方式 string MobileCode = data["MobileCode"].ToString(); //短信验证码 string ReturnNo = data["ReturnNo"].ToString(); //退还账号 if (string.IsNullOrEmpty(data["MerchantId"].ToString())) { return new AppResultJson() { Status = "-1", Info = "请填写商户Id" }; } if (!function.IsInt(data["MerchantId"].ToString())) { return new AppResultJson() { Status = "-1", Info = "请填写正确的商户Id" }; } if (string.IsNullOrEmpty(data["ReturnWay"].ToString())) { return new AppResultJson() { Status = "-1", Info = "请填写退还方式" }; } if (!function.IsInt(data["ReturnWay"].ToString())) { return new AppResultJson() { Status = "-1", Info = "请填写正确的退还方式" }; } MobileCodeCheck mobilecheck = RedisDbconn.Instance.Get("MobileCodeCheck:手机号"); if (mobilecheck == null) { return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" }; } if (mobilecheck.CheckCode != MobileCode) { return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" }; } RedisDbconn.Instance.Clear("MobileCodeCheck:手机号"); Dictionary Obj = new Dictionary(); MerchantDepositBack query = new MerchantDepositBack(); Dictionary fields = new Dictionary(); fields.Add("CreateDate", DateTime.Now); //创建时间 fields.Add("UpdateDate", DateTime.Now); //修改时间 fields.Add("MerchantId", MerchantId); //商户Id fields.Add("ReturnWay", ReturnWay); //退还方式 // AppResultJson resultJson = MerchantDepositBackService.Add(fields); return new AppResultJson() { Status = "1", Info = "", Data = Obj }; } #endregion } }