enterprise/server/service/qyweixin_approve_test.go

40 lines
1022 B
Go
Raw Normal View History

2023-08-13 21:24:54 +08:00
package service
import (
"enterprise/common/weixin"
"fmt"
log "github.com/sirupsen/logrus"
"testing"
)
func TestApprove_Reply(t *testing.T) {
approveClient := weixin.NewQyWeixinApprove("ww43c49db2e88a17f8", "xJOClC5V2pPon1azgrAzf5kq1TB72xZ3ScR7O5G3lQo", "3010040")
fmt.Println("1")
detail, err := approveClient.GetDetail("202308130004")
fmt.Println("1")
if err != nil {
log.Errorf("error:%s", err.Error())
}
fmt.Println("1")
for _, content := range detail.ApplyData.Contents {
var value string
if content.Control == "Selector" {
value = content.Value.Selector.Options[0].Value[0].Text
} else if content.Control == "Text" || content.Control == "Textarea" {
value = content.Value.Text
} else if content.Control == "Date" {
value = content.Value.Date.Timestamp
} else if content.Control == "Money" {
value = content.Value.NewMoney
} else if content.Control == "File" {
value = content.Value.Files[0].FileId
}
fmt.Println(content.Title[0].Text, value)
}
fmt.Println("2")
}