Golang 网易云信(短信验证码) SDK

释放双眼,带上耳机,听听看~!

完整代码: https://github.com/daniuEvan/go-wysm/blob/master/wysm/wysm_test.go

package wysm

import (
	"fmt"
	"log"
	"testing"
)

func TestSmClient_SendSmCode(t *testing.T) {
	smClient := NewSmClient()
	smClient.SmConfig.Mobile = "接收验证码的手机号"
	smClient.SmConfig.AppKey = "网易云信AppKey"
	smClient.SmConfig.AppSecret = "网易云信AppSecret"
	//获取验证码
	res, err := smClient.SendSmCode()
	if err != nil {
		log.Fatal(err.Error())
	}
	fmt.Println(res)
}

func TestSmClient_VerifySmCode(t *testing.T) {
	smClient := NewSmClient()
	smClient.SmConfig.Mobile = "接收验证码的手机号"
	smClient.SmConfig.AppKey = "网易云信AppKey"
	smClient.SmConfig.AppSecret = "网易云信AppSecret"
	res, err := smClient.VerifySmCode("4128")
	if err != nil {
		log.Fatal(err.Error())
	}
	fmt.Println(res)
}

【转自慕课】https://www.imooc.com

Go

高三的结束

2022-3-3 18:47:04

Go

Go GC如何检测内存对象中是否包含指针

2022-3-3 18:47:30

搜索