feat: 添加 CDK 查询功能
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
26
modules/config/controller/robot/cdk.go
Normal file
26
modules/config/controller/robot/cdk.go
Normal 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"))
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user