mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-28 08:26:36 +08:00
[SSL证书]实现对ACME任务的增删改查
This commit is contained in:
@@ -269,49 +269,3 @@ func (this *SSLCertDAO) ListCertIds(isCA bool, isAvailable bool, isExpired bool,
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// 计算所有某个管理员/用户下所有的ACME用户生成的证书数量
|
||||
func (this *SSLCertDAO) CountAllSSLCertsWithACME(adminId int64, userId int64) (int64, error) {
|
||||
query := this.Query()
|
||||
if adminId > 0 {
|
||||
query.Attr("adminId", adminId)
|
||||
}
|
||||
if userId > 0 {
|
||||
query.Attr("userId", userId)
|
||||
}
|
||||
return query.
|
||||
State(SSLCertStateEnabled).
|
||||
Where("acmeUserId>0").
|
||||
Count()
|
||||
}
|
||||
|
||||
// 列出某个管理员/用户下所有的ACME用户生成的证书Ids
|
||||
func (this *SSLCertDAO) ListSSLCertIdsWithACME(adminId int64, userId int64, offset int64, size int64) (certIds []int64, err error) {
|
||||
query := this.Query()
|
||||
if adminId > 0 {
|
||||
query.Attr("adminId", adminId)
|
||||
}
|
||||
if userId > 0 {
|
||||
query.Attr("userId", userId)
|
||||
}
|
||||
ones, err := query.
|
||||
ResultPk().
|
||||
State(SSLCertStateEnabled).
|
||||
Where("acmeUserId>0").
|
||||
Offset(offset).
|
||||
Limit(size).
|
||||
DescPk().
|
||||
FindAll()
|
||||
for _, one := range ones {
|
||||
certIds = append(certIds, int64(one.(*SSLCert).Id))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 计算某个ACME用户生成的证书数量
|
||||
func (this *SSLCertDAO) CountSSLCertsWithACMEUserId(acmeUserId int64) (int64, error) {
|
||||
return this.Query().
|
||||
State(SSLCertStateEnabled).
|
||||
Attr("acmeUserId", acmeUserId).
|
||||
Count()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user