52 lines
1.1 KiB
Go
52 lines
1.1 KiB
Go
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)
|
|
}
|
|
}
|