public ActionResult Login(FormCollection collection) { try { var name = collection["Name"]; var cpwd = collection["PassWord"]; //api/System?name={name}&password={password} var api = new ApiReceive { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/System?name={0}&password={1}", name, cpwd), }; var result = api.PostJsonToParameter(); var entity = CommonHelper.Deserialize <User>(result); api.Dispose(); if (entity.result == 1) { Session.Add("user", entity); Session.Timeout = 60; return(RedirectToAction("Index")); } ViewBag.msg = entity.message; ViewBag.error = 1; return(View()); } catch { return(View()); } }
public FileResult AjaxExcel(FormCollection collection) { var pid = Convert.ToInt32(collection["pid"]); var excel_type = Convert.ToInt32(collection["excel_type"]); var excel_kind = collection["excel_kind"]; //api/Common?pid={pid}&type={type}&order={order} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/Common?pid={0}&type={1}&order={2}", pid, excel_type, excel_kind), }; var result = api.PostJsonToParameter(); api.Dispose(); var list = CommonHelper.Deserialize <List <ReportCode> >(result); if (!list.Any()) { list.Add(new ReportCode()); } var html = ExcelHelper.ToHtmlTable(list); var name = String.Format("{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss")); //第一种:使用FileContentResult byte[] fileContents = Encoding.UTF8.GetBytes(html); return(File(fileContents, "application/ms-excel", name)); //第二种:使用FileStreamResult //var fileStream = new MemoryStream(fileContents); //return File(fileStream, "application/ms-excel", "excel.xls"); }
// // GET: /Goods/ public ActionResult GoodsManage(Int32 index = 1, Int32 size = 10) { if (!IsLogin) { return(Redirect("/Home/Login")); } //api/Goods?token={token}&role={role}&index={index}&size={size} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/Goods?token={0}&role={1}&index={2}&size={3}", user.token, user.role, index, size), }; var result = api.PostJsonToParameter(); api.Dispose(); var list = CommonHelper.Deserialize <PagerGoodsType>(result); var query = new PagerQuery <PagerInfo, List <GoodsType> >(list.Pager, list.GoodsType); if (query.result >= 0) { return(View(query)); } ViewBag.Error = -1; ViewBag.Message = query.message; return(View()); }
/// <summary>GM操作记录</summary> public ActionResult RecordList(Int32 index = 1, Int32 size = 10) { if (!IsLogin) { return(Redirect("/Home/Login")); } ViewBag.Platform = ApiPlatforms(); ViewBag.Role = user.role; //api/GM?token={token}&role={role}&pid={pid}&index={index}&size={size} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/GM?token={0}&role={1}&pid={2}&index={3}&size={4}", user.token, user.role, user.pid, index, size), }; var result = api.PostJsonToParameter(); api.Dispose(); var list = CommonHelper.Deserialize <PageGmManage>(result); var query = new PagerQuery <PagerInfo, List <GmManage> >(list.Pager, list.Gms); if (query.result < 0) { ViewBag.Error = -1; ViewBag.Message = query.message; return(View()); } return(View(query)); }
/// <summary>删除福利卡类型</summary> public ActionResult DeleteType(Int32 id) { if (!IsLogin) { return(Redirect("/Home/Login")); } //Post api/Goods?token={token}&gid={gid}&role={role}&b={b} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/Goods?token={0}&gid={1}&&role={2}&b={3}", user.token, id, user.role, 0), }; var result = api.PostJsonToParameter(); api.Dispose(); var entity = CommonHelper.Deserialize <BaseEntity>(result); if (entity.result == 1) { return(Redirect("/Goods/GoodsManage")); } ViewBag.Error = -1; ViewBag.Message = entity.message; return(Redirect("/Goods/GoodsManage")); }
public ActionResult GoodsTypeEdit(FormCollection collection) { try { if (!IsLogin) { return(Redirect("/Home/Login")); } var gid = collection["gid"]; var type = collection["typeId"]; var name = collection["name"]; if (string.IsNullOrEmpty(type) || string.IsNullOrEmpty(name)) { ViewBag.Error = -1; ViewBag.Message = "请编辑完整信息"; return(Redirect("/Goods/GoodsManage")); } if (!Regex.IsMatch(type, @"^\d+$")) { ViewBag.Error = -1; ViewBag.Message = "福利卡枚举类型ID格式错误,请重新输入"; return(View()); } var goodtype = new GoodsType() { id = Convert.ToInt32(gid), type_id = Convert.ToInt32(type), name = name, }; //POST api/System?token={token}&gid={gid}&typeId={typeId}&name={name}&b={b} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/Goods?token={0}&gid={1}&typeId={2}&name={3}&b={4}", user.token, gid, type, name, 0), }; var result = api.PostJsonToParameter(); api.Dispose(); var entity = CommonHelper.Deserialize <BaseEntity>(result); if (entity.result == 1) { return(Redirect("/Goods/GoodsManage")); } ViewBag.Error = entity.result; ViewBag.Message = entity.message; return(View(goodtype)); } catch (Exception ex) { return(Redirect("/Goods/GoodsManage")); } }
/// <summary>获取平台数据</summary> internal List <Platform> ApiPlatforms() { var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/Common?token={0}&pid={1}&role={2}", user.token, user.pid, user.role), }; var result = api.PostJsonToParameter(); return(CommonHelper.Deserialize <List <Platform> >(result)); }
public ActionResult Index(FormCollection collection) { if (!IsLogin) { return(Redirect("Home/Login")); } var pid = collection["platform"]; var sid = collection["server"]; var type = collection["search_type"]; var value = collection["value"]; ViewBag.Platform = ApiPlatforms(); if (string.IsNullOrEmpty(pid) || string.IsNullOrEmpty(sid) || string.IsNullOrEmpty(type) || string.IsNullOrEmpty(value)) { ViewBag.Error = -1; ViewBag.Message = "请提交完整的信息"; return(View(new PlayerDetailed())); } if (Convert.ToInt32(type) != 1 && Convert.ToInt32(type) != 2) { ViewBag.Error = -1; ViewBag.Message = "查询类型错误"; return(View(new PlayerDetailed())); } if (string.IsNullOrEmpty(value)) { ViewBag.Error = -1; ViewBag.Message = "请输入查询内容"; return(View(new PlayerDetailed())); } //Post api/Player?token={token}&name={name}&pid={pid}&sid={sid}&type={type}&value={value} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/Player?token={0}&name={1}&pid={2}&sid={3}&type={4}&value={5}", user.token, user.name, pid, sid, type, value), }; var result = api.PostJsonToParameter(); api.Dispose(); var entity = CommonHelper.Deserialize <PlayerDetailed>(result); if (entity.result == -1) { ViewBag.Error = -1; ViewBag.Message = entity.message; return(View(new PlayerDetailed())); } return(View(entity)); }
/// <summary>获取启服服务器</summary> internal List <Server> ApiFindServer() { //api/System?token={token} var api = new ApiReceive { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/System?token={0}&flag=true", user.token), }; var result = api.PostJsonToParameter(); var list = CommonHelper.Deserialize <List <Server> >(result); return(list); }
private Notice ApiFindNotice(Guid token, string sn, Int64 stime, Int64 etime, int interval, string content) { var api = new ApiReceive { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/Manage?token={0}&sn={1}&start={2}&end={3}&space={4}&content={5}", token, sn, stime, etime, interval, content), }; var result = api.PostJsonToParameter(); api.Dispose(); var rm = CommonHelper.Deserialize <Notice>(result); return(rm); }
public JsonResult PagerServerKeep(Int32 pid, Int32 index, Int32 size) { //POST api/Record?token={token}&pid={pid}&index={index}&size={size} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/Record?token={0}&pid={1}&index={2}&size={3}", user.token, pid, index, size), }; var result = api.PostJsonToParameter(); api.Dispose(); var list = CommonHelper.Deserialize <PagerKeep>(result); return(Json(list, JsonRequestBehavior.AllowGet)); }
/// <summary>获取所有平台数据</summary> private List <Platform> GetPlatformAllList() { //POST api/Common?token={token}&pid={pid}&role={role} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/Common?token={0}&pid={1}&role={2}", user.token, user.pid, user.role), }; var result = api.PostJsonToParameter(); api.Dispose(); var list = CommonHelper.Deserialize <List <Platform> >(result); return(list); }
/// <summary>获取福利卡类型信息</summary> private List <GoodsType> ApiFindGoodsType() { // POST api/Goods?token={token} var api = new ApiReceive { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/Goods?token={0}&flag=true", user.token), }; var result = api.PostJsonToParameter(); api.Dispose(); var list = CommonHelper.Deserialize <List <GoodsType> >(result); return(list); }
/// <summary>平台编辑</summary> /// <param name="id">平台id</param> public ActionResult PlatformEdit(Int32 id) { //POST api/System?token={token}&pid={pid}&name={name}&b={b} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/System?token={0}&pid={1}&name={2}&b={3}", user.token, id, user.name, 0), }; var result = api.PostJsonToParameter(); api.Dispose(); var entity = CommonHelper.Deserialize <Platform>(result); return(View(entity)); }
public JsonResult AjaxPercent(Int32 sid, Int64 playerId) { //Post api/Player?token={token}&sid={sid}&playerId={playerId}&role={role} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/Player?token={0}&sid={1}&playerId={2}&role={3}", user.token, sid, playerId, user.role), }; var result = api.PostJsonToParameter(); api.Dispose(); var list = CommonHelper.Deserialize <PlayerGoldPercent>(result); var jsonResult = Json(list, JsonRequestBehavior.AllowGet); return(jsonResult); }
public JsonResult AjaxCodeLog(Int32 pid) { //api/System?token={token}&pid={pid}&b={b} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/System?token={0}&pid={1}&b={2}", user.token, pid, 0), }; var result = api.PostJsonToParameter(); api.Dispose(); var list = CommonHelper.Deserialize <List <ServerCodeLog> >(result); var jsonResult = Json(list, JsonRequestBehavior.AllowGet); return(jsonResult); }
/// <summary> /// 生成福利卡激活码 /// </summary> public JsonResult AjaxCreateCode(Int32 pid, String data, Int32 type, String number) { //POST api/System?token={token}&pid={pid}&data={data}&type={type}&number={number}&b={b} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/System?token={0}&pid={1}&data={2}&type={3}&number={4}&b={5}", user.token, pid, data, type, number, 0), }; var result = api.PostJsonToParameter(); api.Dispose(); var list = CommonHelper.Deserialize <BaseEntity>(result); var jsonResult = Json(list, JsonRequestBehavior.AllowGet); return(jsonResult); }
public JsonResult AjaxGoodsCode(Int32 pid, String order, Int32 type, Int32 page, Int32 size) { //Post api/System?token={token}&pid={pid}&order={order}&type={type}&index={index}&size={size} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/System?token={0}&pid={1}&order={2}&type={3}&index={4}&size={5}", user.token, pid, order, type, page, size), }; var result = api.PostJsonToParameter(); api.Dispose(); var list = CommonHelper.Deserialize <PagerServerGoodsCode>(result); var jsonResult = Json(list, JsonRequestBehavior.AllowGet); return(jsonResult); }
public JsonResult AjaxGolds(Int32 sid, Int64 playerId, Int32 page, Int32 size) { //Post api/Player?token={token}&sid={sid}&playerId={playerId}&type={type}&name={name}&index={index}&size={size} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/Player?token={0}&sid={1}&playerId={2}&type={3}&name={4}&index={5}&size={6}", user.token, sid, playerId, 3, user.name, page, size), }; var result = api.PostJsonToParameter(); api.Dispose(); var list = CommonHelper.Deserialize <PageLog>(result); var jsonResult = Json(list, JsonRequestBehavior.AllowGet); return(jsonResult); }
public ActionResult AjaxLevel(Int32 sid, Int32 page, Int32 size) { //Post api/Record?token={token}&pid={pid}&sid={sid}&name={name}&index={index}&size={size} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/Record?token={0}&pid={1}&sid={2}&name={3}&index={4}&size={5}", user.token, user.pid, sid, user.name, page, size), }; var result = api.PostJsonToParameter(); api.Dispose(); var list = CommonHelper.Deserialize <PagerServerLevel>(result); var jsonResult = Json(list, JsonRequestBehavior.AllowGet); return(jsonResult); }
public JsonResult AjaxEquips(Int32 sid, Int64 rid) { //api/Player?token={token}&sid={sid}&rid={rid}&name={name} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/Player?token={0}&sid={1}&rid={2}&name={3}", user.token, sid, rid, user.name), }; var result = api.PostJsonToParameter(); api.Dispose(); var list = CommonHelper.Deserialize <List <PlayerBag> >(result); var jsonResult = Json(list, JsonRequestBehavior.AllowGet); return(jsonResult); }
public JsonResult PagerServerDetail(Int32 sid, String begin, String end, Int32 index, Int32 size) { //POST api/Record?token={token}&sid={sid}&begin={begin}&end={end}&index={index}&size={size} var b = Convert.ToDateTime(begin); var e = Convert.ToDateTime(end); var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/Record?token={0}&sid={1}&begin={2}&end={3}&index={4}&size={5}", user.token, sid, b, e, index, size), }; var result = api.PostJsonToParameter(); api.Dispose(); var list = CommonHelper.Deserialize <PagerRecord>(result); return(Json(list, JsonRequestBehavior.AllowGet)); }
public JsonResult ServerHoursDetail(Int32 sid, string time) { var t = Convert.ToDateTime(time); //POST api/Record?token={token}&sid={sid}&time={time} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/Record?token={0}&sid={1}&time={2}", user.token, sid, t), }; var result = api.PostJsonToParameter(); api.Dispose(); var chart = CommonHelper.Deserialize <ChartHours>(result); return(Json(chart, JsonRequestBehavior.AllowGet)); }
/// <summary>管理服务器状态</summary> public ActionResult ManageServerState(int id) { if (!IsLogin) { return(Redirect("/Home/Login")); } //POST api/System?token={token}&sid={sid}&b={b} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/System?token={0}&sid={1}&b={2}", user.token, id, 0), }; var result = api.PostJsonToParameter(); api.Dispose(); var entity = CommonHelper.Deserialize <Server>(result); return(View(entity)); }
/// <summary>编辑福利卡类型信息</summary> public ActionResult GoodsTypeEdit(Int32 id) { if (!IsLogin) { return(Redirect("/Home/Login")); } //POST api/Goods?token={token}&gid={gid}&b={b} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/Goods?token={0}&gid={1}&b={2}", user.token, id, 0), }; var result = api.PostJsonToParameter(); api.Dispose(); var entity = CommonHelper.Deserialize <GoodsType>(result); return(View(entity)); }
// // GET: /System/ public ActionResult Index(Int32 index = 1, Int32 size = 10) { if (!IsLogin) { return(Redirect("/Home/Login")); } //POST api/System?token={token}&index={index}&size={size} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/System?token={0}&index={1}&size={2}", user.token, index, size), }; var result = api.PostJsonToParameter(); api.Dispose(); var list = CommonHelper.Deserialize <PagerPlatform>(result); var query = new PagerQuery <PagerInfo, List <Platform> >(list.Pager, list.Platforms); ViewBag.user = user; return(View(query)); }
/// <summary>管理</summary> public ActionResult Account(Int32 index = 1, Int32 size = 10) { if (!IsLogin) { return(Redirect("/Home/Login")); } var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/System?token={0}&role={1}&pid={2}&index={3}&size={4}" , user.token, user.role, user.pid, index, size), }; var result = api.PostJsonToParameter(); api.Dispose(); var list = CommonHelper.Deserialize <PagerUser>(result); var query = new PagerQuery <PagerInfo, List <User> >(list.Pager, list.Users); return(View(query)); }
public ActionResult Recharge(FormCollection collection) { if (!IsLogin) { return(Redirect("/Home/Login")); } //token|sid|user_code|player_id|player_name|order_id|channel|type|amount|key var pay_token = collection["pay_token"]; var pay_sid = collection["pay_sid"]; var pay_user_code = collection["pay_user_code"]; //var pay_player_id = collection["pay_player_id"]; //var pay_player_name = collection["pay_player_name"]; var pay_order_id = collection["pay_order_id"]; var pay_channel = collection["pay_channel"]; var pay_type = collection["pay_type"]; var pay_amount = collection["pay_amount"]; var param = string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}", pay_token, pay_sid, pay_user_code, pay_order_id, pay_channel, pay_type, pay_amount); var chk = string.Format("{0}|{1}", param, "15B5EACDB05E66D"); //加密字符 var chksum = UConvert.MD5(chk); //POST api/Common?param={param}&checksum={checksum} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/Common?param={0}&checksum={1}", param, chksum), }; var result = api.PostJsonToParameter(); api.Dispose(); var be = CommonHelper.Deserialize <BaseEntity>(result); ViewBag.Error = be.result; ViewBag.Message = be.message; return(View(user)); }
public JsonResult RealTimeGame(Int32 sid) { //var data = new ChartHome //{ // server = new List<int> { 612, 458, 235, 567 }, // pay = new List<int> { 10, 15, 255, 5405 }, //}; // POST api/Home?token={token}&sid={sid} var api = new ApiReceive() { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/Home?token={0}&sid={1}", user.token, sid), }; var result = api.PostJsonToParameter(); api.Dispose(); var data = CommonHelper.Deserialize <ChartHome>(result); var jsonResult = Json(data, JsonRequestBehavior.AllowGet); return(jsonResult); }
public ActionResult Approval() { if (!IsLogin) { return(Redirect("/Home/Login")); } var api = new ApiReceive { URL = string.Format("{0}", ConfigHelper.GetApiUrl()), Resource = string.Format("api/Resource?token={0}&roleid={1}", user.token, user.id), }; var result1 = api.PostJsonToParameter(); api.Dispose(); var list1 = CommonHelper.Deserialize <List <Resource> >(result1); ViewBag.Resource = list1; var list2 = ApiPlatforms(); ViewBag.Platform = list2; return(View()); }