39 lines
909 B
Go
39 lines
909 B
Go
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), //门店ID或产品ID
|
|
BizType: uint32(job.BizType), //产品,门店 表示
|
|
Type: uint32(job.Type), //wecomrpc.ProductSubmitReview,
|
|
Action: uint32(job.Action), // 0未用 1通过 2拒绝
|
|
Reason: job.Reason,
|
|
Key: job.Key,
|
|
})
|
|
if err != nil {
|
|
logx.Errorf("wecomrpc SendMessage: %v", err)
|
|
}
|
|
}
|