|
@@ -41,50 +41,8 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
// var anths = BaseClass.GetRightJson();
|
|
// var anths = BaseClass.GetRightJson();
|
|
|
// obj.Add("AuthsTree", anths); //主token,用于刷新apiToken
|
|
// obj.Add("AuthsTree", anths); //主token,用于刷新apiToken
|
|
|
|
|
|
|
|
- List<RelationData> relationData = new List<RelationData>();
|
|
|
|
|
- List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
|
|
|
|
|
- var Other = new Dictionary<string, object>();
|
|
|
|
|
- int count = 0;
|
|
|
|
|
- List<Dictionary<string, object>> source = SysAdminService.List(relationData, "", out count, 1, 999);
|
|
|
|
|
- foreach (Dictionary<string, object> subdata in source)
|
|
|
|
|
- {
|
|
|
|
|
- Dictionary<string, object> curData = new Dictionary<string, object>();
|
|
|
|
|
- curData.Add("Id", subdata["Id"].ToString()); //Id
|
|
|
|
|
- curData.Add("AdminName", subdata["AdminName"].ToString()); //用户名
|
|
|
|
|
- curData.Add("RealName", subdata["RealName"].ToString()); //名称
|
|
|
|
|
- curData.Add("RoleId", subdata["Role"].ToString()); //角色
|
|
|
|
|
- curData.Add("LastLoginDate", subdata["LastLoginDate"] == null ? "" : DateTime.Parse(subdata["LastLoginDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //最后登录时间
|
|
|
|
|
- dataList.Add(curData);
|
|
|
|
|
- }
|
|
|
|
|
- Other.Add("Count", count); //总数
|
|
|
|
|
-
|
|
|
|
|
- int SysAdminId = 6; //系统用户Id
|
|
|
|
|
- string AdminName = "AHHA"; //用户名
|
|
|
|
|
- string RealName = "ABBA"; //名称
|
|
|
|
|
- string PassWord = "123456"; //密码
|
|
|
|
|
- string RoleId = "1"; //角色
|
|
|
|
|
- var sysAdmin = bsdb.SysAdmin.FirstOrDefault(m => m.Id == SysAdminId) ?? new SysAdmin();
|
|
|
|
|
- if (sysAdmin.Id > 0)
|
|
|
|
|
- {
|
|
|
|
|
- if (!string.IsNullOrEmpty(AdminName))
|
|
|
|
|
- {
|
|
|
|
|
- sysAdmin.AdminName = AdminName;
|
|
|
|
|
- }
|
|
|
|
|
- if (!string.IsNullOrEmpty(RealName))
|
|
|
|
|
- {
|
|
|
|
|
- sysAdmin.RealName = RealName;
|
|
|
|
|
- }
|
|
|
|
|
- if (!string.IsNullOrEmpty(PassWord))
|
|
|
|
|
- {
|
|
|
|
|
- sysAdmin.Password = function.MD5_32(PassWord);
|
|
|
|
|
- }
|
|
|
|
|
- if (!string.IsNullOrEmpty(RoleId) && RoleId != sysAdmin.Role)
|
|
|
|
|
- {
|
|
|
|
|
- sysAdmin.Role = RoleId;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- bsdb.SaveChanges();
|
|
|
|
|
- return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
|
|
|
|
|
|
|
+
|
|
|
|
|
+ return Json(new AppResultJson() { Status = "1", Info = "" });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
#endregion
|