예제 #1
0
        public async Task <IActionResult> GetTable()
        {
            var UserId = _User.ID;

            if (UserId == 0)
            {
                _logger.LogWarning($"{DateTime.Now} 请求GetTable access_token 无效");
                this.HttpContext.Response.StatusCode = 401;
                return(Ok(new
                {
                    Success = false,
                    Table = new List <object>(),
                    OtherTable = new object(),
                    Msg = "Token无效 Httpcontext 解析失败",
                    StatusCode = this.HttpContext.Response.StatusCode
                }));
            }
            var Role = _User.GetRole();

            var Table = await _ProjectInfoService.GetProjects(Role);

            if (Table == null || Table.Count < 0)
            {
                return(Ok(new
                {
                    Success = false,
                    Table,
                    OtherTable = new object(),
                    this.HttpContext.Response.StatusCode
                }));
            }
            var OtherTable = await _ProjectInfoService.GetOtherProjects(Role);

            return(Ok(new
            {
                Success = true,
                Table,
                OtherTable,
                this.HttpContext.Response.StatusCode
            }));
        }