package batch_msg import ( "context" "wechat-api/hook/aliyun" "wechat-api/internal/svc" "wechat-api/internal/types" "github.com/zeromicro/go-zero/core/logx" ) type SendBatchMsgTextLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewSendBatchMsgTextLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SendBatchMsgTextLogic { return &SendBatchMsgTextLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} } func (l *SendBatchMsgTextLogic) SendBatchMsgText(req *types.SendMsgReq) (*types.BaseMsgResp, error) { resp := types.BaseMsgResp{} result, err := aliyun.SendChatappMessage("template", *req.TemplateCode, *req.Lang, *req.Phone, *req.To) l.Logger.Infof("send chatapp message result=%v\n", result) if err != nil { resp.Code = 1 resp.Msg = err.Error() } else { resp.Msg = *result.Body.Code } return &resp, nil }