| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- /*
- * 创客提现映射
- */
- using System;
- using System.Web;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Http;
- using Microsoft.Extensions.Logging;
- using Microsoft.Extensions.Options;
- using MySystem.CashModels;
- using Library;
- using LitJson;
- using MySystemLib;
- namespace MySystem.Areas.Admin.Controllers
- {
- [Area("Admin")]
- [Route("Admin/[controller]/[action]")]
- public class WithdrawConfigController : BaseController
- {
- public WithdrawConfigController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
- {
- OtherMySqlConn.connstr = ConfigurationManager.AppSettings["CashSqlConnStr"].ToString();
- }
- #region 创客提现映射列表
- /// <summary>
- /// 根据条件查询创客提现映射列表
- /// </summary>
- /// <returns></returns>
- public IActionResult Index(WithdrawConfig data, string right)
- {
- ViewBag.RightInfo = RightInfo;
- ViewBag.right = right;
- return View();
- }
- #endregion
- #region 根据条件查询创客提现映射列表
- /// <summary>
- /// 创客提现映射列表
- /// </summary>
- /// <returns></returns>
- public JsonResult IndexData(WithdrawConfig data, int page = 1, int limit = 30)
- {
- Dictionary<string, string> Fields = new Dictionary<string, string>();
- string condition = "";
- if(data.Id > 0)
- {
- condition += " and Id=" + data.Id;
- }
- if(data.QueryCount > 0)
- {
- condition += " and QueryCount=" + data.QueryCount;
- }
- Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.CashTables).IndexData("WithdrawConfig", Fields, "Id desc", "0", page, limit, condition);
- List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
- foreach (Dictionary<string, object> dic in diclist)
- {
- //验证和同步账户
- int Id = int.Parse(dic["Id"].ToString());
- Models.Users user = db.Users.FirstOrDefault(m => m.Id == Id) ?? new Models.Users();
- dic["MakerCode"] = user.MakerCode;
- dic["RealName"] = user.RealName;
- dic["Mobile"] = user.Mobile;
- int QueryCount = int.Parse(dic["QueryCount"].ToString());
- Models.Users touser = db.Users.FirstOrDefault(m => m.Id == QueryCount) ?? new Models.Users();
- dic["ToMakerCode"] = touser.MakerCode;
- dic["ToRealName"] = touser.RealName;
- dic["ToMobile"] = touser.Mobile;
- }
- return Json(obj);
- }
- #endregion
- #region 增加创客提现映射
- /// <summary>
- /// 增加或修改创客提现映射信息
- /// </summary>
- /// <returns></returns>
- public IActionResult Add(string right)
- {
- ViewBag.RightInfo = RightInfo;
- ViewBag.right = right;
- return View();
- }
- #endregion
- #region 增加创客提现映射
- /// <summary>
- /// 增加或修改创客提现映射信息
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public string Add(WithdrawConfig data)
- {
- Dictionary<string, object> Fields = new Dictionary<string, object>();
- Fields.Add("Id", data.Id); //创客编号
- Fields.Add("QueryCount", data.QueryCount); //创客名称
- int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.CashTables).Add("WithdrawConfig", Fields, 0);
- AddSysLog(Id.ToString(), "WithdrawConfig", "add");
- cashdb.SaveChanges();
- return "success";
- }
- #endregion
- #region 删除创客提现映射信息
- /// <summary>
- /// 删除创客提现映射信息
- /// </summary>
- /// <returns></returns>
- public string Delete(string Id)
- {
- string[] idlist = Id.Split(new char[] { ',' });
- AddSysLog(Id, "WithdrawConfig", "del");
- foreach (string subid in idlist)
- {
- int id = int.Parse(subid);
- Dictionary<string, object> Fields = new Dictionary<string, object>();
- Fields.Add("Status", -1);
- new AdminContentOther(_accessor.HttpContext, PublicFunction.CashTables).Delete("WithdrawConfig", id);
- }
- cashdb.SaveChanges();
- return "success";
- }
- #endregion
- }
- }
|