// Copyright 2019 github.com. All rights reserved. // Use of this source code is governed by github.com. package impl import ( "context" "smart-thirdparty/impl/v1/alarm" "smart-thirdparty/impl/v1/email" "smart-thirdparty/impl/v1/notify" "smart-thirdparty/impl/v1/vcode" "smart-thirdparty/pb" pb_v1 "smart-thirdparty/pb/v1" "github.com/jaryhe/gopkgs/tasker/rpctasker" "google.golang.org/grpc" ) // 具体实现 type Rcvr struct { } func Register(s *grpc.Server) { pb.RegisterSmartSiteThirdpartyServer(s, &Rcvr{}) } func (c *Rcvr) GetVcode(ctx context.Context, req *pb_v1.GetVcodeRequest) (reply *pb_v1.GetVcodeReply, err error) { t1 := func() error { reply, err = vcode.GetVcode(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } func (c *Rcvr) CheckVcode(ctx context.Context, req *pb_v1.CheckVcodeRequest) (reply *pb_v1.CheckVcodeReply, err error) { t1 := func() error { reply, err = vcode.CheckVcode(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } func (c *Rcvr) SendEmail(ctx context.Context, req *pb_v1.SendEmailRequest) (reply *pb_v1.SendEmailReply, err error) { t1 := func() error { reply, err = email.SendEmail(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 发送告警 func (c *Rcvr) SendAlarm(ctx context.Context, req *pb_v1.SendAlarmRequest) (reply *pb_v1.SendAlarmReply, err error) { t1 := func() error { reply, err = alarm.SendAlarm(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 发送审核通过通知 func (c *Rcvr) SendThroughVerify(ctx context.Context, req *pb_v1.SendThroughVerifyRequest) (reply *pb_v1.SendThroughVerifyReply, err error) { t1 := func() error { reply, err = notify.SendThroughVerify(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) }