123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- 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 MySystem.MainModels;
- using LitJson;
- using Library;
- namespace MySystem.Areas.Api.Controllers.v1
- {
- [Area("Api")]
- [Route("/v1/qrcodeplatemain/[controller]/[action]")]
- public class MerchantDepositBackController : BaseController
- {
- public MerchantDepositBackController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
- {
- }
- #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["MerchantId"].ToString())); //商户Id
- int ReturnWay = int.Parse(function.CheckInt(data["ReturnWay"].ToString())); //退还方式
- string MobileCode = data["MobileCode"].ToString(); //短信验证码
- string ReturnNo = data["ReturnNo"].ToString(); //退还账号
- var info = MerchantDepositBackUtil.AddMerchantDepositBackDo(MerchantId, ReturnWay, MobileCode, ReturnNo);
- if (info == "success")
- {
- return new AppResultJson() { Status = "1", Info = info, Data = info };
- }
- else
- {
- return new AppResultJson() { Status = "-1", Info = info, Data = info };
- }
- }
- #endregion
- #region 商户激活-银行选项名称
- [Authorize]
- public JsonResult Options(string value)
- {
- value = DesDecrypt(value);
- JsonData data = JsonMapper.ToObject(value);
- List<Dictionary<string, object>> dataList = OptionsDo(value);
- return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
- }
- private List<Dictionary<string, object>> OptionsDo(string value)
- {
- JsonData data = JsonMapper.ToObject(value);
- int PageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
- int PageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
- List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
- var query = GetBanks();
- foreach (string key in query.Keys)
- {
- Dictionary<string, object> curData = new Dictionary<string, object>();
- curData.Add("text", query[key]); //文本
- curData.Add("value", key); //值
- dataList.Add(curData);
- }
- return dataList;
- }
- #endregion
- private Dictionary<string, string> GetBanks()
- {
- Dictionary<string, string> dic = new Dictionary<string, string>();
- dic.Add("工商银行", "工商银行");
- dic.Add("农业银行", "农业银行");
- dic.Add("邮储银行", "邮储银行");
- dic.Add("建设银行", "建设银行");
- dic.Add("招商银行", "招商银行");
- dic.Add("中国银行", "中国银行");
- dic.Add("交通银行", "交通银行");
- dic.Add("浦发银行", "浦发银行");
- dic.Add("广发银行", "广发银行");
- dic.Add("民生银行", "民生银行");
- dic.Add("平安银行", "平安银行");
- dic.Add("光大银行", "光大银行");
- dic.Add("兴业银行", "兴业银行");
- dic.Add("中信银行", "中信银行");
- dic.Add("上海银行", "上海银行");
- dic.Add("其他银行", "其他银行");
- return dic;
- }
- #region 检查签名是否合法,合法返回1,不合法返回提示信息
- /// <summary>
- /// 检查签名是否合法,合法返回1,不合法返回提示信息
- /// </summary>
- /// <param name="value">请求的参数(json字符串)</param>
- /// <param name="signField">要签名的字段</param>
- /// <returns></returns>
- private string CheckSign(string value, string[] signField)
- {
- JsonData json = JsonMapper.ToObject(value);
- Dictionary<string, string> dic = new Dictionary<string, string>();
- for (int i = 0; i < signField.Length; i++)
- {
- dic.Add(signField[i], json[signField[i]].ToString());
- }
- string sign = json["sign"].ToString(); //客户端签名字符串
- return new Sign().sign(dic, sign);
- }
- #endregion
- }
- }
|