2025-02-20 08:18:23 +00:00
|
|
|
|
package verifica
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"errors"
|
|
|
|
|
"fmt"
|
|
|
|
|
"github.com/fonchain_enterprise/micro-account/pkg/config"
|
|
|
|
|
"github.com/fonchain_enterprise/utils/mobile"
|
|
|
|
|
)
|
|
|
|
|
|
2025-04-14 06:27:33 +00:00
|
|
|
|
//const SIG_NO = 230001
|
2025-03-26 02:32:55 +00:00
|
|
|
|
|
2025-04-25 07:34:45 +00:00
|
|
|
|
const SIG_NO = 145031
|
2025-02-20 08:18:23 +00:00
|
|
|
|
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
|
2025-03-13 06:30:40 +00:00
|
|
|
|
//if project == "seller" {
|
|
|
|
|
// sigNo = SIG_NO_SELLER
|
|
|
|
|
//}
|
2025-02-20 08:18:23 +00:00
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
}
|