|
|
@@ -0,0 +1,153 @@
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using Microsoft.AspNetCore.Mvc;
|
|
|
+using Microsoft.AspNetCore.Http;
|
|
|
+using Microsoft.Extensions.Logging;
|
|
|
+using Microsoft.Extensions.Options;
|
|
|
+using Microsoft.AspNetCore.Authorization;
|
|
|
+using System.Web;
|
|
|
+using MySystem.Models.Bs;
|
|
|
+using MySystem.Service.Bs;
|
|
|
+using LitJson;
|
|
|
+using Library;
|
|
|
+
|
|
|
+namespace MySystem.Areas.Api.Controllers.v1.Bs
|
|
|
+{
|
|
|
+ [Area("Api")]
|
|
|
+ [Route("/v1/QrCodePlateMain/[controller]/[action]")]
|
|
|
+ public class PageInfoController : BaseController
|
|
|
+ {
|
|
|
+ public PageInfoController(IHttpContextAccessor accessor) : base(accessor)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ #region 系统管理-协议管理-列表
|
|
|
+ [Authorize]
|
|
|
+ public JsonResult AgreementInfoList(string value)
|
|
|
+ {
|
|
|
+ value = PublicFunction.DesDecrypt(value); ;
|
|
|
+ JsonData data = JsonMapper.ToObject(value);
|
|
|
+ Dictionary<string, object> Other = new Dictionary<string, object>();
|
|
|
+ List<Dictionary<string, object>> dataList = AgreementInfoListDo(value, out Other);
|
|
|
+ return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
|
|
|
+ }
|
|
|
+ private List<Dictionary<string, object>> AgreementInfoListDo(string value, out Dictionary<string, object> Other)
|
|
|
+ {
|
|
|
+ JsonData data = JsonMapper.ToObject(value);
|
|
|
+ string Title = data["Title"].ToString(); //标题
|
|
|
+ int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
|
|
|
+ int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
|
|
|
+ string condition = "";
|
|
|
+ List<RelationData> relationData = new List<RelationData>();
|
|
|
+ Other = new Dictionary<string, object>();
|
|
|
+ int count = 0;
|
|
|
+ List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
|
|
|
+ List<Dictionary<string, object>> source = PageInfoService.List(relationData, condition, out count, pageNum, pageSize);
|
|
|
+ foreach (Dictionary<string, object> subdata in source)
|
|
|
+ {
|
|
|
+ Dictionary<string, object> curData = new Dictionary<string, object>();
|
|
|
+ curData.Add("Id", int.Parse(subdata["Id"].ToString())); //记录Id
|
|
|
+ curData.Add("Title", subdata["Title"].ToString()); //标题
|
|
|
+ curData.Add("Contents", subdata["Contents"].ToString()); //内容
|
|
|
+ dataList.Add(curData);
|
|
|
+ }
|
|
|
+ Other.Add("Count", count); //总数
|
|
|
+ return dataList;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
+ #region 系统管理-协议管理-添加
|
|
|
+ [Authorize]
|
|
|
+ public JsonResult AddAgreementInfo(string value)
|
|
|
+ {
|
|
|
+ value = PublicFunction.DesDecrypt(value); ;
|
|
|
+ JsonData data = JsonMapper.ToObject(value);
|
|
|
+ AppResultJson result = AddAgreementInfoDo(value);
|
|
|
+ return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
|
|
|
+ }
|
|
|
+ private AppResultJson AddAgreementInfoDo(string value)
|
|
|
+ {
|
|
|
+ JsonData data = JsonMapper.ToObject(value);
|
|
|
+ string Title = data["Title"].ToString(); //标题
|
|
|
+ string Contents = data["Contents"].ToString(); //内容
|
|
|
+ Dictionary<string, object> Obj = new Dictionary<string, object>();
|
|
|
+ Dictionary<string, object> fields = new Dictionary<string, object>();
|
|
|
+ var sys = SysAdminService.Query(AppConfig.LoginSession.sysId);
|
|
|
+ fields.Add("CreateMan", sys.AdminName + "_" + sys.RealName); //操作人
|
|
|
+ fields.Add("Title", Title); //标题
|
|
|
+ fields.Add("Contents", Contents); //内容
|
|
|
+ var Id = int.Parse(PageInfoService.Add(fields).Data.ToString());
|
|
|
+ if (Id > 0)
|
|
|
+ {
|
|
|
+ return new AppResultJson() { Status = "1", Info = "成功", Data = Id };
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return new AppResultJson() { Status = "-1", Info = "失败", Data = Id };
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
+ #region 系统管理-协议管理-编辑
|
|
|
+ [Authorize]
|
|
|
+ public JsonResult EditAgreementInfo(string value)
|
|
|
+ {
|
|
|
+ value = PublicFunction.DesDecrypt(value); ;
|
|
|
+ JsonData data = JsonMapper.ToObject(value);
|
|
|
+ AppResultJson result = EditAgreementInfoDo(value);
|
|
|
+ return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
|
|
|
+ }
|
|
|
+ private AppResultJson EditAgreementInfoDo(string value)
|
|
|
+ {
|
|
|
+ JsonData data = JsonMapper.ToObject(value);
|
|
|
+ int Id = int.Parse(function.CheckInt(data["Id"].ToString())); //记录Id
|
|
|
+ string Title = data["Title"].ToString(); //标题
|
|
|
+ string Contents = data["Contents"].ToString(); //内容
|
|
|
+ Dictionary<string, object> Obj = new Dictionary<string, object>();
|
|
|
+ var pageInfo = bsdb.PageInfo.FirstOrDefault(m => m.Id == Id) ?? new PageInfo();
|
|
|
+ if (pageInfo.Id > 0)
|
|
|
+ {
|
|
|
+ var sys = SysAdminService.Query(AppConfig.LoginSession.sysId);
|
|
|
+ pageInfo.UpdateMan = sys.AdminName + "_" + sys.RealName;
|
|
|
+ if (!string.IsNullOrEmpty(Title))
|
|
|
+ {
|
|
|
+ pageInfo.Title = Title;
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(Contents))
|
|
|
+ {
|
|
|
+ pageInfo.Contents = Contents;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ bsdb.SaveChanges();
|
|
|
+
|
|
|
+ return new AppResultJson() { Status = "1", Info = "", Data = Obj };
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
+ #region 系统管理-协议管理-删除
|
|
|
+ [Authorize]
|
|
|
+ public JsonResult DeleteAgreementInfo(string value)
|
|
|
+ {
|
|
|
+ value = PublicFunction.DesDecrypt(value); ;
|
|
|
+ JsonData data = JsonMapper.ToObject(value);
|
|
|
+ AppResultJson result = DeleteAgreementInfoDo(value);
|
|
|
+ return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
|
|
|
+ }
|
|
|
+ private AppResultJson DeleteAgreementInfoDo(string value)
|
|
|
+ {
|
|
|
+ JsonData data = JsonMapper.ToObject(value);
|
|
|
+ int Id = int.Parse(function.CheckInt(data["Id"].ToString())); //记录Id
|
|
|
+ Dictionary<string, object> Obj = new Dictionary<string, object>();
|
|
|
+ PageInfoService.Delete(Id);
|
|
|
+
|
|
|
+ return new AppResultJson() { Status = "1", Info = "", Data = Obj };
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ }
|
|
|
+}
|