public BaseItemRes <string> InitDB() { var result = this.manageTolls.InitDB(); var data = result ? "初始化数据库完成" : "初始化数据库失败"; return(BaseItemRes <string> .Ok(data)); }
public BaseItemRes <InitDataInfo> Test() { var userDAL = new UserDAL(); var lstUser = userDAL.AsQueryable().ToList(); var roleDAL = new RoleDAL(); var lstRole = roleDAL.AsQueryable().ToList(); var authorityDAL = new AuthorityDAL(); var lstAuthority = authorityDAL.AsQueryable().ToList(); var roleAuthorityDAL = new RoleAuthorityDAL(); var lstRoleAuthority = roleAuthorityDAL.AsQueryable().ToList(); var userRoleDAL = new UserRoleDAL(); var lstUserRole = userRoleDAL.AsQueryable().ToList(); var initData = new InitDataInfo() { Users = lstUser, Roles = lstRole, Authoritys = lstAuthority, RoleAuthoritys = lstRoleAuthority, UserRoles = lstUserRole }; return(BaseItemRes <InitDataInfo> .Ok(initData)); }
public BaseItemRes <UserInfo> GetUser([FromQuery] GetUserReq req) { var ip = HttpContext.Connection.RemoteIpAddress.ToString(); var userInfo = this.userBLL.GetUser(req); return(BaseItemRes <UserInfo> .Ok(userInfo)); }
public BaseItemRes <UserInfo> GetMyUserInfo() { var req = new GetUserReq(); req.LoginName = this.CurUser.LoginName; var userInfo = this.userBLL.GetUser(req); return(BaseItemRes <UserInfo> .Ok(userInfo)); }
public BaseItemRes <string> Login([FromBody] LoginReq req) { //用户信息 var lstClaim = new List <Claim>(); lstClaim.Add(new Claim(TdbClaimTypes.UID, req.UID)); lstClaim.Add(new Claim(TdbClaimTypes.Name, req.Name)); var tokenHandler = new JwtSecurityTokenHandler(); var tokenDescriptor = new SecurityTokenDescriptor { Subject = new ClaimsIdentity(lstClaim), Expires = DateTime.UtcNow.AddDays(1), SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(Encoding.ASCII.GetBytes("tangdabin20220108")), SecurityAlgorithms.HmacSha256Signature) }; var token = tokenHandler.CreateJwtSecurityToken(tokenDescriptor); var tokenString = tokenHandler.WriteToken(token); return(BaseItemRes <string> .Ok(tokenString)); }
public BaseItemRes <string> CreateDBModels() { this.manageTolls.CreateDBModels(); return(BaseItemRes <string> .Ok("实体类已生成")); }
public BaseItemRes <string> BackupConsulConfig() { var fullFileName = this.manageTolls.BackupConsulConfig(); return(BaseItemRes <string> .Ok(fullFileName)); }
public BaseItemRes <string> RestoreConsulConfig(IFormFile file) { this.manageTolls.RestoreConsulConfig(file); return(BaseItemRes <string> .Ok("还原完成")); }
public BaseItemRes <ConsulConfig> GetConsulConfig() { return(BaseItemRes <ConsulConfig> .Ok(AccConfig.Consul)); }
public BaseItemRes <AppConfig> GetAppConfig() { return(BaseItemRes <AppConfig> .Ok(AccConfig.App)); }
public BaseItemRes <bool> ExistUser([FromQuery] ExistUserReq req) { var exist = this.userBLL.ExistUser(req); return(BaseItemRes <bool> .Ok(exist)); }
/// <summary> /// 成功消息 /// (IsOK=true,MsgID="OK",Msg="成功") /// </summary> /// <param name="data">结果</param> /// <returns></returns> public static BaseItemRes <T> OkItemRes <T>(T data) { var res = BaseItemRes <T> .Ok(data); return(res); }