package controllers import ( "github.com/gin-gonic/gin" "lzyd-user-api/common" "lzyd-user-api/models" "lzyd-user-api/services" ) // @tags medal // @Description 获取勋章列表 // @Summary 获取勋章列表 // @Produce json // @Param type query string false "类型:传1" // @Success 200 {string} json "{"code":200,"message":"success","data":{"token":"","customer":{"id":"","code":"","name":""}}}" // @Router /medal/list [get] func GetMedalList(c *gin.Context) { Ctype := c.Query("type") var ( code = common.Success ) if len(Ctype) == 1 { var ( model []models.LzydMedal ) model = services.QueryMedalList(common.DB, Ctype) common.GenResp(c, code, "SUCCESS", model) return } } // @tags medal // @Description 获取用户获得勋章列表 // @Summary 获取用户获得勋章列表 // @Produce json // @Param userId query string false "用户id" // @Success 200 {string} json "{"code":200,"message":"success","data":{"token":"","customer":{"id":"","code":"","name":""}}}" // @Router /medal/userList [get] func GetUserMedalList(c *gin.Context) { userId := c.Query("userId") var ( code = common.Success ) if len(userId) > 1 { var ( model []models.LzydMedalUser ) model = services.QueryUserMedalList(userId) common.GenResp(c, code, "SUCCESS", model) return } }