feat: completed development wecom message
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package wecomrpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
wecompb "lone-services/rpc/wecom/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type SendMessageJob struct {
|
||||
BizId int
|
||||
BizType uint8
|
||||
Type uint8
|
||||
Action uint8 // 0未用 1通过 2拒绝
|
||||
Reason string
|
||||
Key string
|
||||
}
|
||||
|
||||
func SendMessage(ctx context.Context, wecomSvcName string, job SendMessageJob) {
|
||||
ctx = ensureCtx(ctx)
|
||||
client, err := getClient(wecomSvcName)
|
||||
if err != nil {
|
||||
logx.Errorf("wecomrpc SendMessage get client: %v", err)
|
||||
return
|
||||
}
|
||||
_, err = client.SendMessage(ctx, &wecompb.SendMessageReq{
|
||||
BizId: int64(job.BizId),
|
||||
BizType: uint32(job.BizType),
|
||||
Type: uint32(job.Type),
|
||||
Action: uint32(job.Action),
|
||||
Reason: job.Reason,
|
||||
Key: job.Key,
|
||||
})
|
||||
if err != nil {
|
||||
logx.Errorf("wecomrpc SendMessage: %v", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user