142 lines
3.6 KiB
Go
142 lines
3.6 KiB
Go
|
package verifica
|
|||
|
|
|||
|
import (
|
|||
|
"errors"
|
|||
|
"fmt"
|
|||
|
"github.com/fonchain_enterprise/micro-account/pkg/config"
|
|||
|
"github.com/fonchain_enterprise/utils/mobile"
|
|||
|
)
|
|||
|
|
|||
|
const SIG_NO = 155123
|
|||
|
const SIG_NO_SELLER = 159789
|
|||
|
|
|||
|
func SendMsg(telNum string, project string) (string, error) {
|
|||
|
|
|||
|
var sigNo uint
|
|||
|
sigNo = SIG_NO
|
|||
|
|
|||
|
if project == "seller" {
|
|||
|
sigNo = SIG_NO_SELLER
|
|||
|
}
|
|||
|
|
|||
|
mobileTemplate := config.GetMobile()
|
|||
|
if telNum == "" {
|
|||
|
return "", errors.New("手机号不合法")
|
|||
|
}
|
|||
|
|
|||
|
code := mobile.RandCode()
|
|||
|
//content := "验证码模板:尊敬的用户,您的验证码为$$,15分钟内有效,请勿泄露。"
|
|||
|
fmt.Println("发送短信请求参数:", telNum, mobile.TMP1, sigNo, code)
|
|||
|
|
|||
|
/**
|
|||
|
TODO
|
|||
|
*/
|
|||
|
/*
|
|||
|
if telNum == "15895559080" {
|
|||
|
dingding.Send(fmt.Sprintf("尊敬的用户,您的验证码为%s,15分钟内有效,请勿泄露。", code))
|
|||
|
return code, nil
|
|||
|
}
|
|||
|
*/
|
|||
|
|
|||
|
fmt.Println("发送短信请求参数:", telNum, mobile.TMP1, sigNo, code)
|
|||
|
return code, mobileTemplate.Send(telNum, mobile.TMP1, sigNo, code)
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
func SendMsgV2(telNum string, project string, tempSignNo uint) (string, error) {
|
|||
|
|
|||
|
var sigNo uint
|
|||
|
sigNo = SIG_NO
|
|||
|
if project == "seller" {
|
|||
|
sigNo = SIG_NO_SELLER
|
|||
|
}
|
|||
|
|
|||
|
mobileTemplate := config.GetMobile()
|
|||
|
//mobileTemplate := config.GetAlMobile()
|
|||
|
if telNum == "" {
|
|||
|
return "", errors.New("手机号不合法")
|
|||
|
}
|
|||
|
|
|||
|
code := mobile.RandCode()
|
|||
|
//content := "验证码模板:尊敬的用户,您的验证码为$$,15分钟内有效,请勿泄露。"
|
|||
|
|
|||
|
/**
|
|||
|
TODO
|
|||
|
*/
|
|||
|
/*
|
|||
|
if telNum == "15895559080" {
|
|||
|
dingding.Send(fmt.Sprintf("尊敬的用户,您的验证码为%s,15分钟内有效,请勿泄露。", code))
|
|||
|
return code, nil
|
|||
|
}
|
|||
|
*/
|
|||
|
|
|||
|
fmt.Println("发送短信请求参数:", telNum, mobile.TMP1, sigNo, code)
|
|||
|
return code, mobileTemplate.Send(telNum, mobile.TMP1, sigNo, code)
|
|||
|
//fmt.Println("发送短信请求参数:", telNum, mobile.Sign, mobile.AlTMP1, code)
|
|||
|
//return code, mobileTemplate.SendAlSms(telNum, mobile.Sign, mobile.AlTMP1, code)
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
func SendCustomMsg(telNum string, url string, m uint) error {
|
|||
|
|
|||
|
var sigNo uint
|
|||
|
sigNo = SIG_NO
|
|||
|
|
|||
|
mobileTemplate := config.GetMobile()
|
|||
|
if telNum == "" {
|
|||
|
return errors.New("手机号不合法")
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
TODO
|
|||
|
if telNum == "15895559080" {
|
|||
|
arr := strings.Split(url, "||")
|
|||
|
if len(arr) <= 1 {
|
|||
|
fmt.Println("解析失败")
|
|||
|
return nil
|
|||
|
}
|
|||
|
if m == 134802 {
|
|||
|
dingding.Send(fmt.Sprintf("尊敬的用户,您的帐号登陆地址(%s)异常,请点击下线该帐号%s", arr[0], arr[1]))
|
|||
|
return nil
|
|||
|
} else if m == 136784 {
|
|||
|
dingding.Send(fmt.Sprintf("尊敬的用户,%s等待您的审批,请点击查看%s", arr[0], arr[1]))
|
|||
|
return nil
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
*/
|
|||
|
|
|||
|
fmt.Println(telNum, m, sigNo, url)
|
|||
|
|
|||
|
return mobileTemplate.Send(telNum, m, sigNo, url)
|
|||
|
}
|
|||
|
|
|||
|
func SendCustomCode(telNum string, templateId uint, sigNo uint) (string, error) {
|
|||
|
|
|||
|
mobileTemplate := config.GetMobile()
|
|||
|
//mobileTemplate := config.GetAlMobile()
|
|||
|
|
|||
|
if telNum == "" {
|
|||
|
return "", errors.New("手机号不合法")
|
|||
|
}
|
|||
|
|
|||
|
code := mobile.RandCode()
|
|||
|
|
|||
|
fmt.Println("发送短信请求参数:", telNum, mobile.TMP1, sigNo, code)
|
|||
|
//fmt.Println("发送短信请求参数:", telNum, mobile.Sign, mobile.AlTMP1, code)
|
|||
|
|
|||
|
return code, mobileTemplate.Send(telNum, templateId, sigNo, code)
|
|||
|
//return code, mobileTemplate.SendAlSms(telNum, mobile.Sign, mobile.AlTMP1, code)
|
|||
|
}
|
|||
|
|
|||
|
func SendCustomSignNoMsg(telNum string, url string, m uint, sigNo uint) error {
|
|||
|
|
|||
|
mobileTemplate := config.GetMobile()
|
|||
|
//mobileTemplate := config.GetAlMobile()
|
|||
|
if telNum == "" {
|
|||
|
return errors.New("手机号不合法")
|
|||
|
}
|
|||
|
return mobileTemplate.Send(telNum, m, sigNo, url)
|
|||
|
//return mobileTemplate.SendAlSms(telNum, mobile.Sign, mobile.AlTMP1, url)
|
|||
|
}
|