fix
This commit is contained in:
parent
73bd3d8f90
commit
14027c81f0
@ -101,8 +101,7 @@ func (this *MainServiceApi) WxNotifyPurchase(c *gin.Context) {
|
|||||||
|
|
||||||
smsg, appid := service.Wxpay.DecryptMsg(msg_signature, timestamp, nonce, postObj.Encrypt)
|
smsg, appid := service.Wxpay.DecryptMsg(msg_signature, timestamp, nonce, postObj.Encrypt)
|
||||||
if len(smsg) == 0 || len(appid) == 0 {
|
if len(smsg) == 0 || len(appid) == 0 {
|
||||||
rspObj.ErrorCode = 402
|
f5.GetSysLog().Debug("decrypt data error")
|
||||||
rspObj.ErrMsg = "decrypt data error"
|
|
||||||
c.JSON(200, rspObj)
|
c.JSON(200, rspObj)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -111,8 +110,7 @@ func (this *MainServiceApi) WxNotifyPurchase(c *gin.Context) {
|
|||||||
|
|
||||||
wxnotifyobj := service.WxPurchaseNotify{}
|
wxnotifyobj := service.WxPurchaseNotify{}
|
||||||
if json.Unmarshal(smsg, &wxnotifyobj) != nil {
|
if json.Unmarshal(smsg, &wxnotifyobj) != nil {
|
||||||
rspObj.ErrorCode = 403
|
f5.GetSysLog().Debug("unmarshal data error")
|
||||||
rspObj.ErrMsg = "unmarshal data error"
|
|
||||||
c.JSON(200, rspObj)
|
c.JSON(200, rspObj)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -60,9 +60,9 @@ func (wp *wxpay) DecryptMsg(sMsgSignature string, sTimeStamp string, sNonce stri
|
|||||||
}
|
}
|
||||||
netlenbyte := sNoEncryptData[constant.WX_RANDENCRYPT_STRLEN : constant.WX_RANDENCRYPT_STRLEN+constant.WX_KMSG_LEN]
|
netlenbyte := sNoEncryptData[constant.WX_RANDENCRYPT_STRLEN : constant.WX_RANDENCRYPT_STRLEN+constant.WX_KMSG_LEN]
|
||||||
buf := bytes.NewReader(netlenbyte)
|
buf := bytes.NewReader(netlenbyte)
|
||||||
iMsgLen := int(0) //ntohl(iNetLen);
|
iMsgLen := int32(0) //ntohl(iNetLen);
|
||||||
binary.Read(buf, binary.LittleEndian, &iMsgLen)
|
binary.Read(buf, binary.BigEndian, &iMsgLen)
|
||||||
if len(sNoEncryptData) <= constant.WX_RANDENCRYPT_STRLEN+constant.WX_KMSG_LEN+iMsgLen {
|
if len(sNoEncryptData) <= constant.WX_RANDENCRYPT_STRLEN+constant.WX_KMSG_LEN+int(iMsgLen) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sMsg = sNoEncryptData[constant.WX_RANDENCRYPT_STRLEN+constant.WX_KMSG_LEN : constant.WX_RANDENCRYPT_STRLEN+constant.WX_KMSG_LEN+iMsgLen]
|
sMsg = sNoEncryptData[constant.WX_RANDENCRYPT_STRLEN+constant.WX_KMSG_LEN : constant.WX_RANDENCRYPT_STRLEN+constant.WX_KMSG_LEN+iMsgLen]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user