-
-
Notifications
You must be signed in to change notification settings - Fork 259
/
delete_sms_log_logic.go
41 lines (34 loc) · 1.04 KB
/
delete_sms_log_logic.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
package smslog
import (
"context"
"github.com/suyuan32/simple-admin-common/i18n"
"github.com/zeromicro/go-zero/core/errorx"
"github.com/suyuan32/simple-admin-core/api/internal/svc"
"github.com/suyuan32/simple-admin-core/api/internal/types"
"github.com/suyuan32/simple-admin-message-center/types/mcms"
"github.com/zeromicro/go-zero/core/logx"
)
type DeleteSmsLogLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewDeleteSmsLogLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteSmsLogLogic {
return &DeleteSmsLogLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *DeleteSmsLogLogic) DeleteSmsLog(req *types.UUIDsReq) (resp *types.BaseMsgResp, err error) {
if !l.svcCtx.Config.McmsRpc.Enabled {
return nil, errorx.NewCodeUnavailableError(i18n.ServiceUnavailable)
}
data, err := l.svcCtx.McmsRpc.DeleteSmsLog(l.ctx, &mcms.UUIDsReq{
Ids: req.Ids,
})
if err != nil {
return nil, err
}
return &types.BaseMsgResp{Msg: l.svcCtx.Trans.Trans(l.ctx, data.Msg)}, nil
}