From e5be7a7ed63d4b4e4267057d84b77c4bd3c16781 Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期四, 16 五月 2024 13:09:28 +0800 Subject: [PATCH] 添加订阅修改接口 --- repository/subscribeRepo.go | 25 +++++++++++++++++++++++-- 1 files changed, 23 insertions(+), 2 deletions(-) diff --git a/repository/subscribeRepo.go b/repository/subscribeRepo.go index f5101b6..579129e 100644 --- a/repository/subscribeRepo.go +++ b/repository/subscribeRepo.go @@ -13,7 +13,7 @@ return SubscribeRepository{} } -func (a *SubscribeRepository) CreateSubscribe(fromId string, subscribe *vo.Subscribe) error { +func (s *SubscribeRepository) CreateSubscribe(fromId string, subscribe *vo.Subscribe) error { var sub = models.Subscribe{ Id: subscribe.SubscribeID, Status: subscribe.SubscribeStatus, @@ -31,7 +31,22 @@ return err } -func (a *SubscribeRepository) DeleteSubscribe(id string) error { +func (s *SubscribeRepository) UpdateSubscribe(subscribe *vo.Subscribe) error { + var sub = models.Subscribe{} + err := sub.FindById(subscribe.SubscribeID) + if err != nil { + return err + } + + sub.Status = subscribe.SubscribeStatus + sub.Ext = *subscribe + + service.UpdateTaskProcs(subscribe.SubscribeID, vo.Msg_Type_Update_Subscribe, nil) + + return sub.Save() +} + +func (s *SubscribeRepository) DeleteSubscribe(id string) error { var sub = models.Subscribe{} err := sub.DeleteById(id) if err != nil { @@ -42,3 +57,9 @@ return err } + +func (s *SubscribeRepository) List() ([]models.Subscribe, error) { + var sub models.Subscribe + + return sub.FindAll() +} -- Gitblit v1.8.0