123456789101112131415161718192021222324252627282930313233 |
- package services
- import (
- "fmt"
- "github.com/jinzhu/gorm"
- "lzyd-user-api/common"
- "lzyd-user-api/models"
- )
- /**
- 获取所有证书
- */
- func QueryMedalList(db *gorm.DB, cType string) []models.LzydMedal {
- var medal []models.LzydMedal
- //sql := `SELECT id FROM lzyd_cert`
- err := db.Find(&medal).Error
- if err != nil {
- //fmt.Println(111)
- fmt.Println(err.Error())
- }
- //fmt.Println("你获取的是:", province)
- return medal
- }
- /**
- 获取所有用户获得的证书
- */
- func QueryUserMedalList(userId string) []models.LzydMedalUser {
- //func QueryUserCertList(userId string) []models.LzydCertUser {
- var userMedal []models.LzydMedalUser
- sql := `SELECT * FROM lzyd_cert_user WHERE user_id = ?`
- common.DB.Raw(sql, userId).Find(&userMedal)
- return userMedal
- }
|