| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- 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("<p>经销商:<a href='%s'>%s</a> 的必要信息未填写完整,请及时完善</p>", 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()
- }
|