package logic import ( "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/svc" "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/types" "bp.jydev.jianyu360.cn/BaseService/biService/rpc/biservice" "context" "github.com/zeromicro/go-zero/core/logx" ) type SendComMailLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewSendComMailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SendComMailLogic { return &SendComMailLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *SendComMailLogic) SendComMail(req *types.SendMailReq) (resp *types.BiResp, err error) { if req.Title == "" { return &types.BiResp{Error_code: -1, Error_msg: "邮件标题不能为空"}, err } if req.Mails == "" { return &types.BiResp{Error_code: -1, Error_msg: "邮件内容不能为空"}, err } if req.Mails == "" { return &types.BiResp{Error_code: -1, Error_msg: "邮箱地址不能为空"}, err } res, err := l.svcCtx.BiServiceRpc.SendCommonMail(l.ctx, &biservice.SendMailReq{ Title: req.Title, Content: req.Content, Mails: req.Mails, }) return &types.BiResp{Error_code: res.ErrorCode, Error_msg: res.ErrorMsg, Data: string(res.Data)}, err }