pusher/biz/service/add.go

28 lines
665 B
Go
Raw Normal View History

2024-05-17 18:02:10 +08:00
package service
import (
"context"
2024-05-20 17:57:25 +08:00
"gitea.timerzz.com/kedaya_haitao/pusher/biz/dal/postgres"
2024-05-17 18:02:10 +08:00
config "gitea.timerzz.com/kedaya_haitao/pusher/kitex_gen/config"
2024-05-20 17:57:25 +08:00
push "gitea.timerzz.com/kedaya_haitao/pusher/kitex_gen/push"
2024-05-17 18:02:10 +08:00
)
type AddService struct {
ctx context.Context
2024-05-20 17:57:25 +08:00
} // NewAddService new AddService
2024-05-17 18:02:10 +08:00
func NewAddService(ctx context.Context) *AddService {
return &AddService{ctx: ctx}
}
// Run create note info
2024-05-20 17:57:25 +08:00
func (s *AddService) Run(req *config.PusherConfig) (resp *push.Resp, err error) {
2024-05-17 18:02:10 +08:00
// Finish your business logic.
2024-05-20 17:57:25 +08:00
resp = push.NewResp()
err = postgres.DB.Create(req).Error
if err != nil {
resp.Code = 100
resp.Msg = err.Error()
}
return
2024-05-17 18:02:10 +08:00
}