feat: completed development wecom message
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package wecomrpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"lone-services/pkg/rpcclient"
|
||||
"lone-services/pkg/utils"
|
||||
wecompb "lone-services/rpc/wecom/pb"
|
||||
)
|
||||
|
||||
func getClient(wecomSvcName string) (wecompb.WecomClient, error) {
|
||||
if wecomSvcName == utils.StringEmpty {
|
||||
return nil, fmt.Errorf("services.wecom empty")
|
||||
}
|
||||
cli, err := rpcclient.Get(wecomSvcName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return wecompb.NewWecomClient(cli.Conn()), nil
|
||||
}
|
||||
|
||||
func ensureCtx(ctx context.Context) context.Context {
|
||||
if ctx == nil {
|
||||
return context.Background()
|
||||
}
|
||||
return ctx
|
||||
}
|
||||
Reference in New Issue
Block a user