Эх сурвалжийг харах

Merge branch 'dev2.6' into release

lianbingjie 5 жил өмнө
parent
commit
1bdcfc34cf

+ 4 - 0
common/src/github.com/ziutek/blas/common.go

@@ -11,3 +11,7 @@ const (
 	NoTrans = Transpose(111)
 	Trans   = Transpose(112)
 )
+
+func panicIndex() {
+	panic("index out of range")
+}

+ 1 - 1
common/src/github.com/ziutek/blas/dasum_amd64.s

@@ -114,5 +114,5 @@ end:
 	RET
 
 panic:
-	CALL	runtime·panicindex(SB)
+	CALL	·panicIndex(SB)
 	RET

+ 1 - 1
common/src/github.com/ziutek/blas/daxpy_amd64.s

@@ -297,6 +297,6 @@ rest_diff:
 	RET
 
 panic:
-	CALL	runtime·panicindex(SB)
+	CALL	·panicIndex(SB)
 end:
 	RET

+ 1 - 1
common/src/github.com/ziutek/blas/dcopy_amd64.s

@@ -47,5 +47,5 @@ end:
 	RET
 
 panic:
-	CALL	runtime·panicindex(SB)
+	CALL	·panicIndex(SB)
 	RET

+ 1 - 1
common/src/github.com/ziutek/blas/ddot_amd64.s

@@ -132,5 +132,5 @@ end:
 	RET
 
 panic:
-	CALL	runtime·panicindex(SB)
+	CALL	·panicIndex(SB)
 	RET

+ 1 - 1
common/src/github.com/ziutek/blas/dnrm2_amd64.s

@@ -111,5 +111,5 @@ end:
 	RET
 
 panic:
-	CALL	runtime·panicindex(SB)
+	CALL	·panicIndex(SB)
 	RET

+ 1 - 1
common/src/github.com/ziutek/blas/drot_amd64.s

@@ -127,5 +127,5 @@ end:
 	RET
 
 panic:
-	CALL	runtime·panicindex(SB)
+	CALL	·panicIndex(SB)
 	RET

+ 1 - 1
common/src/github.com/ziutek/blas/dscal_amd64.s

@@ -102,5 +102,5 @@ end:
 	RET
 
 panic:
-	CALL	runtime·panicindex(SB)
+	CALL	·panicIndex(SB)
 	RET

+ 1 - 1
common/src/github.com/ziutek/blas/dswap_amd64.s

@@ -127,5 +127,5 @@ end:
 	RET
 
 panic:
-	CALL	runtime·panicindex(SB)
+	CALL	·panicIndex(SB)
 	RET

+ 1 - 1
common/src/github.com/ziutek/blas/idamax_amd64.s

@@ -54,5 +54,5 @@ end:
 	RET
 
 panic:
-	CALL	runtime·panicindex(SB)
+	CALL	·panicIndex(SB)
 	RET

+ 1 - 1
common/src/github.com/ziutek/blas/isamax_amd64.s

@@ -54,5 +54,5 @@ end:
 	RET
 
 panic:
-	CALL	runtime·panicindex(SB)
+	CALL	·panicIndex(SB)
 	RET

+ 1 - 1
common/src/github.com/ziutek/blas/sasum_amd64.s

@@ -120,5 +120,5 @@ end:
 	RET
 
 panic:
-	CALL	runtime·panicindex(SB)
+	CALL	·panicIndex(SB)
 	RET

+ 1 - 1
common/src/github.com/ziutek/blas/saxpy_amd64.s

@@ -285,6 +285,6 @@ rest_diff:
 	RET
 
 panic:
-	CALL	runtime·panicindex(SB)
+	CALL	·panicIndex(SB)
 end:
 	RET

+ 1 - 1
common/src/github.com/ziutek/blas/scopy_amd64.s

@@ -47,5 +47,5 @@ end:
 	RET
 
 panic:
-	CALL	runtime·panicindex(SB)
+	CALL	·panicIndex(SB)
 	RET

+ 1 - 1
common/src/github.com/ziutek/blas/sdot_amd64.s

@@ -139,5 +139,5 @@ end:
 	RET
 
 panic:
-	CALL	runtime·panicindex(SB)
+	CALL	·panicIndex(SB)
 	RET

+ 1 - 1
common/src/github.com/ziutek/blas/sdsdot_amd64.s

@@ -164,5 +164,5 @@ end:
 	RET
 
 panic:
-	CALL	runtime·panicindex(SB)
+	CALL	·panicIndex(SB)
 	RET

+ 1 - 1
common/src/github.com/ziutek/blas/snrm2_amd64.s

@@ -117,5 +117,5 @@ end:
 	RET
 
 panic:
-	CALL	runtime·panicindex(SB)
+	CALL	·panicIndex(SB)
 	RET

+ 1 - 1
common/src/github.com/ziutek/blas/srot_amd64.s

@@ -179,5 +179,5 @@ end:
 	RET
 
 panic:
-	CALL	runtime·panicindex(SB)
+	CALL	·panicIndex(SB)
 	RET

+ 1 - 1
common/src/github.com/ziutek/blas/sscal_amd64.s

@@ -114,5 +114,5 @@ end:
 	RET
 
 panic:
-	CALL	runtime·panicindex(SB)
+	CALL	·panicIndex(SB)
 	RET

+ 1 - 1
common/src/github.com/ziutek/blas/sswap_amd64.s

@@ -120,5 +120,5 @@ end:
 	RET
 
 panic:
-	CALL	runtime·panicindex(SB)
+	CALL	·panicIndex(SB)
 	RET

+ 66 - 0
common/src/qfw/util/jy/checksendmsg.go

@@ -0,0 +1,66 @@
+package jy
+
+import (
+	"fmt"
+	"log"
+	"net/url"
+	"qfw/util"
+	"qfw/util/redis"
+
+	//"strconv"
+	"strings"
+	"time"
+)
+
+var se *util.SimpleEncrypt = &util.SimpleEncrypt{Key: "topnet2015topnet2015"}
+var ActivityEndCode, ActivityStartCode int64
+var AC = &util.AES_CBC{
+	Key: "mGlAgnIBB8bx2nch",
+	Iv:  "1389461544135476",
+}
+
+//发短信,验证token
+func CheckSendMsg(token string) string {
+	if token == "" {
+		return ""
+	}
+	log.Println("短信解析前token", token)
+	key := fmt.Sprintf("smstoken_%s", token)
+	ok, e := redis.Exists("other", key)
+	if e != nil {
+		log.Println("redis中token error", e)
+		return ""
+	}
+	if ok {
+		log.Println("redis中token已存在", token)
+		return ""
+	}
+	token, e = url.QueryUnescape(token)
+	if e != nil {
+		log.Println("短信token QueryUnescape error", e)
+	}
+	v, err := AC.Decrypt(token)
+	if err != nil {
+		log.Println("短信token Decrypt error", err)
+		return ""
+	}
+	log.Println("短信解析后token", v)
+	vs := strings.Split(v, "_")
+	if len(vs) != 3 {
+		log.Println("短信token error", vs)
+		return ""
+	}
+	now := time.Now()
+	if !strings.HasPrefix(vs[1], util.FormatDate(&now, util.Date_yyyyMMdd)) {
+		log.Println("短信token date错误", vs)
+		return ""
+	}
+	if vs[2] != util.GetMd5String(fmt.Sprintf("%s&%s", vs[0], vs[1])) {
+		log.Println("短信token sing错误", vs)
+		return ""
+	}
+	if vs[0] != "" {
+		redis.Put("other", key, 1, 86400)
+	}
+	return vs[0]
+}

+ 40 - 0
common/src/qfw/util/jy/jy.go

@@ -9,9 +9,12 @@ import (
 	"net/url"
 	"qfw/util"
 	"qfw/util/mail"
+	"qfw/util/sms"
 	"regexp"
 	"strings"
 	"time"
+
+	"github.com/go-xweb/httpsession"
 )
 
 //获取用户合并以前,合并以后的openid
@@ -146,3 +149,40 @@ func SendMailIdentCode(to, code string, auth []*mail.GmailAuth) bool {
 
 	return false
 }
+
+//根据模板发送短信,模板是运营商设定的。
+//第三个参数是可变参数,可以传入多个,但要和模板相匹配
+func SendSMS(tplcode /*模板代码*/, mobile /*手机号码*/ string, param map[string]string) {
+	tmp := []string{}
+	for k, v := range param {
+		tmp = append(tmp, "#"+k+"#="+v)
+	}
+	text := strings.Join(tmp, "&")
+	sms.SendSms(mobile, tplcode, text)
+}
+
+//发送验证码
+func SendPhoneIdentCode(phone string, session *httpsession.Session) bool {
+	lastSentTime, _ := session.Get("identCodeTime").(int64)
+	//60秒之内不允许重复发
+	if lastSentTime > 0 && time.Now().Unix()-lastSentTime <= 60 {
+		return false
+	}
+	s_ranNum := util.GetRandom(6) //生成随机数
+	session.Set("identCodeValue", s_ranNum)
+	session.Set("identCodeKey", phone)
+	session.Set("identCodeTime", time.Now().Unix())
+	//发送短信
+	param := make(map[string]string)
+	param["code"] = s_ranNum
+	log.Println("短信验证码", phone, s_ranNum)
+	SendSMS("2828060", phone, param)
+	return true
+}
+
+//删除短信验证码有关的session
+func ClearPhoneIdentSession(session *httpsession.Session) {
+	session.Del("identCodeValue")
+	session.Del("identCodeKey")
+	session.Del("identCodeTime")
+}