Browse Source

用户证书

master
huangjiajun 1 day ago
parent
commit
1a6913ffbb
2 changed files with 5 additions and 5 deletions
  1. +1
    -1
      src/dao/user_certificate_dao.go
  2. +4
    -4
      src/implement/user_certificate_implement.go

+ 1
- 1
src/dao/user_certificate_dao.go View File

@@ -3,7 +3,7 @@ package dao
import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"


type UserCertificateDao interface { type UserCertificateDao interface {
FindUserCertificate(page, limit, uid string) (*[]model.UserCertificate, error)
FindUserCertificate(page, limit, uid string) (*[]model.UserCertificate, int64, error)
GetUserCertificateByNo(no string) (*model.UserCertificate, error) GetUserCertificateByNo(no string) (*model.UserCertificate, error)
GetUserCertificateById(id string) (*model.UserCertificate, error) GetUserCertificateById(id string) (*model.UserCertificate, error)
} }

+ 4
- 4
src/implement/user_certificate_implement.go View File

@@ -17,18 +17,18 @@ type UserCertificateDb struct {
Db *xorm.Engine Db *xorm.Engine
} }


func (u UserCertificateDb) FindUserCertificate(page, limit, uid string) (*[]model.UserCertificate, error) {
func (u UserCertificateDb) FindUserCertificate(page, limit, uid string) (*[]model.UserCertificate, int64, error) {
var m []model.UserCertificate var m []model.UserCertificate
sess := u.Db.Where("1=1") sess := u.Db.Where("1=1")
if uid != "" { if uid != "" {
sess.In("uid", strings.Split(uid, ",")) sess.In("uid", strings.Split(uid, ","))
} }
start := (zhios_order_relate_utils.StrToInt(page) - 1) * zhios_order_relate_utils.StrToInt(limit) start := (zhios_order_relate_utils.StrToInt(page) - 1) * zhios_order_relate_utils.StrToInt(limit)
err := sess.Limit(zhios_order_relate_utils.StrToInt(limit), start).OrderBy("id desc").Find(&m)
total, err := sess.Limit(zhios_order_relate_utils.StrToInt(limit), start).OrderBy("id desc").FindAndCount(&m)
if err != nil { if err != nil {
return nil, zhios_order_relate_logx.Error(err)
return nil, 0, zhios_order_relate_logx.Error(err)
} }
return &m, nil
return &m, total, nil
} }


func (u UserCertificateDb) GetUserCertificateByNo(no string) (m *model.UserCertificate, err error) { func (u UserCertificateDb) GetUserCertificateByNo(no string) (m *model.UserCertificate, err error) {


Loading…
Cancel
Save