Giter Club home page Giter Club logo

go-sdk's Introduction

未来无线 GO SDK

  • 下载安装SDK go get github.com/wlwx/go-sdk

  • 代码示例

package main

import (
	"fmt"
	"github.com/wlwx/go-sdk/sms"
)

func main() {
	custom_name := "用户名称"
	custom_pwd := "用户密码"

	sms_client := sms.NewSmsClient("请求路径", custom_name, custom_pwd)

	// 发送普通短信(业务标识uid选填)
	req := &sms.SmsReq{
		Content:     "Go SDK 测试",
		DestMobiles: "232210369999",
		Uid:         "1",
		NeedReport:  true,
		SpCode:      "10690353",
		MsgFmt:      sms.SmsMsgUCS2,
	}
	resp, err := sms_client.SendMsg(req)

	// 发送变量短信
	req := &sms.SmsVeriantInput{
		Content: "${mobile}用户您好,今天{$var1}的天气,晴,温度${var2}度,事宜外出。",
		Uid:     "1",
		Params: []*sms.MobileVars{
			&sms.MobileVars{
				Mobile: "232210369999",
				Vars:   []string{"232210369999", "阴天", "11"},
			},
			&sms.MobileVars{
				Mobile: "232210369999",
				Vars:   []string{"232210369999", "阴天", "11"},
			},
		},
		NeedReport: true,
		SpCode:     "sp code",
		MsgFmt:     sms.SmsMsgUCS2,
	}
	resp, err := sms_client.SendVariantMsg(req)

	// 获取Token
	resp, err := sms_client.GetToken()

	// 获取用户上行
	resp, err := sms_client.GetMO()

	// 获取状态报告
	resp, err := sms_client.GetReport()

	// 获取账户余额
	resp, err := sms_client.QueryAccount()

	if err != nil {
		fmt.Printf("Error:%s\n", err.Error())
	} else {
		fmt.Printf("Resp:%v\n", resp)
	}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.