sms

package module
v0.0.0-...-2eac9f5 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2016 License: Apache-2.0 Imports: 20 Imported by: 0

README

sms-go

Build Status Go Walker

Installation

安装sms-go使用"go get"命令:

go get github.com/aiwuTech/sms

Update

更新sms-go使用"go get -u"命令

go get -u github.com/aiwuTech/sms

API

请参考Go Walker

FAQ

如果使用过程中遇到任何问题,希望主动与aiwuTech团队联系,也可提交Issues,我们会及时解决

License

sms基于 Apache License, Version 2.0.

Documentation

Overview

Copyright 2014 mit.zhao.chiu@gmail.com

Licensed under the Apache License, Version 2.0 (the "License"): you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2015 mit.zhao.chiu@gmail.com

Licensed under the Apache License, Version 2.0 (the "License"): you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2015 mint.zhao.chiu@gmail.com

Licensed under the Apache License, Version 2.0 (the "License"): you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2015 mint.zhao.chiu@gmail.com

Licensed under the Apache License, Version 2.0 (the "License"): you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	Tpl_YP_1 int64 = iota + 1
	Tpl_YP_2
	Tpl_YP_3
	Tpl_YP_4
	Tpl_YP_5
	Tpl_YP_6
	Tpl_YP_7
	Tpl_YP_8
	Tpl_YP_9
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SendSMSRequest

type SendSMSRequest struct {
	AppId      string   `json:"appId"`
	To         string   `json:"to"`
	TemplateId string   `json:"templateId"`
	Datas      []string `json:"datas"`
}

type SendSMSResponse

type SendSMSResponse struct {
	StatusCode string `json:"statusCode"`
	StatusMsg  string `json:"statusMsg"`
}

type SmsManager

type SmsManager struct {
	// contains filtered or unexported fields
}

func NewDefaultSmsManager

func NewDefaultSmsManager(company string, service SmsServicer) *SmsManager

默认短信manager

func NewSmsManager

func NewSmsManager(len int, expire time.Duration, store cache.Cache, service SmsServicer, cLen int, company string) *SmsManager

新建短信manager

func (*SmsManager) Code

func (s *SmsManager) Code(tel string) (string, error)

sms code

func (*SmsManager) GetCompany

func (s *SmsManager) GetCompany() string

func (*SmsManager) GetService

func (s *SmsManager) GetService() SmsServicer

func (*SmsManager) SendSMS

func (s *SmsManager) SendSMS(text string, mobiles []string)

文字短信

func (*SmsManager) SendSMS_tpl

func (s *SmsManager) SendSMS_tpl(tplid int64, mobiles []string, arg ...string)

模版短信

func (*SmsManager) Verify

func (s *SmsManager) Verify(tel, code string) (success bool)

varify sms code

type SmsResult

type SmsResult struct {
	Count uint   `json:"count"` //成功发送的短信个数
	Fee   uint   `json:"fee"`   //扣费条数,70个字一条,超出70个字时按每67字一条计
	Sid   uint64 `json:"sid"`   ///短信id;群发时以该id+手机号尾号后8位作为短信id
}

type SmsServicer

type SmsServicer interface {
	GetUserInfo() (*SmsUser, error)
	SendSMS(string, []string) (*SmsResult, error)
	SendSMS_Tpl(int64, []string, []string) (*SmsResult, error)
}

type SmsUser

type SmsUser struct {
	Nick             string `json:"nick"`
	Created          string `json:"gmt_created"`
	Mobile           string `json:"mobile"`
	Email            string `json:"email"`
	IpWhites         string `json:"ip_whitelist"`
	ApiVersion       string `json:"api_version"`
	Balance          uint64 `json:"balance"`
	AlarmBalance     uint64 `json:"alarm_balance"`
	EmergencyContact string `json:"emergency_contact"`
	EmergencyMobile  string `json:"emergency_mobile"`
}

type YunPianService

type YunPianService struct {
	ApiKey string
}

func NewYunPian

func NewYunPian(apikey string) *YunPianService

* * 新建云片服务

func (*YunPianService) GetUserInfo

func (y *YunPianService) GetUserInfo() (*SmsUser, error)

* * 取账户信息

func (*YunPianService) SendSMS

func (y *YunPianService) SendSMS(text string, mobiles []string) (*SmsResult, error)

* * 发短信

func (*YunPianService) SendSMS_Tpl

func (y *YunPianService) SendSMS_Tpl(tplid int64, mobiles []string, args []string) (*SmsResult, error)

* * 通过模版发送短信

type YuntongxunService

type YuntongxunService struct {
	// contains filtered or unexported fields
}

func NewYuntongxun

func NewYuntongxun(account, token, appId string) *YuntongxunService

func (*YuntongxunService) GetUserInfo

func (this *YuntongxunService) GetUserInfo() (*SmsUser, error)

func (*YuntongxunService) SendSMS

func (this *YuntongxunService) SendSMS(string, []string) (*SmsResult, error)

func (*YuntongxunService) SendSMS_Tpl

func (this *YuntongxunService) SendSMS_Tpl(templateId int64, tos []string, args []string) (*SmsResult, error)

Jump to

Keyboard shortcuts

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