|
@@ -1,9 +1,11 @@
|
|
|
package jy
|
|
|
|
|
|
import (
|
|
|
+ "app.yhyue.com/moapp/jybase/sms"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
"log"
|
|
|
+ "net/http"
|
|
|
"regexp"
|
|
|
"sort"
|
|
|
"strings"
|
|
@@ -17,7 +19,6 @@ import (
|
|
|
. "app.yhyue.com/moapp/jybase/mongodb"
|
|
|
"app.yhyue.com/moapp/jybase/redis"
|
|
|
qrpc "app.yhyue.com/moapp/jybase/rpc"
|
|
|
- "app.yhyue.com/moapp/jybase/sms"
|
|
|
. "app.yhyue.com/moapp/jypkg/middleground"
|
|
|
"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
|
|
|
)
|
|
@@ -130,17 +131,17 @@ func SendMailIdentCode(to, code string, auth []*mail.GmailAuth) bool {
|
|
|
}
|
|
|
time.Sleep(time.Second * 3)
|
|
|
}
|
|
|
-
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
-func SendSMS(address, mobile string, params ...string) {
|
|
|
- sms.SendSms(address, "01", mobile, params...)
|
|
|
+func SendSMS(r *http.Request, address, mobile string, params ...string) {
|
|
|
+ sms.SendSms(util.GetIp(r), address, "01", mobile, params...)
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
// 发送验证码
|
|
|
// 增加sessionKey字段 更换手机号防止绕过身份校验
|
|
|
-func SendPhoneIdentCode(address, phone string, session *httpsession.Session, sessionKey ...string) bool {
|
|
|
+func SendPhoneIdentCode(r *http.Request, address, phone string, session *httpsession.Session, sessionKey ...string) bool {
|
|
|
sessionKeyFlag := defaultPhoneFlag
|
|
|
if len(sessionKey) > 0 && sessionKey[0] != "" {
|
|
|
sessionKeyFlag = sessionKey[0]
|
|
@@ -158,11 +159,14 @@ func SendPhoneIdentCode(address, phone string, session *httpsession.Session, ses
|
|
|
session.Set(fmt.Sprintf("%sTime", sessionKeyFlag), time.Now().Unix())
|
|
|
//发送短信
|
|
|
log.Println("短信验证码", phone, s_ranNum)
|
|
|
- SendSMS(address, phone, s_ranNum)
|
|
|
+ SendSMS(r, address, phone, s_ranNum)
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
-const defaultPhoneFlag = "identCode"
|
|
|
+const (
|
|
|
+ defaultPhoneFlag = "identCode"
|
|
|
+ ExperienceSign = "EXPERIENCESIGN"
|
|
|
+)
|
|
|
|
|
|
// 短信验证码校验
|
|
|
func CheckPhoneIdent(session *httpsession.Session, code string, sessionKey ...string) string {
|