/
platform.go
46 lines (40 loc) · 1.14 KB
/
platform.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package service
import (
"context"
"go-common/app/admin/main/vip/model"
"go-common/library/ecode"
"go-common/library/log"
)
// PlatformAll .
func (s *Service) PlatformAll(c context.Context, order string) (res []*model.ConfPlatform, err error) {
if res, err = s.dao.PlatformAll(c, order); err != nil {
return
}
return
}
// PlatformByID .
func (s *Service) PlatformByID(c context.Context, arg *model.ArgID) (dlg *model.ConfPlatform, err error) {
return s.dao.PlatformByID(c, arg.ID)
}
// PlatformSave .
func (s *Service) PlatformSave(c context.Context, arg *model.ConfPlatform) (eff int64, err error) {
return s.dao.PlatformSave(c, arg)
}
// PlatformDel .
func (s *Service) PlatformDel(c context.Context, arg *model.ArgID, operator string) (eff int64, err error) {
pcount, err := s.dao.CountVipPriceConfigByPlat(c, arg.ID)
if err != nil {
return
}
dcount, err := s.dao.CountDialogByPlatID(c, arg.ID)
if err != nil {
return
}
if pcount > 0 || dcount > 0 {
err = ecode.VipPlatformConfDelErr
return
}
eff, err = s.dao.PlatformDel(c, arg.ID, operator)
log.Warn("user(%s) delete dialog(%d) effect row(%d)", operator, arg.ID, eff)
return
}