feat: completed development wecom message
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package wecomrpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"lone-services/pkg/utils"
|
||||
wecompb "lone-services/rpc/wecom/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ReviewChange struct {
|
||||
Type uint8 // 业务类型:1产品 2门店 3地址
|
||||
BizId int64
|
||||
TaskId string
|
||||
BeforeData string // JSON,空则写 null
|
||||
AfterData string // JSON,空则写 null
|
||||
AdminId int64
|
||||
AdminName string
|
||||
}
|
||||
|
||||
func CreateReviewChange(ctx context.Context, wecomSvcName string, change ReviewChange) {
|
||||
ctx = ensureCtx(ctx)
|
||||
client, err := getClient(wecomSvcName)
|
||||
if err != nil {
|
||||
logx.Errorf("wecomrpc CreateReviewChange get client: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
before := change.BeforeData
|
||||
after := change.AfterData
|
||||
if before == utils.StringEmpty {
|
||||
before = "null"
|
||||
}
|
||||
if after == utils.StringEmpty {
|
||||
after = "null"
|
||||
}
|
||||
|
||||
_, err = client.CreateReviewChange(ctx, &wecompb.CreateReviewChangeReq{
|
||||
Type: uint32(change.Type),
|
||||
BizId: change.BizId,
|
||||
TaskId: change.TaskId,
|
||||
BeforeData: before,
|
||||
AfterData: after,
|
||||
AdminId: change.AdminId,
|
||||
AdminName: change.AdminName,
|
||||
})
|
||||
if err != nil {
|
||||
logx.Errorf("wecomrpc CreateReviewChange: %v", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user