package smsmsg

import (
	"fmt"
	"git.rosy.net.cn/baseapi/utils"
	dyvmsapiclient "github.com/alibabacloud-go/dyvmsapi-20170525-2.0.2/client"
	"github.com/alibabacloud-go/tea/tea"
	"testing"

	"git.rosy.net.cn/jx-callback/globals/api"
	"git.rosy.net.cn/jx-callback/globals/testinit"
)

func init() {
	testinit.Init()
	// api2.Init()
}

func TestSendSMSMsg(t *testing.T) {
	//err := SendVoiceMsg([]string{"18981810340"}, "tts_222871733", map[string]interface{}{
	//	"tel": "18981810340",
	//})
	aa := map[string]interface{}{"tel": "18981810340"}
	request := &dyvmsapiclient.SingleCallByTtsRequest{
		CalledNumber: tea.String("18981810340"),
		TtsCode:      tea.String("tts_222871733"),
		TtsParam:     tea.String(string(utils.MustMarshal(aa))),
	}
	cli, err := api.CreateClientVoice(tea.String("LTAI4FwZN7pp4dACQHoapkZQ"), tea.String("NTegceUFX0FdfMovqCDzqcIKmhcoOu"), "dyvmsapi.aliyuncs.com")
	fmt.Println("err1==", err)
	res, _err := cli.SingleCallByTts(request)
	fmt.Println(_err)
	if *res.Body.Code != "OK" {
		fmt.Println("errr", err)
	}

	if err != nil {
		t.Fatal(err)
	}
}
