package card import ( "github.com/gin-gonic/gin" "go.uber.org/zap" "log-server/global" cardReq "log-server/model/card/request" "log-server/model/common/response" "strconv" ) type IdCardApi struct { } func (a *IdCardApi) GetIdCard(c *gin.Context) { var idCard cardReq.IdCardRequest _ = c.ShouldBind(&idCard) //rows转型为整型 rows, _ := strconv.Atoi(c.Query("rows")) idCard.Rows = rows if idCard.Channel != "tencent" && idCard.Channel != "xmy" && idCard.Channel != "mz" { response.FailWithMessage("请传入正确的渠道", c) return } if idCard.Rows == 0 { idCard.Rows = 1 } if idCard.Flag != "realuser" { idCard.Flag = "" } if idCardList, err := idCardService.GetIdCard(idCard); err != nil{ global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(idCardList, "success", c) } }