adjust
This commit is contained in:
parent
4ebdaa9980
commit
65a495ab98
@ -78,18 +78,23 @@ func (this *MainServiceApi) WxNotifyPurchase(c *gin.Context) {
|
||||
timestamp := c.Query("timestamp")
|
||||
nonce := c.Query("nonce")
|
||||
|
||||
strs := []string{mt.Table.Config.GetWxNotifyToken(), timestamp, nonce}
|
||||
sort.Strings(strs)
|
||||
sb := strings.Builder{}
|
||||
sb.WriteString(strs[0])
|
||||
sb.WriteString(strs[1])
|
||||
sb.WriteString(strs[2])
|
||||
m := sha1.New()
|
||||
io.WriteString(m, sb.String())
|
||||
sign := string(m.Sum(nil))
|
||||
if len(signature) > 0 || len(timestamp) > 0 || len(nonce) > 0 {
|
||||
strs := []string{mt.Table.Config.GetWxNotifyToken(), timestamp, nonce}
|
||||
sort.Strings(strs)
|
||||
sb := strings.Builder{}
|
||||
sb.WriteString(strs[0])
|
||||
sb.WriteString(strs[1])
|
||||
sb.WriteString(strs[2])
|
||||
m := sha1.New()
|
||||
io.WriteString(m, sb.String())
|
||||
sign := string(hex.EncodeToString(m.Sum(nil)))
|
||||
|
||||
f5.GetSysLog().Debug("wx sign:%s, %s", sign, signature)
|
||||
if sign != signature {
|
||||
f5.GetSysLog().Debug("wx sign:%s, %s", sign, signature)
|
||||
if sign != signature {
|
||||
c.String(200, "wrong")
|
||||
return
|
||||
}
|
||||
c.String(200, c.Query("echostr"))
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user