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)
|
||||
if len(smsg) == 0 || len(appid) == 0 {
|
||||
rspObj.ErrorCode = 402
|
||||
rspObj.ErrMsg = "decrypt data error"
|
||||
f5.GetSysLog().Debug("decrypt data error")
|
||||
c.JSON(200, rspObj)
|
||||
return
|
||||
}
|
||||
@ -111,8 +110,7 @@ func (this *MainServiceApi) WxNotifyPurchase(c *gin.Context) {
|
||||
|
||||
wxnotifyobj := service.WxPurchaseNotify{}
|
||||
if json.Unmarshal(smsg, &wxnotifyobj) != nil {
|
||||
rspObj.ErrorCode = 403
|
||||
rspObj.ErrMsg = "unmarshal data error"
|
||||
f5.GetSysLog().Debug("unmarshal data error")
|
||||
c.JSON(200, rspObj)
|
||||
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]
|
||||
buf := bytes.NewReader(netlenbyte)
|
||||
iMsgLen := int(0) //ntohl(iNetLen);
|
||||
binary.Read(buf, binary.LittleEndian, &iMsgLen)
|
||||
if len(sNoEncryptData) <= constant.WX_RANDENCRYPT_STRLEN+constant.WX_KMSG_LEN+iMsgLen {
|
||||
iMsgLen := int32(0) //ntohl(iNetLen);
|
||||
binary.Read(buf, binary.BigEndian, &iMsgLen)
|
||||
if len(sNoEncryptData) <= constant.WX_RANDENCRYPT_STRLEN+constant.WX_KMSG_LEN+int(iMsgLen) {
|
||||
return
|
||||
}
|
||||
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