|
@@ -0,0 +1,45 @@
|
|
|
|
+package logic
|
|
|
|
+
|
|
|
|
+import (
|
|
|
|
+ "app.yhyue.com/moapp/MessageCenter/rpc/messageclient"
|
|
|
|
+ "context"
|
|
|
|
+
|
|
|
|
+ "app.yhyue.com/moapp/MessageCenter/api/internal/svc"
|
|
|
|
+ "app.yhyue.com/moapp/MessageCenter/api/internal/types"
|
|
|
|
+
|
|
|
|
+ "github.com/zeromicro/go-zero/core/logx"
|
|
|
|
+)
|
|
|
|
+
|
|
|
|
+type SendWxTmplMsgLogic struct {
|
|
|
|
+ logx.Logger
|
|
|
|
+ ctx context.Context
|
|
|
|
+ svcCtx *svc.ServiceContext
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func NewSendWxTmplMsgLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SendWxTmplMsgLogic {
|
|
|
|
+ return &SendWxTmplMsgLogic{
|
|
|
|
+ Logger: logx.WithContext(ctx),
|
|
|
|
+ ctx: ctx,
|
|
|
|
+ svcCtx: svcCtx,
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func (l *SendWxTmplMsgLogic) SendWxTmplMsg(req *types.WxTmplMessageReq) (resp *types.WxTmplMessageResponse, err error) {
|
|
|
|
+ res, err := l.svcCtx.MessageCenter.SendWxTmplSystemDefaultMsg(l.ctx, &messageclient.SystemDefaultMsg{
|
|
|
|
+ UserIds: req.UserIds,
|
|
|
|
+ PositionIds: req.PositionIds,
|
|
|
|
+ MessageClass: req.Class,
|
|
|
|
+ Title: req.Title,
|
|
|
|
+ Detail: req.Detail,
|
|
|
|
+ Date: req.Date,
|
|
|
|
+ Url: req.Url,
|
|
|
|
+ })
|
|
|
|
+ if err != nil {
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ return &types.WxTmplMessageResponse{
|
|
|
|
+ Code: 1,
|
|
|
|
+ Total: res.Total,
|
|
|
|
+ Message: res.Message,
|
|
|
|
+ }, nil
|
|
|
|
+}
|