client_test.go 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package dingtalk
  2. import (
  3. "dashoo.cn/opms_libary/plugin/dingtalk/workflow"
  4. "dashoo.cn/opms_libary/utils"
  5. "fmt"
  6. "testing"
  7. )
  8. func TestQuerySchemaByProcessCode(t *testing.T) {
  9. client := NewClient()
  10. w := client.GetWorkflow()
  11. s, _ := w.QuerySchemaByProcessCode("PROC-7A5F6215-A8CF-4DD1-AB2C-5B1AB84C4E19")
  12. fmt.Println(s)
  13. }
  14. func TestSign(t *testing.T) {
  15. client := NewClient()
  16. s := client.GetJsapi()
  17. //s.Sign("", "")
  18. fmt.Println(s)
  19. }
  20. func TestStartProcessInstance(t *testing.T) {
  21. client := NewClient()
  22. w := client.GetWorkflow()
  23. TextField_1QEXO83G7GDC0 := &workflow.StartProcessInstanceRequestFormComponentValues{
  24. Id: utils.String("TextField_1QEXO83G7GDC0"),
  25. Name: utils.String("客户编码"),
  26. Value: utils.String("CT00001"),
  27. }
  28. TextField_13MDZ97RV16K0 := &workflow.StartProcessInstanceRequestFormComponentValues{
  29. Id: utils.String("TextField_13MDZ97RV16K0"),
  30. Name: utils.String("客户名称"),
  31. Value: utils.String("测试客户"),
  32. }
  33. TextField_1ZY48VZY6WG00 := &workflow.StartProcessInstanceRequestFormComponentValues{
  34. Id: utils.String("TextField_1ZY48VZY6WG00"),
  35. Name: utils.String("申请人"),
  36. Value: utils.String("系统管理员"),
  37. }
  38. TextareaField_5U6VKA6N1VK0 := &workflow.StartProcessInstanceRequestFormComponentValues{
  39. Id: utils.String("TextareaField_5U6VKA6N1VK0"),
  40. Name: utils.String("申请说明"),
  41. Value: utils.String("申请说明"),
  42. }
  43. //DDAttachment_17PC5KQBVEM80 := &workflow.StartProcessInstanceRequestFormComponentValues{
  44. // Id: tea.String("DDAttachment_17PC5KQBVEM80"),
  45. // Name: tea.String("附件"),
  46. // Value: tea.String("123xxxxxxxx"),
  47. //}
  48. startProcessInstanceRequest := &workflow.StartProcessInstanceRequest{
  49. OriginatorUserId: utils.String("47073111989114"),
  50. ProcessCode: utils.String("PROC-FE42B2D1-6097-4DE8-8AC5-23541B7D5C8A"),
  51. DeptId: utils.Int64(435711466),
  52. FormComponentValues: []*workflow.StartProcessInstanceRequestFormComponentValues{TextField_1QEXO83G7GDC0, TextField_13MDZ97RV16K0, TextField_1ZY48VZY6WG00, TextareaField_5U6VKA6N1VK0},
  53. }
  54. //w.StartProcessInstance("47073111989114", "PROC-7A5F6215-A8CF-4DD1-AB2C-5B1AB84C4E19", 435711466) 8xljy04PZiS9iPxp5PhDnUzQiEiE
  55. resp, _ := w.StartProcessInstance(startProcessInstanceRequest)
  56. fmt.Println(resp)
  57. }
  58. func TestQueryUserInfoByPhone(t *testing.T) {
  59. client := NewClient()
  60. c := client.GetContact()
  61. resp1 := c.QueryUserIdByPhone("18653295560")
  62. resp2 := c.QueryUserInfoByUserId(resp1.Result.Userid)
  63. fmt.Println(resp2)
  64. }