Exemplo n.º 1
0
Arquivo: in.go Projeto: rainsight/test
func main() {
	var accessTokenServer = mp.NewDefaultAccessTokenServer("wx8dd685b36012ecb6", "8660ab2e951c442658467f2d0f2da440", nil)
	var mpClient = mp.NewClient(accessTokenServer, nil)
	var ticketServer = jssdk.NewDefaultTicketServer(mpClient)

	for i := 0; i < 2; i++ {
		ticket, err := ticketServer.Ticket()
		fmt.Println("ticket:", ticket, err)
	}

	for i := 0; i < 2; i++ {
		ticket, err := ticketServer.TicketRefresh()
		fmt.Println("ticket refresh:", ticket, err)
	}
}
Exemplo n.º 2
0
func (this *WelcomeController) Get() {
	var AccessTokenServer = mp.NewDefaultAccessTokenServer("wxa2dc73d6e114eb30", "a058552dcb7da6dc4c0f646eecf3a92a", nil)
	var mpClient = mp.NewClient(AccessTokenServer, nil)
	var TicketServer = jssdk.NewDefaultTicketServer(mpClient)
	tick, err := TicketServer.Ticket()
    TicketServer.
	if err != nil {
		beego.Error(err)
	}
	this.Ctx.WriteString(tick)
    jssdk.WXConfigSign(tick, nonceStr, timestamp, url)
	// name := this.GetString("name")
	// if IsChineseName(name) {
	// 	this.Ctx.WriteString(name + "is")
	// } else {
	// 	this.Ctx.WriteString(name + "no")
	// }
}