| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- package ferroalloy
- import (
- "mtp2_if/global/app"
- "mtp2_if/global/e"
- "mtp2_if/logger"
- "mtp2_if/models"
- "net/http"
- "strconv"
- "github.com/gin-gonic/gin"
- )
- // Signin
- // @Summary 用户签到
- // @Produce json
- // @Security ApiKeyAuth
- // @Param jsonBody body models.THJSigninReq true "用户签到请求"
- // @Success 200 {object} models.THJSigninRsp
- // @Failure 500 {object} app.Response
- // @Router /Ferroalloy/Signin [post]
- // @Tags 铁合金
- func Signin(c *gin.Context) {
- a := app.GinUtils{Gin: app.Gin{C: c}}
- m := models.THJSigninReq{}
- a.DoBindReq(&m)
- // 判断Token与UserID是否对应
- userID, exists := c.Get("requserid")
- if !exists || userID != strconv.Itoa(int(m.USERID)) {
- a.Response(http.StatusBadRequest, e.ERROR_OPERATION_FAILED, nil)
- return
- }
- if rsp, err := m.Signin(); err == nil {
- a.Response(http.StatusOK, e.SUCCESS, rsp)
- } else {
- logger.GetLogger().Errorf("insert fail, %v", err)
- a.Response(http.StatusBadRequest, e.ERROR_OPERATION_FAILED, nil)
- }
- }
- // QueryUserScoreLog
- // @Summary 查询我的积分流水
- // @Produce json
- // @Security ApiKeyAuth
- // @Param userid query int true "用户ID"
- // @Param page query int false "页码"
- // @Param pagesize query int false "每页条数"
- // @Success 200 {array} models.GThjuserscorelog
- // @Failure 500 {object} app.Response
- // @Router /Ferroalloy/QueryUserScoreLog [get]
- // @Tags 铁合金
- func QueryUserScoreLog(c *gin.Context) {
- a := app.GinUtils{Gin: app.Gin{C: c}}
- m := models.GThjuserscorelog{}
- a.DoBindReq(&m)
- a.DoGetDataByPage(&m)
- }
|