Ejemplo n.º 1
0
        public async Task <IActionResult> WriteTable([FromBody] WriteModel model)
        {
            model.UserId = _User.ID;
            if (model.UserId == 0)
            {
                _logger.LogWarning($"{DateTime.Now} 请求WriteTable access_token 无效");
                this.HttpContext.Response.StatusCode = 401;
                return(Ok(new
                {
                    Success = false,
                    Msg = "Token无效 Httpcontext 解析失败",
                    this.HttpContext.Response.StatusCode
                }));
            }
            model.Role = _User.GetRole();
            var result = await _ProjectInfoService.WriteTableData(model);

            _logger.LogInformation($"IP: {_User.GetClientIP()} 用户名:{_User.Name} ID:{_User.ID}  成功写入了数据");
            return(Ok(new
            {
                Success = result,
                Msg = result == true ? "写入成功" : "写入失败",
                this.HttpContext.Response.StatusCode
            }));
        }