pusher/biz/service/push.go
timerzz 4ec0cd1564
Some checks failed
Build image / build (push) Failing after 4m48s
feat 测试
2024-05-20 17:57:25 +08:00

31 lines
684 B
Go

package service
import (
"context"
"fmt"
push "gitea.timerzz.com/kedaya_haitao/pusher/kitex_gen/push"
"gitea.timerzz.com/kedaya_haitao/pusher/pushers"
)
type PushService struct {
ctx context.Context
} // NewPushService new PushService
func NewPushService(ctx context.Context) *PushService {
return &PushService{ctx: ctx}
}
// Run create note info
func (s *PushService) Run(req *push.PushReq) (resp *push.Resp, err error) {
// Finish your business logic.
if len(req.Ids) == 0 {
return nil, fmt.Errorf("缺少id")
}
resp = push.NewResp()
err = pushers.Push(s.ctx, req.Ids, req.Title, req.Content)
if err != nil {
resp.Code = 100
resp.Msg = err.Error()
}
return
}