public ActionResult MoneySetEdit() { string ID = AdminProduct.Utils.Converter.ToString(Request.Form["Id"], ""); string OsName = AdminProduct.Utils.Converter.ToString(Request.Form["OsName"], "", null); string IsHaveSigned = AdminProduct.Utils.Converter.ToString(Request.Form["IsHaveSigned"], "", null); string MoneyInTime1_start = AdminProduct.Utils.Converter.ToString(Request.Form["MoneyInTime1_start"], "", null); string MoneyInTime1_end = AdminProduct.Utils.Converter.ToString(Request.Form["MoneyInTime1_end"], "", null); string MoneyInTime2_start = AdminProduct.Utils.Converter.ToString(Request.Form["MoneyInTime2_start"], "", null); string MoneyInTime2_end = AdminProduct.Utils.Converter.ToString(Request.Form["MoneyInTime2_end"], "", null); string MoneyInMin = AdminProduct.Utils.Converter.ToString(Request.Form["MoneyInMin"], "", null); string MoneyInMax = AdminProduct.Utils.Converter.ToString(Request.Form["MoneyInMax"], "", null); string MoneyOutTime_start = AdminProduct.Utils.Converter.ToString(Request.Form["MoneyOutTime_start"], "", null); string MoneyOutTime_end = AdminProduct.Utils.Converter.ToString(Request.Form["MoneyOutTime_end"], "", null); string MoneyOutDayMax = AdminProduct.Utils.Converter.ToString(Request.Form["MoneyOutDayMax"], "", null); string MoneyOutMin = AdminProduct.Utils.Converter.ToString(Request.Form["MoneyOutMin"], "", null); string MoneyOutMax = AdminProduct.Utils.Converter.ToString(Request.Form["MoneyOutMax"], "", null); string MoneyOutCounterFee = AdminProduct.Utils.Converter.ToString(Request.Form["MoneyOutCounterFee"], "", null); string IsMoneyOutSure = AdminProduct.Utils.Converter.ToString(Request.Form["IsMoneyOutSure"], "", null); string MoneyOutDayOfCount = AdminProduct.Utils.Converter.ToString(Request.Form["MoneyOutDayOfCount"], "", null); TOperationLog OLog = new TOperationLog(); try { APIDataDataContext db = APIDataContextProxy.APIDB; { var sys = (from c in db.TSysPreference select c).FirstOrDefault(); OLog.BeforeValue = ObjectToJson.ModelToJson(sys); if (sys != null) { sys.OsName = OsName; sys.IsHaveSigned = IsHaveSigned == "TRUE"; sys.MoneyInTime1_start = TimeSpan.Parse(MoneyInTime1_start); sys.MoneyInTime1_end = TimeSpan.Parse(MoneyInTime1_end); sys.MoneyInTime2_start = TimeSpan.Parse(MoneyInTime2_start); sys.MoneyInTime2_end = TimeSpan.Parse(MoneyInTime2_end); sys.MoneyInMin = double.Parse(MoneyInMin); sys.MoneyInMax = double.Parse(MoneyInMax); sys.MoneyOutTime_start = TimeSpan.Parse(MoneyOutTime_start); sys.MoneyOutTime_end = TimeSpan.Parse(MoneyOutTime_end); sys.MoneyOutDayMax = double.Parse(MoneyOutDayMax); sys.MoneyOutMin = double.Parse(MoneyOutMin); sys.MoneyOutMax = double.Parse(MoneyOutMax); sys.MoneyOutCounterFee = double.Parse(MoneyOutCounterFee); sys.IsMoneyOutSure = IsMoneyOutSure == "TRUE"; sys.MoneyOutDayOfCount = int.Parse(MoneyOutDayOfCount); OLog.PageName = "设置资金后台"; OLog.UpdateValue = ObjectToJson.ModelToJson(sys); } else { TSysPreference tsys = new TSysPreference(); tsys.OsName = OsName; tsys.IsHaveSigned = IsHaveSigned == "TRUE"; tsys.MoneyInTime1_start = TimeSpan.Parse(MoneyInTime1_start); tsys.MoneyInTime1_end = TimeSpan.Parse(MoneyInTime1_end); tsys.MoneyInTime2_start = TimeSpan.Parse(MoneyInTime2_start); tsys.MoneyInTime2_end = TimeSpan.Parse(MoneyInTime2_end); tsys.MoneyInMin = double.Parse(MoneyInMin); tsys.MoneyInMax = double.Parse(MoneyInMax); tsys.MoneyOutTime_start = TimeSpan.Parse(MoneyOutTime_start); tsys.MoneyOutTime_end = TimeSpan.Parse(MoneyOutTime_end); tsys.MoneyOutDayMax = double.Parse(MoneyOutDayMax); tsys.MoneyOutMin = double.Parse(MoneyOutMin); tsys.MoneyOutMax = double.Parse(MoneyOutMax); tsys.MoneyOutCounterFee = double.Parse(MoneyOutCounterFee); tsys.IsMoneyOutSure = IsMoneyOutSure == "TRUE"; tsys.MoneyOutDayOfCount = int.Parse(MoneyOutDayOfCount); db.TSysPreference.InsertOnSubmit(tsys); OLog.PageName = "设置资金后台"; OLog.UpdateValue = ObjectToJson.ModelToJson(tsys); // } } db.SubmitChanges(); //写入操作日志 OLog.UserID = Convert.ToInt32(Session["ID"]); OLog.UserType = 2;//0 用户 1 会员 2 员工 OLog.CreateDate = DateTime.Now; Converter.InsertOperationLog(OLog); return Content(ID.ToString()); } } catch { return Content("fail"); } }
public ActionResult System() { TSysPreference model = new TSysPreference(); APIDataDataContext db = APIDataContextProxy.APIDB; { var res = (from p in db.TSysPreference select p).FirstOrDefault(); if (res != null) model = res; ViewData["UserGroup"] = db.TUserGroup.OrderBy(g => g.ID).ToList(); } ViewData.Model = model; return View(); }
public ActionResult TradeTime() { TSysPreference model = new TSysPreference(); APIDataDataContext db = APIDataContextProxy.APIDB; { var res = db.TSysPreference.FirstOrDefault(); if (res != null) model = res; } ViewData.Model = model; return View(); }
public ActionResult PostTradeTime() { int id = 0; //Id string name = ""; //登陆名 string Type = ""; //type string msg = ""; //提示信息 bool fruit = false; //结果 TOperationLog OLog = new TOperationLog();//用户操作日志model if (!Request.IsAjaxRequest()) return Content("{result:'fail',msg:'非法请求'}"); int d1t = Converter.ToInt(Request.Form["d1t"], 0); int d2t = Converter.ToInt(Request.Form["d2t"], 0); int d3t = Converter.ToInt(Request.Form["d3t"], 0); int d4t = Converter.ToInt(Request.Form["d4t"], 0); int d5t = Converter.ToInt(Request.Form["d5t"], 0); int d6t = Converter.ToInt(Request.Form["d6t"], 0); int d7t = Converter.ToInt(Request.Form["d7t"], 0); if (!(d1t == 1 || d1t == 2) || !(d2t == 1 || d2t == 2) || !(d3t == 1 || d3t == 2) || !(d4t == 1 || d4t == 2) || !(d5t == 1 || d5t == 2) || !(d6t == 1 || d6t == 2) || !(d7t == 1 || d7t == 2)) return Content("{result:'fail',msg:'时间间隔类型错误,必须为隔日或当日!'}"); string errMsg = ""; string d1b = Converter.ToString(Request.Form["d1b"]).Trim(); string d1e = Converter.ToString(Request.Form["d1e"]).Trim(); TimeSpan sb1 = TimeSpan.Zero; TimeSpan se1 = TimeSpan.Zero; if (!TimeSpan.TryParse(d1b, out sb1) || !TimeSpan.TryParse(d1e, out se1)) errMsg += "周一交易时间有误;"; else if (d1t == 1 && sb1 > se1) errMsg += "周一时间间隔为当日,则交易结束时间必须大于开始时间"; string d2b = Converter.ToString(Request.Form["d2b"]).Trim(); string d2e = Converter.ToString(Request.Form["d2e"]).Trim(); TimeSpan sb2 = TimeSpan.Zero; TimeSpan se2 = TimeSpan.Zero; if (!TimeSpan.TryParse(d2b, out sb2) || !TimeSpan.TryParse(d2e, out se2)) errMsg += "周二交易时间有误;"; else if (d2t == 1 && sb2 > se2) errMsg += "周二时间间隔为当日,则交易结束时间必须大于开始时间"; string d3b = Converter.ToString(Request.Form["d3b"]).Trim(); string d3e = Converter.ToString(Request.Form["d3e"]).Trim(); TimeSpan sb3 = TimeSpan.Zero; TimeSpan se3 = TimeSpan.Zero; if (!TimeSpan.TryParse(d3b, out sb3) || !TimeSpan.TryParse(d3e, out se3)) errMsg += "周三交易时间有误;"; else if (d3t == 1 && sb3 > se3) errMsg += "周三时间间隔为当日,则交易结束时间必须大于开始时间"; string d4b = Converter.ToString(Request.Form["d4b"]).Trim(); string d4e = Converter.ToString(Request.Form["d4e"]).Trim(); TimeSpan sb4 = TimeSpan.Zero; TimeSpan se4 = TimeSpan.Zero; if (!TimeSpan.TryParse(d4b, out sb4) || !TimeSpan.TryParse(d4e, out se4)) errMsg += "周四交易时间有误;"; else if (d4t == 1 && sb4 > se4) errMsg += "周四时间间隔为当日,则交易结束时间必须大于开始时间"; string d5b = Converter.ToString(Request.Form["d5b"]).Trim(); string d5e = Converter.ToString(Request.Form["d5e"]).Trim(); TimeSpan sb5 = TimeSpan.Zero; TimeSpan se5 = TimeSpan.Zero; if (!TimeSpan.TryParse(d5b, out sb5) || !TimeSpan.TryParse(d5e, out se5)) errMsg += "周五交易时间有误;"; else if (d5t == 1 && sb5 > se5) errMsg += "周五时间间隔为当日,则交易结束时间必须大于开始时间"; string d6b = Converter.ToString(Request.Form["d6b"]).Trim(); string d6e = Converter.ToString(Request.Form["d6e"]).Trim(); TimeSpan sb6 = TimeSpan.Zero; TimeSpan se6 = TimeSpan.Zero; if (!TimeSpan.TryParse(d6b, out sb6) || !TimeSpan.TryParse(d6e, out se6)) errMsg += "周六交易时间有误;"; else if (d6t == 1 && sb6 > se6) errMsg += "周六时间间隔为当日,则交易结束时间必须大于开始时间"; string d7b = Converter.ToString(Request.Form["d7b"]).Trim(); string d7e = Converter.ToString(Request.Form["d7e"]).Trim(); TimeSpan sb7 = TimeSpan.Zero; TimeSpan se7 = TimeSpan.Zero; if (!TimeSpan.TryParse(d7b, out sb7) || !TimeSpan.TryParse(d7e, out se7)) errMsg += "周日交易时间有误;"; else if (d7t == 1 && sb7 > se7) errMsg += "周日时间间隔为当日,则交易结束时间必须大于开始时间"; if (!string.IsNullOrEmpty(errMsg)) return Content("{result:'fail',msg:'" + errMsg + "'}"); try { APIDataDataContext db = APIDataContextProxy.APIDB; { var res = db.TSysPreference.FirstOrDefault(); OLog.BeforeValue = ObjectToJson.ModelToJson(res); if (res != null) { res.TimeZone = 1; res.Day1BeginTime = sb1; res.Day1EndTime = se1; res.Day1Type = d1t; res.Day2BeginTime = sb2; res.Day2EndTime = se2; res.Day2Type = d2t; res.Day3BeginTime = sb3; res.Day3EndTime = se3; res.Day3Type = d3t; res.Day4BeginTime = sb4; res.Day4EndTime = se4; res.Day4Type = d4t; res.Day5BeginTime = sb5; res.Day5EndTime = se5; res.Day5Type = d5t; res.Day6BeginTime = sb6; res.Day6EndTime = se6; res.Day6Type = d6t; res.Day7BeginTime = sb7; res.Day7EndTime = se7; res.Day7Type = d7t; db.SubmitChanges(); OLog.UpdateValue = ObjectToJson.ModelToJson(res); //写入操作日志 OLog.UserID = Convert.ToInt32(Session["ID"]); OLog.UserType = 2;//0 用户 1 会员 2 员工 OLog.CreateDate = DateTime.Now; OLog.PageName = "修改运营时间"; Converter.InsertOperationLog(OLog); //存入日志 id = Convert.ToInt32(Session["ID"]); //id Type = Session["Type"].ToString(); //类型 msg = "设置运营时间成功"; fruit = true; Converter.InsertLog(id, name, Type, msg, fruit); return Content("{result:'success',msg:'设置成功!'}"); } else { res.TimeZone = 1; res = new TSysPreference(); res.Day1BeginTime = sb1; res.Day1EndTime = se1; res.Day1Type = d1t; res.Day2BeginTime = sb2; res.Day2EndTime = se2; res.Day2Type = d2t; res.Day3BeginTime = sb3; res.Day3EndTime = se3; res.Day3Type = d3t; res.Day4BeginTime = sb4; res.Day4EndTime = se4; res.Day4Type = d4t; res.Day5BeginTime = sb5; res.Day5EndTime = se5; res.Day5Type = d5t; res.Day6BeginTime = sb6; res.Day6EndTime = se6; res.Day6Type = d6t; res.Day7BeginTime = sb7; res.Day7EndTime = se7; res.Day7Type = d7t; db.TSysPreference.InsertOnSubmit(res); db.SubmitChanges(); OLog.UpdateValue = ObjectToJson.ModelToJson(res); //写入操作日志 OLog.UserID = Convert.ToInt32(Session["ID"]); OLog.UserType = 2;//0 用户 1 会员 2 员工 OLog.CreateDate = DateTime.Now; OLog.PageName = "添加运营时间"; Converter.InsertOperationLog(OLog); //存入日志 id = Convert.ToInt32(Session["ID"]); //id Type = Session["Type"].ToString(); //类型 msg = "设置运营时间成功"; fruit = true; Converter.InsertLog(id, name, Type, msg, fruit); return Content("{result:'success',msg:'设置成功!'}"); } } } catch { //存入日志 id = Convert.ToInt32(Session["ID"]); //id Type = Session["Type"].ToString(); //类型 msg = "设置运营时间失败"; fruit = false; Converter.InsertLog(id, name, Type, msg, fruit); return Content("{result:'fail',msg:'设置失败,出现未知错误!'}"); } }
public ActionResult PostTime() { int id = 0; //Id string name = ""; //登陆名 string Type = ""; //type string msg = ""; //提示信息 bool fruit = false; //结果 TOperationLog OLog = new TOperationLog(); if (!Request.IsAjaxRequest()) return Content("{result:'fail',msg:'非法请求'}"); string st = Converter.ToString(Request.Form["SettleTime"]).Trim(); string ct = Converter.ToString(Request.Form["CountTime"]).Trim(); string cdt = Converter.ToString(Request.Form["ClearDemoTime"]).Trim(); string cet = Converter.ToString(Request.Form["ClearEnsureTime"]).Trim(); int st1 = 0; int ct1 = 0; int cdt1 = 1; int cet1 = 0; string errMsg = ""; if (st == "") errMsg += "、仓息结算时间不能为空"; else if (!int.TryParse(st, out st1) || !(st1 >= 0 && st1 <= 24)) errMsg += "、仓息结算时间必须介于0-24之间;"; if (ct == "") errMsg += "、红利结算时间不能为空"; else if (!int.TryParse(ct, out ct1) || !(ct1 >= 0 && ct1 <= 24)) errMsg += "、红利结算时间必须介于0-24之间;"; //if (cdt == "") // errMsg += "、仓息结算时间不能为空"; //else if (!int.TryParse(cdt, out cdt1) || !(cdt1 >= 0 && cdt1 <= 24)) // errMsg += "、仓息结算时间必须介于0-24之间;"; if (cet == "") errMsg += "、清理委托订单止盈止损时间不能为空"; else if (!int.TryParse(cet, out cet1) || !(cet1 >= 0 && cet1 <= 24)) errMsg += "、清理委托订单止盈止损时间必须介于0-24之间;"; if (!string.IsNullOrEmpty(errMsg)) return Content("{result:'fail',msg:'" + errMsg + "'}"); try { APIDataDataContext db = APIDataContextProxy.APIDB; { var res = db.TSysPreference.FirstOrDefault(); OLog.BeforeValue = ObjectToJson.ModelToJson(res); if (res != null) { res.ClearDemoTime = cdt1; res.ClearEnsureTime = cet1; res.CountTime = ct1; res.SettleTime = st1; db.SubmitChanges(); OLog.UpdateValue = ObjectToJson.ModelToJson(res); //写入操作日志 OLog.UserID = Convert.ToInt32(Session["ID"]); OLog.UserType = 2;//0 用户 1 会员 2 员工 OLog.CreateDate = DateTime.Now; OLog.PageName = "修改结算时间"; Converter.InsertOperationLog(OLog); //存入日志 id = Convert.ToInt32(Session["ID"]); //id Type = Session["Type"].ToString(); //类型 msg = "设置结算时间成功"; fruit = true; Converter.InsertLog(id, name, Type, msg, fruit); return Content("{result:'fail',msg:'设置成功!'}"); } else { res = new TSysPreference(); res.ClearDemoTime = cdt1; res.ClearEnsureTime = cet1; res.CountTime = ct1; res.SettleTime = st1; db.TSysPreference.InsertOnSubmit(res); db.SubmitChanges(); OLog.UpdateValue = ObjectToJson.ModelToJson(res); //写入操作日志 OLog.UserID = Convert.ToInt32(Session["ID"]); OLog.UserType = 2;//0 用户 1 会员 2 员工 OLog.CreateDate = DateTime.Now; OLog.PageName = "添加结算时间"; Converter.InsertOperationLog(OLog); //存入日志 id = Convert.ToInt32(Session["ID"]); //id Type = Session["Type"].ToString(); //类型 msg = "设置结算时间成功"; fruit = true; Converter.InsertLog(id, name, Type, msg, fruit); return Content("{result:'fail',msg:'设置成功!'}"); } } } catch { id = Convert.ToInt32(Session["ID"]); //id Type = Session["Type"].ToString(); //类型 msg = "设置结算时间失败"; fruit = false; Converter.InsertLog(id, name, Type, msg, fruit); return Content("{result:'fail',msg:'设置失败,出现未知错误!'}"); } }
public ActionResult PostSys() { int id = 0; //Id string name = ""; //登陆名 string Type = ""; //type string msg = ""; //提示信息 bool fruit = false; //结果 if (!Request.IsAjaxRequest()) return Content("{result:'fail',msg:'非法请求!'}"); int serverType = Converter.ToInt(Request.Form["servertype"], 1); string lcprefix = Converter.ToString(Request.Form["lcprefix"]).Trim(); string dcprefix = Converter.ToString(Request.Form["dcprefix"]).Trim(); string aprefix = Converter.ToString(Request.Form["aprefix"]).Trim(); string sprefix = Converter.ToString(Request.Form["sprefix"]).Trim(); string defaultDisplay = Converter.ToString(Request.Form["defaultdisplay"]).Trim(); int settlecurrency = Converter.ToInt(Request.Form["settlecurrency"], 1); int allowdemo = Converter.ToInt(Request.Form["allowdemo"], 0); int allowdemologin = Converter.ToInt(Request.Form["allowdemologin"], 0); string fine = Converter.ToString(Request.Form["defaultdemofin"]).Trim(); //string dead = Converter.ToString(Request.Form["demodeadline"]).Trim(); int auml = Converter.ToInt(Request.Form["allowusermultilogin"], 1); int aaml = Converter.ToInt(Request.Form["allowagentmultilogin"], 1); string fname = Converter.ToString(Request.Form["fullname"]).Trim(); string sname = Converter.ToString(Request.Form["shortname"]).Trim(); string address = Converter.ToString(Request.Form["address"]).Trim(); string zipcode = Converter.ToString(Request.Form["zipcode"]).Trim(); string hotline = Convert.ToString(Request.Form["hotline"]).Trim(); string email = Convert.ToString(Request.Form["email"]).Trim().ToLower(); string fax = Converter.ToString(Request.Form["fax"]).Trim(); TOperationLog OLog = new TOperationLog();//用户操作日志model bool isValid = true; string errMsg = ""; //if (lcprefix == "") //{ // errMsg += "实盘账户前缀不能为空;"; // isValid = false; //} //if (dcprefix == "") //{ // errMsg += "模拟账户前缀不能为空;"; // isValid = false; //} //if (aprefix == "") //{ // errMsg += "会员账户前缀不能为空;"; // isValid = false; //} //if (sprefix == "") //{ // errMsg += "员工账号前缀不能为空;"; // isValid = false; //} if (!(settlecurrency > 0 && settlecurrency < 3)) { errMsg += "--结算货币非法;<br />"; isValid = false; } float fin = 0f; if (!float.TryParse(fine, out fin)) { errMsg += "--账户初始资金输入有误;<br />"; isValid = false; } //int day = 0; //if (!int.TryParse(dead, out day)) //{ // errMsg += "--模拟账户有效期限输入有误;<br />"; // isValid = false; //} //if (fname == "") //{ // errMsg += "机构全称不能为空;"; // isValid = false; //} //if (sname == "") //{ // errMsg += "机构简称不能为空;"; // isValid = false; //} //if (address == "") //{ // errMsg += "地址不能为空;"; // isValid = false; //} //if (zipcode == "") //{ // errMsg += "邮政编码不能为空;"; // isValid = false; //} //if (hotline == "") //{ // errMsg += "客服热线不能为空;"; // isValid = false; //} //if (email == "") //{ // errMsg += "联系邮箱不能为空;"; // isValid = false; //} //if (fax == "") //{ // errMsg += "传真不能为空;"; // isValid = false; //} if (!isValid) return Content("{result:'fail',msg:'" + errMsg + "'}"); try { APIDataDataContext db = APIDataContextProxy.APIDB; { var entity = db.TSysPreference.FirstOrDefault(); OLog.BeforeValue = ObjectToJson.ModelToJson(entity); if (entity == null) { entity = new TSysPreference(); entity.ServerType = serverType; entity.LCPrefix = lcprefix; entity.DCPrefix = dcprefix; entity.APrefix = aprefix; entity.SPrefix = sprefix; entity.DefaultDisplay = defaultDisplay; entity.SettleCurrency = settlecurrency; entity.AllowDemo = allowdemo == 0 ? false : true; entity.AllowDemoLogin = allowdemologin == 0 ? false : true; entity.DefaultDemoFin = fin; //entity.DemoDeadline = day; entity.AllowAgentMultiLogin = aaml == 0 ? false : true; entity.AllowUserMultiLogin = auml == 0 ? false : true; entity.FullName = fname; entity.ShortName = sname; entity.Address = address; entity.ZipCode = zipcode; entity.HotLine = hotline; entity.Email = email; entity.Fax = fax; db.TSysPreference.InsertOnSubmit(entity); db.SubmitChanges(); //记录操作日志 OLog.UpdateValue = ObjectToJson.ModelToJson(entity); OLog.UserID = Convert.ToInt32(Session["ID"]); OLog.UserType = 2;//0 用户 1 会员 2 员工 OLog.CreateDate = DateTime.Now; OLog.PageName = "新增系统设置"; Converter.InsertOperationLog(OLog); //存入日志 id = Convert.ToInt32(Session["ID"]); //id Type = Session["Type"].ToString(); //类型 msg = "系统设置成功"; fruit = true; Converter.InsertLog(id, name, Type, msg, fruit); return Content("{result:'success',msg:'修改成功!'}"); } else { entity.ServerType = serverType; entity.LCPrefix = lcprefix; entity.DCPrefix = dcprefix; entity.APrefix = aprefix; entity.SPrefix = sprefix; entity.DefaultDisplay = defaultDisplay; entity.SettleCurrency = settlecurrency; entity.AllowDemo = allowdemo == 0 ? false : true; entity.AllowDemoLogin = allowdemologin == 0 ? false : true; entity.DefaultDemoFin = fin; //entity.DemoDeadline = day; entity.AllowAgentMultiLogin = aaml == 0 ? false : true; entity.AllowUserMultiLogin = auml == 0 ? false : true; entity.FullName = fname; entity.ShortName = sname; entity.Address = address; entity.ZipCode = zipcode; entity.HotLine = hotline; entity.Email = email; entity.Fax = fax; db.SubmitChanges(); //记录操作日志 OLog.UpdateValue = ObjectToJson.ModelToJson(entity); OLog.UserID = Convert.ToInt32(Session["ID"]); OLog.UserType = 2;//0 用户 1 会员 2 员工 OLog.CreateDate = DateTime.Now; OLog.PageName = "修改系统设置"; Converter.InsertOperationLog(OLog); //存入日志 id = Convert.ToInt32(Session["ID"]); //id Type = Session["Type"].ToString(); //类型 msg = "修改系统设置成功"; fruit = true; Converter.InsertLog(id, name, Type, msg, fruit); return Content("{result:'success',msg:'修改成功!'}"); } } } catch { //存入日志 id = Convert.ToInt32(Session["ID"]); //id Type = Session["Type"].ToString(); //类型 msg = "修改系统设置失败"; fruit = false; Converter.InsertLog(id, name, Type, msg, fruit); return Content("{result:'fail',msg:'修改失败,出现未知异常!'}"); } }
//注册 public string Regist() { APIDataDataContext db = APIDataContextProxy.APIDB; string Name = SoftwareAPI.Utils.Converter.ToString(Request["Name"], ""); string Sexs = SoftwareAPI.Utils.Converter.ToString(Request["Sex"], ""); int AccountType = SoftwareAPI.Utils.Converter.ToInt(Request["AccountType"], 0);//帐号类型 0模拟 1 实盘 string Phone = SoftwareAPI.Utils.Converter.ToString(Request["Phone"], "");//手机 string Email = SoftwareAPI.Utils.Converter.ToString(Request["Email"], "");//邮箱 int CityID = SoftwareAPI.Utils.Converter.ToInt(Request["CityID"], 0);//地区; string Address = SoftwareAPI.Utils.Converter.ToString(Request["Address"], "");//地址; int AgendID = SoftwareAPI.Utils.Converter.ToInt(Request["AgendID"], 0);//所属会员; string PassWord = SoftwareAPI.Utils.Converter.ToString(Request["PassWord"], "");//密码 string Account = "";//生成 bool Sex = false; sysPreference = db.TSysPreference.FirstOrDefault(); if (AccountType == 0 && sysPreference.AllowDemo == false) { JObject jo = new JObject(); jo["success"] = 10003; jo["token"] = ""; jo["msg"] = "该平台禁止模拟账户注册!"; return jo.ToString(); } if (Sexs.ToLower() == "true") { Sex = true; } string IP = GetUserIp;//密码 var user = (from c in db.TRealAccounts where c.Email.ToUpper() == Email.ToUpper() || c.Phone.ToUpper() == Phone.ToUpper() select c).FirstOrDefault(); if (string.IsNullOrEmpty(Name) || string.IsNullOrEmpty(Phone) || string.IsNullOrEmpty(Email) || string.IsNullOrEmpty(PassWord)) { JObject jo = new JObject(); jo["success"] = 10003; jo["token"] = ""; jo["msg"] = "请输入完整!"; return jo.ToString(); } if (user != null) { JObject jo = new JObject(); jo["success"] = 10004; jo["token"] = ""; jo["msg"] = "该用户已经注册过了!"; return jo.ToString(); } else { //查询平台设置 var sys = (from c in db.TSysPreference select c).FirstOrDefault(); string beforename = "";//帐号前缀 if (AccountType == 1)//真实帐号 { beforename = sys.LCPrefix; } else //模拟帐号 { beforename = sys.DCPrefix; } Account = beforename + DateTime.Now.ToString("yyyyMMddHHmmss"); var group = (from c in db.TUserGroup orderby c.IsDefault descending select c).FirstOrDefault(); //添加新用户 user = new TRealAccounts(); //Account user.Name = Name; user.Sex = Sex; user.Account = Account; user.AccountType = AccountType; user.Phone = Phone; user.Email = Email; user.CityID = CityID; user.Address = Address; if (AgendID == 0) user.AgendID = (from c in db.TAgents orderby c.Depth ascending select c.ID ).FirstOrDefault(); else user.AgendID = AgendID; user.PassWord = PassWord; user.AccountMoney = 0; if (AccountType != 1) { try { if (sysPreference.DefaultDemoFin > 0) { user.AccountMoney = sysPreference.DefaultDemoFin; user.AccountBeginMoney = sysPreference.DefaultDemoFin;//赠金 TAccountMoney tam = new TAccountMoney(); tam.MoneyOrderNum = DateTime.Now.ToString("yyyyMMddHHmmssfff"); tam.RealAccountId = Converter.ToInt(user.ID); tam.TypeId = 2; tam.OriginalMoney = user.AccountMoney; tam.CreateMoney = sysPreference.DefaultDemoFin; tam.NowMoney = sysPreference.DefaultDemoFin; if (tam.NowMoney < 0) { tam.NowMoney = 0; } tam.CreateTime = DateTime.Now; tam.UpDateTime = DateTime.Now; tam.Status = 2; tam.TOrderId = 0; db.TAccountMoney.InsertOnSubmit(tam); } } catch { } } //user.AccountType = AccountType; user.LastLoginIP = IP; user.LastLoginTime = DateTime.Now; try { user.GroupID = group.ID; } catch { user.GroupID = 0; } db.TRealAccounts.InsertOnSubmit(user); db.SubmitChanges(); user.Account = beforename + user.ID.ToString("000000"); db.SubmitChanges(); //Account = beforename + DateTime.Now.ToString("yyyyMMddHHmmss"); //查询accesstoken 是否有 Access access = (from c in db.Access where c.userid == user.ID select c).FirstOrDefault(); string token = ""; if (access != null)// 数据库有accesstoken { token = access.access_token; } else { access = new Access(); access.userid = user.ID; string access_token = FormsAuthentication.HashPasswordForStoringInConfigFile(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "MD5"); access.access_token = access_token; access.expires_in = 0; access.scope = "0"; access.datetime = DateTime.Now; access.platform_name = sys.FullName; access.deviceid = 0; db.Access.InsertOnSubmit(access); db.SubmitChanges(); } JObject job = new JObject(); job["token"] = access.access_token; job["Account"] = user.Account; job["MinVolume"] = group.MinVolume; job["MaxVolume"] = group.MaxVolume; job["EntrustDeadLine"] = group.EntrustDeadLine; JObject jo = new JObject(); jo["success"] = "TRUE"; jo["content"] = job; jo["msg"] = "登陆成功!"; return jo.ToString(); } }
//public ActionResult GetNewestVersion() //{ // APIDataDataContext db = APIDataContextProxy.APIDB; // var sedition = (from b in db.TSysPreference select b.SEdition); // JObject job = new JObject(); // job["sedition"] = sedition; //} public ActionResult Index() { if (requestType == "testping") { return Content("connected"); } if (requestType.ToLower() == "gettestaccount") { return Content(GetTestAccount(Request["num"])); } string msg = ""; userid = 0; APIDataDataContext db = APIDataContextProxy.APIDB; //var aa = db.TSysPreference.FirstOrDefault(); sysPreference = db.TSysPreference.FirstOrDefault(); if (requestType.ToLower() != "login" && requestType.ToLower() != "regist" && requestType.ToLower() != "version") { var usertoken = (from c in db.Access where c.access_token == token select c.userid).FirstOrDefault(); userid = usertoken; JObject jo = new JObject(); if (usertoken <= 0) { JObject jomsg = new JObject(); jomsg["success"] = 6666; jomsg["msg"] = "token不正确!"; return Content(jo.ToString()); } } if (requestType == "Version") { JObject jobj = new JObject(); JObject job = new JObject(); job["Version"] = sysPreference.SEdition; job["Version1"] = sysPreference.SEdition1; job["Version2"] = sysPreference.SEdition2; jobj["success"] = "TRUE"; jobj["content"] = job; return Content(jobj.ToString()); } var group = (from c in db.TUserGroup join b in db.TRealAccounts on c.ID equals b.GroupID where b.ID == userid select c).FirstOrDefault(); userGroup = group; if (userGroup == null) { userGroup = (from c in db.TUserGroup where c.IsDefault == true select c).FirstOrDefault(); } switch (requestType.ToLower()) { case "login": msg = Login(); break; case "regist": msg = Regist(); break; case "getuserip": msg = GetUserIp; break; case "announcelist": msg = AnnounceList(); break; case "announce": msg = Announce(); break; case "analysislist": msg = AnalysisList(); break; case "analysis": msg = Analysis(); break; case "databytimespan": msg = GetDataByTimeSpan(); break; case "lateschardate": msg = LatestChartData(); break; case "allchartdate": msg = GetData(); break; case "getproducts": msg = GetProductList(); break; case "getproductinfo": msg = GetProductInfo(); break; case "createorder": msg = CreateOrder(); break; case "editorder": msg = EditOrder(); break; case "delorder": msg = DelOrder(); break; //case "getlatestchartdata": // return GetLatestChartData(); //case "getchartdatainfo": // return GetChartDataInfo(); case "getnewsbytype": msg = GetNewsByType(); break; case "getnewsinfobyid": msg = GetNewsInfoById(); break; case "orderinfo": msg = OrderInfo(); break; case "getproductsinfo": msg = GetProductsInfo(); break; case "gettproducts": msg = GetTProducts(); break; case "getemails": msg = GetEmails(); break; case "getproductprice": msg = GetProductPrice(); break; case "getemailcontent": msg = GetEmailContent(); break; case "getdatalist": msg = GetDataList(); break; case "getclosedatalist": msg = GetCloseDataList(); break; case "getorderinfo": msg = GetOrderInfo(); break; case "operatecollection": msg = OperateCollection(); break; case "closeorder": msg = CloseOrder(); break; case "closeallorder": msg = CloseAllOrder(); break; case "getcollectionproductlist": msg = GetCollectionProductList(); break; case "getuserinfo": msg = GetUserInfo(); break; case "getproductconfig": msg = GetProductConfig(); break; case "getaccountinfo": msg = getAccountInfo(); break; case "repeatorder": msg = RepeatOrder(); break; case "updatepwd": msg = UpdatePwd(); break; case "logout": msg = Logout(); break; } //msg = GetProductInfo(); return Content(msg); }