public async Task <ResponseMessage> Update(Models.UserInfo user, [FromBody] UpdatePeriodRequest updatePeriodRequest) { Logger.Trace($"用户{user?.UserName ?? ""}({user?.Id ?? ""})更改赛季信息,请求参数为:\r\n" + (updatePeriodRequest != null ? JsonHelper.ToJson(updatePeriodRequest) : "")); var response = new ResponseMessage(); if (!ModelState.IsValid) { response.Code = ResponseCodeDefines.ArgumentNullError; response.Message = "模型验证失败" + ModelState.GetAllErrors(); Logger.Warn("添加赛季验证失败:\r\n{0}", response.Message ?? ""); return(response); } if (user.IsAdmin == false) { response.Code = ResponseCodeDefines.NotAllow; response.Message = "没有权限"; Logger.Trace("没有权限:\r\n{0}", response.Message ?? ""); return(response); } try { response = await _scorePeriodManager.UapdatePeriod(user, updatePeriodRequest); } catch (Exception e) { response.Code = ResponseCodeDefines.ServiceError; response.Message = e.Message; Logger.Error($"用户{user?.UserName ?? ""}({user?.Id ?? ""})更改赛季,报错:{e.Message}\r\n{e.StackTrace}"); } return(response); }