score.go 786 B

123456789101112131415161718192021222324252627282930313233
  1. package ferroalloy
  2. import (
  3. "mtp2_if/global/app"
  4. "mtp2_if/global/e"
  5. "mtp2_if/logger"
  6. "mtp2_if/models"
  7. "net/http"
  8. "github.com/gin-gonic/gin"
  9. )
  10. // Signin
  11. // @Summary 用户签到
  12. // @Produce json
  13. // @Security ApiKeyAuth
  14. // @Param jsonBody body models.THJSigninReq true "用户签到请求"
  15. // @Success 200 {object} app.Response
  16. // @Failure 500 {object} app.Response
  17. // @Router /Ferroalloy/Signin [post]
  18. // @Tags 铁合金
  19. func Signin(c *gin.Context) {
  20. a := app.GinUtils{Gin: app.Gin{C: c}}
  21. m := models.THJSigninReq{}
  22. a.DoBindReq(&m)
  23. if err := m.Signin(); err == nil {
  24. a.Response(http.StatusOK, e.SUCCESS, "OK")
  25. } else {
  26. logger.GetLogger().Errorf("insert fail, %v", err)
  27. a.Response(http.StatusBadRequest, e.ERROR_OPERATION_FAILED, nil)
  28. }
  29. }