[ADD]错误日志

This commit is contained in:
virus 2019-11-27 14:31:12 +08:00
parent 1a672bf2c7
commit 48f65ae84d
21 changed files with 87 additions and 3 deletions

View File

@ -26,12 +26,14 @@ func PushArea(c echo.Context) error {
// 参数验证
swagArea := new(SwagArea)
if err := c.Bind(swagArea); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
}
return c.JSON(http.StatusBadRequest, errMessage)
}
c.Logger().Info(swagArea)
// 入库处理(已经有的更新,没有的创建数据)
if findArea, findErr := area.FindAreaByRwID(swagArea.Data.RwID); findErr == nil {

View File

@ -26,12 +26,14 @@ func PushCourse(c echo.Context) error {
// 参数验证
swagCourse := new(SwagCourse)
if err := c.Bind(swagCourse); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
}
return c.JSON(http.StatusBadRequest, errMessage)
}
c.Logger().Info(swagCourse)
// 入库处理(已经有的更新,没有的创建数据)
if findCourse, findErr := course.FindCourseByRwID(swagCourse.Data.RwID); findErr == nil {
@ -44,6 +46,7 @@ func PushCourse(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(updateErr)
errMessage := map[string]interface{}{
"code": e.UpdateCourseError,
"message": e.GetMsg(e.UpdateCourseError),
@ -60,6 +63,7 @@ func PushCourse(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(createErr)
errMessage := map[string]interface{}{
"code": e.CreateCourseError,
"message": e.GetMsg(e.CreateCourseError),

View File

@ -32,6 +32,7 @@ func PushEquipment(c echo.Context) error {
}
return c.JSON(http.StatusBadRequest, errMessage)
}
c.Logger().Info(swagEquipment)
// 入库处理(已经有的更新,没有的创建数据)
if findEquipment, findErr := equipment.FindEquipmentByRwID(swagEquipment.Data.RwID); findErr == nil {
@ -44,6 +45,7 @@ func PushEquipment(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(updateErr)
errMessage := map[string]interface{}{
"code": e.UpdateEquipmentError,
"message": e.GetMsg(e.UpdateEquipmentError),
@ -60,6 +62,7 @@ func PushEquipment(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(createErr)
errMessage := map[string]interface{}{
"code": e.CreateEquipmentError,
"message": e.GetMsg(e.CreateEquipmentError),

View File

@ -32,6 +32,7 @@ func PushLeague(c echo.Context) error {
}
return c.JSON(http.StatusBadRequest, errMessage)
}
c.Logger().Info(swagLeague)
// 入库处理(已经有的更新,没有的创建数据)
if findLeague, findErr := league.FindLeagueByRwID(swagLeague.Data.RwID); findErr == nil {
@ -44,6 +45,7 @@ func PushLeague(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(updateErr)
errMessage := map[string]interface{}{
"code": e.UpdateLeagueError,
"message": e.GetMsg(e.UpdateLeagueError),
@ -60,6 +62,7 @@ func PushLeague(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(createErr)
errMessage := map[string]interface{}{
"code": e.CreateLeagueError,
"message": e.GetMsg(e.CreateLeagueError),

View File

@ -42,12 +42,14 @@ func PushNotify(c echo.Context) error {
// 参数验证
swagNotify := new(SwagNotify)
if err := c.Bind(swagNotify); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
}
return c.JSON(http.StatusBadRequest, errMessage)
}
c.Logger().Info(swagNotify)
message := map[string]interface{}{
"code": e.SUCCESS,

View File

@ -26,12 +26,14 @@ func PushRole(c echo.Context) error {
// 参数验证
swagRole := new(SwagRole)
if err := c.Bind(swagRole); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
}
return c.JSON(http.StatusBadRequest, errMessage)
}
c.Logger().Info(swagRole)
// 入库处理(已经有的更新,没有的创建数据)
if findRole, findErr := role.FindRoleByRwID(swagRole.Data.RwID); findErr == nil {
@ -44,6 +46,7 @@ func PushRole(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(updateErr)
errMessage := map[string]interface{}{
"code": e.UpdateRoleError,
"message": e.GetMsg(e.UpdateRoleError),
@ -60,6 +63,7 @@ func PushRole(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(createErr)
errMessage := map[string]interface{}{
"code": e.CreateRoleError,
"message": e.GetMsg(e.CreateRoleError),

View File

@ -26,12 +26,14 @@ func PushSeries(c echo.Context) error {
// 参数验证
swagSeries := new(SwagSeries)
if err := c.Bind(swagSeries); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
}
return c.JSON(http.StatusBadRequest, errMessage)
}
c.Logger().Info(swagSeries)
// 入库处理(已经有的更新,没有的创建数据)
if findSeries, findErr := series.FindSeriesByRwID(swagSeries.Data.RwID); findErr == nil {
@ -44,6 +46,7 @@ func PushSeries(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(updateErr)
errMessage := map[string]interface{}{
"code": e.UpdateSeriesError,
"message": e.GetMsg(e.UpdateSeriesError),
@ -60,6 +63,7 @@ func PushSeries(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(createErr)
errMessage := map[string]interface{}{
"code": e.CreateSeriesError,
"message": e.GetMsg(e.CreateSeriesError),

View File

@ -32,6 +32,7 @@ func PushSkill(c echo.Context) error {
}
return c.JSON(http.StatusBadRequest, errMessage)
}
c.Logger().Info(swagSkill)
// 入库处理(已经有的更新,没有的创建数据)
if findSkill, findErr := skill.FindSkillByRwID(swagSkill.Data.RwID); findErr == nil {
@ -44,6 +45,7 @@ func PushSkill(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(updateErr)
errMessage := map[string]interface{}{
"code": e.UpdateSkillError,
"message": e.GetMsg(e.UpdateSkillError),
@ -60,6 +62,7 @@ func PushSkill(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(createErr)
errMessage := map[string]interface{}{
"code": e.CreateSkillError,
"message": e.GetMsg(e.CreateSkillError),

View File

@ -32,6 +32,7 @@ func PushTeam(c echo.Context) error {
}
return c.JSON(http.StatusBadRequest, errMessage)
}
c.Logger().Info(swagTeam)
// 入库处理(已经有的更新,没有的创建数据)
if findTeam, findErr := team.FindTeamByRwID(swagTeam.Data.RwID); findErr == nil {
@ -44,6 +45,7 @@ func PushTeam(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(updateErr)
errMessage := map[string]interface{}{
"code": e.UpdateTeamError,
"message": e.GetMsg(e.UpdateTeamError),
@ -60,6 +62,7 @@ func PushTeam(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(createErr)
errMessage := map[string]interface{}{
"code": e.CreateTeamError,
"message": e.GetMsg(e.CreateTeamError),

View File

@ -26,12 +26,14 @@ func PushEvent(c echo.Context) error {
// 参数验证
swagEvent := new(SwagEvent)
if err := c.Bind(swagEvent); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
}
return c.JSON(http.StatusBadRequest, errMessage)
}
c.Logger().Info(swagEvent)
// 入库处理(已经有端更新,没有的创建数据)
if findEvent, findErr := event.FindEventByRwID(swagEvent.Data.RwID); findErr == nil {
@ -44,6 +46,7 @@ func PushEvent(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(updateErr)
errMessage := map[string]interface{}{
"code": e.UpdateEventError,
"message": e.GetMsg(e.UpdateEventError),
@ -60,6 +63,7 @@ func PushEvent(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(createErr)
errMessage := map[string]interface{}{
"code": e.CreateEventError,
"message": e.GetMsg(e.CreateEventError),

View File

@ -27,15 +27,18 @@ func PushMatch(c echo.Context) error {
// 参数验证
swagMatch := new(SwagMatch)
if err := c.Bind(swagMatch); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
}
return c.JSON(http.StatusBadRequest, errMessage)
}
c.Logger().Info(swagMatch)
var pushMatch match.Match
if err := json.Unmarshal([]byte(swagMatch.Data), &pushMatch); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
@ -54,6 +57,7 @@ func PushMatch(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(updateErr)
errMessage := map[string]interface{}{
"code": e.UpdateMatchError,
"message": e.GetMsg(e.UpdateMatchError),
@ -70,6 +74,7 @@ func PushMatch(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(createErr)
errMessage := map[string]interface{}{
"code": e.CreateMatchError,
"message": e.GetMsg(e.CreateMatchError),

View File

@ -32,17 +32,20 @@ type Result struct {
// @Router /notify/aov/result [POST]
func PushResult(c echo.Context) error {
// 参数验证
SwagResult := new(SwagResult)
if err := c.Bind(SwagResult); err != nil {
swagResult := new(SwagResult)
if err := c.Bind(swagResult); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
}
return c.JSON(http.StatusBadRequest, errMessage)
}
c.Logger().Info(swagResult)
var pushMatch match.Match
if err := json.Unmarshal([]byte(SwagResult.Data.MatchJson), &pushMatch); err != nil {
if err := json.Unmarshal([]byte(swagResult.Data.MatchJson), &pushMatch); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
@ -61,6 +64,7 @@ func PushResult(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(updateErr)
errMessage := map[string]interface{}{
"code": e.UpdateMatchError,
"message": e.GetMsg(e.UpdateMatchError),
@ -77,6 +81,7 @@ func PushResult(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(createErr)
errMessage := map[string]interface{}{
"code": e.CreateMatchError,
"message": e.GetMsg(e.CreateMatchError),

View File

@ -26,12 +26,14 @@ func PushEvent(c echo.Context) error {
// 参数验证
swagEvent := new(SwagEvent)
if err := c.Bind(swagEvent); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
}
return c.JSON(http.StatusBadRequest, errMessage)
}
c.Logger().Info(swagEvent)
// 入库处理(已经有端更新,没有的创建数据)
if findEvent, findErr := event.FindEventByRwID(swagEvent.Data.RwID); findErr == nil {
@ -44,6 +46,7 @@ func PushEvent(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(updateErr)
errMessage := map[string]interface{}{
"code": e.UpdateEventError,
"message": e.GetMsg(e.UpdateEventError),
@ -60,6 +63,7 @@ func PushEvent(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(createErr)
errMessage := map[string]interface{}{
"code": e.CreateEventError,
"message": e.GetMsg(e.CreateEventError),

View File

@ -27,15 +27,18 @@ func PushMatch(c echo.Context) error {
// 参数验证
swagMatch := new(SwagMatch)
if err := c.Bind(swagMatch); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
}
return c.JSON(http.StatusBadRequest, errMessage)
}
c.Logger().Info(swagMatch)
var pushMatch match.Match
if err := json.Unmarshal([]byte(swagMatch.Data), &pushMatch); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
@ -54,6 +57,7 @@ func PushMatch(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(updateErr)
errMessage := map[string]interface{}{
"code": e.UpdateMatchError,
"message": e.GetMsg(e.UpdateMatchError),
@ -70,6 +74,7 @@ func PushMatch(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(createErr)
errMessage := map[string]interface{}{
"code": e.CreateMatchError,
"message": e.GetMsg(e.CreateMatchError),

View File

@ -34,15 +34,18 @@ func PushResult(c echo.Context) error {
// 参数验证
swagResult := new(SwagResult)
if err := c.Bind(swagResult); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
}
return c.JSON(http.StatusBadRequest, errMessage)
}
c.Logger().Info(swagResult)
var pushMatch match.Match
if err := json.Unmarshal([]byte(swagResult.Data.MatchJson), &pushMatch); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
@ -61,6 +64,7 @@ func PushResult(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(updateErr)
errMessage := map[string]interface{}{
"code": e.UpdateMatchError,
"message": e.GetMsg(e.UpdateMatchError),
@ -77,6 +81,7 @@ func PushResult(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(createErr)
errMessage := map[string]interface{}{
"code": e.CreateMatchError,
"message": e.GetMsg(e.CreateMatchError),

View File

@ -27,15 +27,18 @@ func PushMatch(c echo.Context) error {
// 参数验证
swagMatch := new(SwagMatch)
if err := c.Bind(swagMatch); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
}
return c.JSON(http.StatusBadRequest, errMessage)
}
c.Logger().Info(swagMatch)
var pushMatch match.Match
if err := json.Unmarshal([]byte(swagMatch.Data), &pushMatch); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
@ -54,6 +57,7 @@ func PushMatch(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(updateErr)
errMessage := map[string]interface{}{
"code": e.UpdateMatchError,
"message": e.GetMsg(e.UpdateMatchError),
@ -70,6 +74,7 @@ func PushMatch(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(createErr)
errMessage := map[string]interface{}{
"code": e.CreateMatchError,
"message": e.GetMsg(e.CreateMatchError),

View File

@ -34,15 +34,18 @@ func PushResult(c echo.Context) error {
// 参数验证
swagResult := new(SwagResult)
if err := c.Bind(swagResult); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
}
return c.JSON(http.StatusBadRequest, errMessage)
}
c.Logger().Info(swagResult)
var pushMatch match.Match
if err := json.Unmarshal([]byte(swagResult.Data.MatchJson), &pushMatch); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
@ -61,6 +64,7 @@ func PushResult(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(updateErr)
errMessage := map[string]interface{}{
"code": e.UpdateMatchError,
"message": e.GetMsg(e.UpdateMatchError),
@ -77,6 +81,7 @@ func PushResult(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(createErr)
errMessage := map[string]interface{}{
"code": e.CreateMatchError,
"message": e.GetMsg(e.CreateMatchError),

View File

@ -26,12 +26,14 @@ func PushEvent(c echo.Context) error {
// 参数验证
swagEvent := new(SwagEvent)
if err := c.Bind(swagEvent); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
}
return c.JSON(http.StatusBadRequest, errMessage)
}
c.Logger().Info(swagEvent)
// 入库处理(已经有的更新,没有的创建数据)
if findEvent, findErr := event.FindEventByRwID(swagEvent.Data.RwID); findErr == nil {
@ -44,6 +46,7 @@ func PushEvent(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(updateErr)
errMessage := map[string]interface{}{
"code": e.UpdateEventError,
"message": e.GetMsg(e.UpdateEventError),
@ -60,6 +63,7 @@ func PushEvent(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(createErr)
errMessage := map[string]interface{}{
"code": e.CreateEventError,
"message": e.GetMsg(e.CreateEventError),

View File

@ -27,14 +27,18 @@ func PushMatch(c echo.Context) error {
// 参数验证
swagMatch := new(SwagMatch)
if err := c.Bind(swagMatch); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
}
return c.JSON(http.StatusBadRequest, errMessage)
}
c.Logger().Info(swagMatch)
var pushMatch match.Match
if err := json.Unmarshal([]byte(swagMatch.Data), &pushMatch); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
@ -53,6 +57,7 @@ func PushMatch(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(updateErr)
errMessage := map[string]interface{}{
"code": e.UpdateMatchError,
"message": e.GetMsg(e.UpdateMatchError),
@ -69,6 +74,7 @@ func PushMatch(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(createErr)
errMessage := map[string]interface{}{
"code": e.CreateMatchError,
"message": e.GetMsg(e.CreateMatchError),

View File

@ -34,14 +34,18 @@ func PushResult(c echo.Context) error {
// 参数验证
swagResult := new(SwagResult)
if err := c.Bind(swagResult); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
}
return c.JSON(http.StatusBadRequest, errMessage)
}
c.Logger().Info(swagResult)
var pushMatch match.Match
if err := json.Unmarshal([]byte(swagResult.Data.MatchJson), &pushMatch); err != nil {
c.Logger().Error(err)
errMessage := map[string]interface{}{
"code": e.InvalidParams,
"message": e.GetMsg(e.InvalidParams),
@ -60,6 +64,7 @@ func PushResult(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(updateErr)
errMessage := map[string]interface{}{
"code": e.UpdateMatchError,
"message": e.GetMsg(e.UpdateMatchError),
@ -76,6 +81,7 @@ func PushResult(c echo.Context) error {
}
return c.JSON(http.StatusOK, message)
} else {
c.Logger().Error(createErr)
errMessage := map[string]interface{}{
"code": e.CreateMatchError,
"message": e.GetMsg(e.CreateMatchError),

View File

@ -0,0 +1,2 @@
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main . &&
scp -r main deployer@118.31.23.131:/home/deployer/esports/sheep