|
|
@@ -29,10 +29,10 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
|
|
|
}
|
|
|
|
|
|
- #region 提现记录列表
|
|
|
+ #region 直营团队提现记录列表
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 根据条件查询提现记录列表
|
|
|
+ /// 根据条件查询直营团队提现记录列表
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IActionResult Index(UserCashRecordForBusiness data, string right)
|
|
|
@@ -41,35 +41,33 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
ViewBag.right = right;
|
|
|
|
|
|
|
|
|
- string Condition = "";
|
|
|
- Condition += "CashOrderNo:\"" + data.CashOrderNo + "\",";
|
|
|
- Condition += "TradeType:\"" + data.TradeType + "\",";
|
|
|
+ // string Condition = "";
|
|
|
+ // Condition += "CashOrderNo:\"" + data.CashOrderNo + "\",";
|
|
|
+ // Condition += "TradeType:\"" + data.TradeType + "\",";
|
|
|
|
|
|
- if (!string.IsNullOrEmpty(Condition))
|
|
|
- {
|
|
|
- Condition = Condition.TrimEnd(',');
|
|
|
- Condition = ", where: {" + Condition + "}";
|
|
|
- }
|
|
|
- ViewBag.Condition = Condition;
|
|
|
+ // if (!string.IsNullOrEmpty(Condition))
|
|
|
+ // {
|
|
|
+ // Condition = Condition.TrimEnd(',');
|
|
|
+ // Condition = ", where: {" + Condition + "}";
|
|
|
+ // }
|
|
|
+ // ViewBag.Condition = Condition;
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
- #region 根据条件查询提现记录列表
|
|
|
+ #region 根据条件查询直营团队提现记录列表
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 提现记录列表
|
|
|
+ /// 直营团队提现记录列表
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- public JsonResult IndexData(UserCashRecordForBusiness data, string MakerCode, string RealName, string StatusSelect, string QueryCountSelect, string CreateDateData, int page = 1, int limit = 30)
|
|
|
+ public JsonResult IndexData(UserCashRecordForBusiness data, string MakerCode, string RealName, string CreateDateData, int page = 1, int limit = 30)
|
|
|
{
|
|
|
|
|
|
Dictionary<string, string> Fields = new Dictionary<string, string>();
|
|
|
- Fields.Add("CashOrderNo", "1"); //提现单号
|
|
|
- Fields.Add("TradeType", "0"); //交易类型
|
|
|
|
|
|
- string condition = " and Status>-1 and TradeType<3";
|
|
|
+ string condition = " and Status>-1";
|
|
|
//创客编号
|
|
|
if (!string.IsNullOrEmpty(MakerCode))
|
|
|
{
|
|
|
@@ -80,57 +78,36 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
|
condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
|
|
|
}
|
|
|
- //提现状态
|
|
|
- if (!string.IsNullOrEmpty(StatusSelect))
|
|
|
- {
|
|
|
- condition += " and Status=" + StatusSelect;
|
|
|
- }
|
|
|
if (!string.IsNullOrEmpty(data.CashOrderNo))
|
|
|
{
|
|
|
condition += " and CashOrderNo='" + data.CashOrderNo + "'";
|
|
|
}
|
|
|
- if (data.TradeType > 0)
|
|
|
- {
|
|
|
- condition += " and TradeType=" + data.TradeType;
|
|
|
- }
|
|
|
- //提交到代付状态
|
|
|
- if (!string.IsNullOrEmpty(QueryCountSelect))
|
|
|
- {
|
|
|
- if(QueryCountSelect == "0")
|
|
|
- {
|
|
|
- condition += " and QueryCount=" + QueryCountSelect;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- condition += " and QueryCount>0";
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
if (!string.IsNullOrEmpty(CreateDateData))
|
|
|
{
|
|
|
string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
|
|
|
var start = Convert.ToDateTime(Convert.ToDateTime(datelist[0]).ToString("yyyy-MM-dd"));
|
|
|
var end = Convert.ToDateTime(Convert.ToDateTime(datelist[1]).ToString("yyyy-MM-dd") + " 23:59:59");
|
|
|
- var check = db.UserCashRecord.Any(m => m.CreateDate >= start && m.TradeType < 3);
|
|
|
- var checks = db.UserCashRecord.Any(m => m.CreateDate <= end && m.TradeType < 3);
|
|
|
+ var check = db.UserCashRecordForBusiness.Any(m => m.CreateDate >= start);
|
|
|
+ var checks = db.UserCashRecordForBusiness.Any(m => m.CreateDate <= end);
|
|
|
if (check)
|
|
|
{
|
|
|
- var sId = db.UserCashRecord.Where(m => m.CreateDate >= start && m.TradeType < 3).Min(m => m.Id);
|
|
|
+ var sId = db.UserCashRecordForBusiness.Where(m => m.CreateDate >= start).Min(m => m.Id);
|
|
|
condition += " and Id >=" + sId;
|
|
|
}
|
|
|
if (checks)
|
|
|
{
|
|
|
- var eId = db.UserCashRecord.Where(m => m.CreateDate <= end && m.TradeType < 3).Max(m => m.Id);
|
|
|
+ var eId = db.UserCashRecordForBusiness.Where(m => m.CreateDate <= end).Max(m => m.Id);
|
|
|
condition += " and Id <=" + eId;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var start = Convert.ToDateTime(DateTime.Now.AddMonths(-1).ToString("yyyy-MM") + "-01");
|
|
|
- var check = db.UserCashRecord.Any(m => m.CreateDate >= start && m.TradeType < 3);
|
|
|
+ var check = db.UserCashRecordForBusiness.Any(m => m.CreateDate >= start);
|
|
|
if (check)
|
|
|
{
|
|
|
- var minId = db.UserCashRecord.Where(m => m.CreateDate >= start && m.TradeType < 3).Min(m => m.Id);
|
|
|
+ var minId = db.UserCashRecordForBusiness.Where(m => m.CreateDate >= start).Min(m => m.Id);
|
|
|
var Info = function.ReadInstance("/WritePage/UserCashRecord/UserCashRecordForBusiness.txt");
|
|
|
if (string.IsNullOrEmpty(Info.ToString()))
|
|
|
{
|
|
|
@@ -161,25 +138,16 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
Users user = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
|
|
|
dic["MakerCode"] = user.MakerCode;
|
|
|
dic["RealName"] = user.RealName;
|
|
|
- dic["TradeType"] = RelationClassForConst.GetTradeTypeInfo(int.Parse(dic["TradeType"].ToString()));
|
|
|
- int Status = int.Parse(dic["Status"].ToString());
|
|
|
- if (Status == 0) dic["StatusName"] = "处理中";
|
|
|
- if (Status == 1) dic["StatusName"] = "成功";
|
|
|
- if (Status == 2) dic["StatusName"] = "失败";
|
|
|
-
|
|
|
- int QueryCount = int.Parse(dic["QueryCount"].ToString());
|
|
|
- if (QueryCount == 0) dic["LockName"] = "待提交";
|
|
|
- if (QueryCount > 0) dic["LockName"] = "已提交";
|
|
|
}
|
|
|
return Json(obj);
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
- #region 增加提现记录
|
|
|
+ #region 增加直营团队提现记录
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 增加或修改提现记录信息
|
|
|
+ /// 增加或修改直营团队提现记录信息
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IActionResult Add(string right)
|
|
|
@@ -187,35 +155,82 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
ViewBag.RightInfo = RightInfo;
|
|
|
ViewBag.right = right;
|
|
|
|
|
|
-
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
- #region 增加提现记录
|
|
|
+ #region 增加直营团队提现记录
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 增加或修改提现记录信息
|
|
|
+ /// 增加或修改直营团队提现记录信息
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
- public string Add(UserCashRecordForBusiness data)
|
|
|
+ public string Add(UserCashRecordForBusiness data, string MakerCode, string RealName, string Amount)
|
|
|
{
|
|
|
Dictionary<string, object> Fields = new Dictionary<string, object>();
|
|
|
+ var userInfo = db.Users.FirstOrDefault(m => m.MakerCode == MakerCode && m.RealName == RealName && m.BusinessFlag == 1) ?? new Users();
|
|
|
+ if (userInfo.Id > 0 && !string.IsNullOrEmpty(Amount))
|
|
|
+ {
|
|
|
+ UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == userInfo.Id) ?? new UserAccount();
|
|
|
+ // GetReserve(MakerCode, RealName, Amount);
|
|
|
+ if (account.BalanceAmount - account.ToChargeAmount - decimal.Parse(Amount) >= 0)
|
|
|
+ {
|
|
|
+ string CashOrderNo = "T1" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
|
|
|
+ Fields.Add("UserId", userInfo.Id); //创客Id
|
|
|
+ Fields.Add("TradeAmount", Amount); //提现金额
|
|
|
+ Fields.Add("CashOrderNo", CashOrderNo); //提现单号
|
|
|
+ Fields.Add("SeoKeyword", data.SeoKeyword); //备注
|
|
|
+ int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("UserCashRecordForBusiness", Fields, 0);
|
|
|
+
|
|
|
+ decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
|
|
|
+ decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
|
|
|
+ decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
|
|
|
+ account.BalanceAmount -= decimal.Parse(Amount);
|
|
|
+ account.FreezeAmount += decimal.Parse(Amount);
|
|
|
+ decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
|
|
|
+ decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
|
|
|
+ decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
|
|
|
+
|
|
|
+ db.UserAccountRecord.Add(new UserAccountRecord()
|
|
|
+ {
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
+ UserId = userInfo.Id, //创客
|
|
|
+ ChangeType = 132, //变动类型
|
|
|
+ Kind = 2,
|
|
|
+ ChangeAmount = decimal.Parse(Amount), //变更金额
|
|
|
+ BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
|
|
|
+ AfterTotalAmount = AfterTotalAmount, //变更后总金额
|
|
|
+ BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
|
|
|
+ AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
|
|
|
+ BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
|
|
|
+ AfterBalanceAmount = AfterBalanceAmount, //变更后余额
|
|
|
+ });
|
|
|
+ AddSysLog(data.Id.ToString(), "UserCashRecordForBusiness", "add");
|
|
|
+ db.SaveChanges();
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return "创客可提现余额不足";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return "输入的创客信息不存在或者创客编号和姓名不匹配";
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- Fields.Add("Remark", data.Remark); //备注
|
|
|
-
|
|
|
- Fields.Add("SeoTitle", data.SeoTitle);
|
|
|
- Fields.Add("SeoKeyword", data.SeoKeyword);
|
|
|
- Fields.Add("SeoDescription", data.SeoDescription);
|
|
|
- int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("UserCashRecordForBusiness", Fields, 0);
|
|
|
- AddSysLog(data.Id.ToString(), "UserCashRecordForBusiness", "add");
|
|
|
- db.SaveChanges();
|
|
|
+ #endregion
|
|
|
|
|
|
- return "success";
|
|
|
+ #region 获取创客账户信息
|
|
|
+ public string GetReserve(string MakerCode, string RealName, string Amount)
|
|
|
+ {
|
|
|
+ var userInfo = db.Users.FirstOrDefault(m => m.MakerCode == MakerCode && m.RealName == RealName) ?? new Users();
|
|
|
+ UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == userInfo.Id) ?? new UserAccount();
|
|
|
+ return "当前余额为:" + account.BalanceAmount + "元 可提现余额为:" + (account.BalanceAmount - account.ToChargeAmount) + "元 提现后余额为:" + (account.BalanceAmount - decimal.Parse(Amount)) + "元";
|
|
|
}
|
|
|
-
|
|
|
#endregion
|
|
|
|
|
|
}
|