feat: 添加 CDK 查询功能
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-03-23 22:59:29 +08:00
committed by cnb
parent e6d28b017b
commit 8ee19aa66f
3 changed files with 34 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
package robot
import (
"blazing/modules/config/service"
"strings"
"time"
zero "github.com/wdvxdr1123/ZeroBot"
)
func init() {
zero.OnCommand("CDK").
Handle(func(ctx *zero.Ctx) {
var cdks []string
for _, v := range service.NewCdkService().All() {
if v.ValidEndTime.After(time.Now()) {
cdks = append(cdks, v.CDKCode)
}
}
ctx.Send(strings.Join(cdks, "\n"))
})
}

View File

@@ -44,6 +44,13 @@ func (s *CdkService) Get(id string) *model.CDKConfig {
return item
}
func (s *CdkService) All() []model.CDKConfig {
var item []model.CDKConfig
dbm_notenable(s.Model).WhereLT("exchange_remain_count", 0).Scan(&item)
return item
}
func (s *CdkService) Set(id string) bool {