package dingtalk import ( "dashoo.cn/opms_libary/plugin/dingtalk/workflow" "dashoo.cn/opms_libary/utils" "encoding/json" "fmt" "github.com/gogf/gf/util/gconv" "testing" ) func TestQuerySchemaByProcessCode(t *testing.T) { client := NewClient() w := client.GetWorkflow() s, _ := w.QuerySchemaByProcessCode("PROC-E5A8B695-A6AF-49CF-9909-9A31C33A1211") fmt.Println(gconv.String(s)) } func TestSign(t *testing.T) { //client := NewClient() //s := client.GetStorage() //resp, _ := s.QueryFileUploadInfo("21042518430", "fHJtftdpHZXwvsdOfg8skgiEiE") //code, _ := s.UploadFile(resp.HeaderSignatureInfo.ResourceUrls[0], resp.HeaderSignatureInfo.Headers, "/Users/chengjian/Downloads/引物导入模板.xlsx") //if code == 200 { // s.CommitFile(resp.UploadKey, "引物导入模板-1.xlsx", "21042518430", "0", "fHJtftdpHZXwvsdOfg8skgiEiE") //} // //fmt.Println(resp) } func TestCommitFile(t *testing.T) { client := NewClient() s := client.GetStorage() resp, err := s.UploadFile("21042518430", "8xljy04PZiS9iPxp5PhDnUzQiEiE", "引物导入模板-000000.xlsx", "/Users/chengjian/Downloads/引物导入模板.xlsx") fmt.Println(json.Marshal(resp)) fmt.Println(err.Error()) } func TestStartProcessInstance(t *testing.T) { client := NewClient() w := client.GetWorkflow() TextField_1QEXO83G7GDC0 := &workflow.StartProcessInstanceRequestFormComponentValues{ Id: utils.String("TextField_1QEXO83G7GDC0"), Name: utils.String("客户编码"), Value: utils.String("CT00001"), } TextField_13MDZ97RV16K0 := &workflow.StartProcessInstanceRequestFormComponentValues{ Id: utils.String("TextField_13MDZ97RV16K0"), Name: utils.String("客户名称"), Value: utils.String("测试客户"), } TextField_1ZY48VZY6WG00 := &workflow.StartProcessInstanceRequestFormComponentValues{ Id: utils.String("TextField_1ZY48VZY6WG00"), Name: utils.String("申请人"), Value: utils.String("系统管理员"), } TextareaField_5U6VKA6N1VK0 := &workflow.StartProcessInstanceRequestFormComponentValues{ Id: utils.String("TextareaField_5U6VKA6N1VK0"), Name: utils.String("申请说明"), Value: utils.String("申请说明"), } //DDAttachment_17PC5KQBVEM80 := &workflow.StartProcessInstanceRequestFormComponentValues{ // Id: tea.String("DDAttachment_17PC5KQBVEM80"), // Name: tea.String("附件"), // Value: tea.String("123xxxxxxxx"), //} startProcessInstanceRequest := &workflow.StartProcessInstanceRequest{ OriginatorUserId: utils.String("47073111989114"), ProcessCode: utils.String("PROC-FE42B2D1-6097-4DE8-8AC5-23541B7D5C8A"), DeptId: utils.Int64(435711466), FormComponentValues: []*workflow.StartProcessInstanceRequestFormComponentValues{TextField_1QEXO83G7GDC0, TextField_13MDZ97RV16K0, TextField_1ZY48VZY6WG00, TextareaField_5U6VKA6N1VK0}, } //w.StartProcessInstance("47073111989114", "PROC-7A5F6215-A8CF-4DD1-AB2C-5B1AB84C4E19", 435711466) 8xljy04PZiS9iPxp5PhDnUzQiEiE resp, _ := w.StartProcessInstance(startProcessInstanceRequest) fmt.Println(resp) } func TestQueryUserInfoByPhone(t *testing.T) { client := NewClient() c := client.GetContact() resp1 := c.QueryUserIdByPhone("18653295560") resp2 := c.QueryUserInfoByUserId(resp1.Result.Userid) fmt.Println(resp2) }