Browse Source

修改变量名

master v0.1.5
guzeng 3 years ago
parent
commit
37e0411c2b
2 changed files with 8 additions and 4 deletions
  1. +4
    -4
      sign.go
  2. +4
    -0
      weixin.pb.go

+ 4
- 4
sign.go View File

@ -51,24 +51,24 @@ func GetOrgData(res *Response) (string, error) {
if res_data == "" {
return nil, errors.New("未收到收据")
return "", errors.New("未收到收据")
}
time_int64, err := strconv.ParseInt(res.GetTime(), 10, 64)
if err != nil {
return nil, err
return "", err
}
now_int64 := time.Now().Unix()
if now_int64-time_int64 > 10 || time_int64-now_int64 > 10 {
//时间误差前后10秒,返回
return nil, errors.New("返回时间错误")
return "", errors.New("返回时间错误")
}
check_sign := CheckSign(res.GetSign(), res_data, res.GetTime())
if !check_sign {
return nil, errors.New("返回数据签名错误")
return "", errors.New("返回数据签名错误")
}
//解密


+ 4
- 0
weixin.pb.go View File

@ -100,6 +100,7 @@ func init() {
type WeixinRpcService interface {
GetAccessToken(in *Request, out *Response) error
SendMiniprogramSubscribeMessage(in *Request, out *Response) error
SendUniformMessage(in *Request, out *Response) error
}
// AcceptWeixinRpcServiceClient accepts connections on the listener and serves requests
@ -177,6 +178,9 @@ func (c *WeixinRpcServiceClient) GetAccessToken(in *Request, out *Response) erro
func (c *WeixinRpcServiceClient) SendMiniprogramSubscribeMessage(in *Request, out *Response) error {
return c.Call("WeixinRpcService.SendMiniprogramSubscribeMessage", in, out)
}
func (c *WeixinRpcServiceClient) SendUniformMessage(in *Request, out *Response) error {
return c.Call("WeixinRpcService.SendUniformMessage", in, out)
}
// DialWeixinRpcService connects to an WeixinRpcService at the specified network address.
func DialWeixinRpcService(network, addr string) (*WeixinRpcServiceClient, *rpc.Client, error) {


Loading…
Cancel
Save