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