client_test.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package dingtalk
  2. import (
  3. "fmt"
  4. "testing"
  5. )
  6. func TestQuerySchemaByProcessCode(t *testing.T) {
  7. client := NewClient()
  8. w := client.GetWorkflow()
  9. s, _ := w.QuerySchemaByProcessCode("PROC-7A5F6215-A8CF-4DD1-AB2C-5B1AB84C4E19")
  10. fmt.Println(s)
  11. }
  12. func TestStartProcessInstance(t *testing.T) {
  13. //client := NewClient()
  14. //w := client.GetWorkflow()
  15. ////formComponentValues0Details0Details0 := &workflow.StartProcessInstanceRequestFormComponentValuesDetailsDetails{
  16. //// Id: tea.String("PhoneField_IZI2LP8QF6O0"),
  17. //// BizAlias: tea.String("Phone"),
  18. //// Name: tea.String("PhoneField"),
  19. //// Value: tea.String("123xxxxxxxx"),
  20. //// ExtValue: tea.String("总个数:1"),
  21. //// ComponentType: tea.String("PhoneField"),
  22. ////}
  23. ////formComponentValues0Details0 := &workflow.StartProcessInstanceRequestFormComponentValuesDetails{
  24. //// Id: tea.String("PhoneField_IZI2LP8QF6O0"),
  25. //// BizAlias: tea.String("Phone"),
  26. //// Name: tea.String("PhoneField"),
  27. //// Value: tea.String("123xxxxxxxx"),
  28. //// ExtValue: tea.String("总个数:1"),
  29. //// Details: []*workflow.StartProcessInstanceRequestFormComponentValuesDetailsDetails{formComponentValues0Details0Details0},
  30. ////}
  31. ////表单信息
  32. //TextField_1RC8GZWYGO4G0 := &workflow.StartProcessInstanceRequestFormComponentValues{
  33. // Id: tea.String("TextField_1RC8GZWYGO4G0"),
  34. // Name: tea.String("单行输入框"),
  35. // Value: tea.String("123xxxxxxxx"),
  36. //}
  37. //
  38. //DDAttachment_17PC5KQBVEM80 := &workflow.StartProcessInstanceRequestFormComponentValues{
  39. // Id: tea.String("DDAttachment_17PC5KQBVEM80"),
  40. // Name: tea.String("附件"),
  41. // Value: tea.String("123xxxxxxxx"),
  42. //}
  43. //
  44. //startProcessInstanceRequest := &workflow.StartProcessInstanceRequest{
  45. // OriginatorUserId: tea.String("47073111989114"),
  46. // ProcessCode: tea.String("PROC-7A5F6215-A8CF-4DD1-AB2C-5B1AB84C4E19"),
  47. // DeptId: tea.Int64(435711466),
  48. // FormComponentValues: []*workflow.StartProcessInstanceRequestFormComponentValues{TextField_1RC8GZWYGO4G0, DDAttachment_17PC5KQBVEM80},
  49. //}
  50. ////w.StartProcessInstance("47073111989114", "PROC-7A5F6215-A8CF-4DD1-AB2C-5B1AB84C4E19", 435711466) 8xljy04PZiS9iPxp5PhDnUzQiEiE
  51. //resp, _ := w.StartProcessInstance(startProcessInstanceRequest)
  52. //fmt.Println(resp)
  53. }
  54. func TestQueryUserInfoByPhone(t *testing.T) {
  55. client := NewClient()
  56. c := client.GetContact()
  57. resp1 := c.QueryUserIdByPhone("18653295560")
  58. resp2 := c.QueryUserInfoByUserId(resp1.Result.Userid)
  59. fmt.Println(resp2)
  60. }