decentsms

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2019 License: MIT Imports: 8 Imported by: 0

README

Usage

go get -u github.com/DeyiXu/decentsms

Import

import "github.com/DeyiXu/decentsms"

Coding

func init() {
	decentsms.AppCode = ""
}

func main() {
	phone := "13400000000"
	code := decentsms.RandomCode(6)
	param := decentsms.Parameter{
		"code": code,
	}
	if err := decentsms.SendSms(phone, TP180XXXX, param); err != nil {
		logger.Errorf("SendRegisterCode:%s", err)
	}
}
短信模板

const (
	// TP180XXXX 【我惠淘】验证码:#code#,您正在注册会员,请于5分钟内填写,如非本人操作,请忽略本短信,泄露有风险。
	TP180XXXX = "TP180XXXX"
)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// URL 请求URL
	URL = "http://dingxin.market.alicloudapi.com/dx/sendSms"
	// AppCode App Code
	AppCode = ""
	// Timeout ...
	Timeout = time.Second * 3
)

Functions

func RandomCode

func RandomCode(length int) string

RandomCode 生成验证码

func SendSms

func SendSms(phone, tplID string, param Parameter) (err error)

SendSms 发送短信

Types

type Parameter

type Parameter map[string]string

Parameter 参数

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL