package controllers import ( "github.com/gin-gonic/gin" "lzyd-user-api/common" "lzyd-user-api/models" "lzyd-user-api/services" ) // @tags cert // @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 /cert/list [get] func GetCertList(c *gin.Context) { Ctype := c.Query("type") var ( code = common.Success ) if len(Ctype) == 1 { var ( model []models.LzydCert ) model = services.QueryCertList(common.DB, Ctype) common.GenResp(c, code, "SUCCESS", model) return } } // @tags cert // @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 /cert/userList [get] func GetUserCertList(c *gin.Context) { userId := c.Query("userId") var ( code = common.Success ) if len(userId) > 1 { var ( model []models.LzydCertUser ) model = services.QueryUserCertList(userId) common.GenResp(c, code, "SUCCESS", model) return } }