package base import ( "context" "fmt" "testing" model "dashoo.cn/micro/app/model/base" modelWorkflow "dashoo.cn/micro/app/model/workflow" "dashoo.cn/micro/app/service" "dashoo.cn/opms_libary/plugin/dingtalk/message" "github.com/gogf/gf/frame/g" "github.com/smallnest/rpcx/share" ) var testTenant = "default" func fakeCtx(parent context.Context, tenant string) context.Context { ctx := context.WithValue(parent, share.ReqMetaDataKey, map[string]string{ "tenant": tenant, }) return ctx } func TestApprovalProxyCreate(t *testing.T) { ctx := fakeCtx(context.Background(), testTenant) instance := modelWorkflow.PlatWorkflow{} err := g.DB(testTenant).Table("plat_workflow").Where("id = ?", 155).Struct(&instance) if err != nil { panic(err) } err = ApprovalDistToProxy(ctx, &instance, &message.MixMessage{ ProcessType: "finish", // ProcessType: "terminate", Result: "agree", // Result: "refuse", }) if err != nil { panic(err) } } func TestCreateSystemMessage(t *testing.T) { ent := model.BaseDistributor{} ent.DistName = "测试经销商123323223" ent.DistType = "10" ent.Id = 59 // ent.DistName = "测试审批" // ent.DistType = "20" // ent.Id = 38 msg := g.MapStrStr{ "msgTitle": "经销商信息完善提醒", "msgContent": fmt.Sprintf("
经销商:%s 的必要信息未填写完整,请及时完善
", distUrl(ent), ent.DistName), "msgType": "20", "msgStatus": "10", "recvUserIds": "1", "sendType": "10,20,30", } if err := service.CreateSystemMessage(msg); err != nil { t.Errorf("CreateSystemMessage() error = %v", err) } } func TestNotifyToComplete(t *testing.T) { notifyToComplete() }