|
|
@@ -32,11 +32,12 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
/// 根据条件查询广告位列表
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- public IActionResult Index(Advertisment data, string right)
|
|
|
+ public IActionResult Index(Advertisment data, string right, string CurColId)
|
|
|
{
|
|
|
ViewBag.RightInfo = RightInfo;
|
|
|
ViewBag.right = right;
|
|
|
ViewBag.SysUserName = SysUserName;
|
|
|
+ ViewBag.CurColId = CurColId;
|
|
|
|
|
|
string Condition = "";
|
|
|
Condition += "Title:\"" + data.Title + "\",";
|
|
|
@@ -58,17 +59,22 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
/// 广告位列表
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- public JsonResult IndexData(Advertisment data, int page = 1, int limit = 30)
|
|
|
+ public JsonResult IndexData(Advertisment data, string CurColId, int page = 1, int limit = 30)
|
|
|
{
|
|
|
- Dictionary<string, string> ColDic = new DictionaryClass().getColDic("003");
|
|
|
+ Dictionary<string, string> ColDic = new DictionaryClass().getColDic(CurColId);
|
|
|
|
|
|
Dictionary<string, string> Fields = new Dictionary<string, string>();
|
|
|
Fields.Add("Title", "2"); //标题
|
|
|
- Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).IndexData("Advertisment", Fields, "Id desc", "False", page, limit);
|
|
|
+ string condition = " and ColId like '" + CurColId + "%'";
|
|
|
+ // Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).IndexData("Advertisment", Fields, "Id desc", "False", page, limit);
|
|
|
+ Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).IndexData("Advertisment", Fields, "Id desc", "False", page, limit, condition);
|
|
|
List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
|
|
|
foreach (Dictionary<string, object> dic in diclist)
|
|
|
{
|
|
|
dic["ColId"] = new DictionaryClass().getDictionaryNameByKey(ColDic, dic["ColId"].ToString());
|
|
|
+ int Status = int.Parse(dic["Status"].ToString());
|
|
|
+ if (Status == 0) dic["StatusName"] = "已下架";
|
|
|
+ if (Status == 1) dic["StatusName"] = "已上架";
|
|
|
}
|
|
|
return Json(obj);
|
|
|
}
|
|
|
@@ -81,11 +87,12 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
/// 增加或修改广告位信息
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- public IActionResult Add()
|
|
|
+ public IActionResult Add(string right, string CurColId)
|
|
|
{
|
|
|
ViewBag.RightInfo = RightInfo;
|
|
|
ViewBag.right = _accessor.HttpContext.Request.Query["right"];
|
|
|
ViewBag.SysUserName = SysUserName;
|
|
|
+ ViewBag.CurColId = CurColId;
|
|
|
|
|
|
return View();
|
|
|
}
|
|
|
@@ -99,7 +106,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
- public string Add(Advertisment data)
|
|
|
+ public string Add(Advertisment data, string CurColId = "")
|
|
|
{
|
|
|
Dictionary<string, object> Fields = new Dictionary<string, object>();
|
|
|
Fields.Add("Title", data.Title); //标题
|
|
|
@@ -114,8 +121,6 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
AddSysLog(data.Id.ToString(), "Advertisment", "add");
|
|
|
bsdb.SaveChanges();
|
|
|
|
|
|
- SetRedis(data.ColId, Id);
|
|
|
-
|
|
|
return "success";
|
|
|
}
|
|
|
|
|
|
@@ -127,11 +132,12 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
/// 增加或修改广告位信息
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- public IActionResult Edit(int Id = 0)
|
|
|
+ public IActionResult Edit(string right, string CurColId, int Id = 0)
|
|
|
{
|
|
|
ViewBag.RightInfo = RightInfo;
|
|
|
ViewBag.right = _accessor.HttpContext.Request.Query["right"];
|
|
|
ViewBag.SysUserName = SysUserName;
|
|
|
+ ViewBag.CurColId = CurColId;
|
|
|
|
|
|
Advertisment editData = bsdb.Advertisment.FirstOrDefault(m => m.Id == Id) ?? new Advertisment();
|
|
|
ViewBag.data = editData;
|
|
|
@@ -147,7 +153,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
- public string Edit(Advertisment data)
|
|
|
+ public string Edit(Advertisment data, string CurColId = "")
|
|
|
{
|
|
|
Dictionary<string, object> Fields = new Dictionary<string, object>();
|
|
|
Fields.Add("Title", data.Title); //标题
|
|
|
@@ -161,8 +167,6 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
AddSysLog(data.Id.ToString(), "Advertisment", "update");
|
|
|
bsdb.SaveChanges();
|
|
|
|
|
|
- SetRedis(data.ColId, data.Id);
|
|
|
-
|
|
|
return "success";
|
|
|
}
|
|
|
|
|
|
@@ -183,12 +187,11 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
int id = int.Parse(subid);
|
|
|
string ColId = "";
|
|
|
Advertisment ad = bsdb.Advertisment.FirstOrDefault(m => m.Id == id);
|
|
|
- if(ad != null)
|
|
|
+ if (ad != null)
|
|
|
{
|
|
|
ColId = ad.ColId;
|
|
|
}
|
|
|
new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Delete("Advertisment", id);
|
|
|
- SetRedis(ColId);
|
|
|
}
|
|
|
bsdb.SaveChanges();
|
|
|
|
|
|
@@ -254,10 +257,6 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
|
|
|
AddSysLog(Id.ToString(), "Advertisment", "sort");
|
|
|
Advertisment ad = bsdb.Advertisment.FirstOrDefault(m => m.Id == Id);
|
|
|
- if(ad != null)
|
|
|
- {
|
|
|
- SetRedis(ad.ColId);
|
|
|
- }
|
|
|
return "success";
|
|
|
}
|
|
|
#endregion
|
|
|
@@ -333,4 +332,4 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
|
|
|
#endregion
|
|
|
}
|
|
|
-}
|
|
|
+}
|