Browse Source

修改使用方法

master v0.1.1
guzeng 3 years ago
parent
commit
51af54397e
2 changed files with 12 additions and 11 deletions
  1. +1
    -9
      access_token.client.go
  2. +11
    -2
      common.go

+ 1
- 9
access_token.client.go View File

@ -10,19 +10,11 @@ import (
"github.com/golang/protobuf/proto"
)
type AccessTokenReq struct {
Appid string
Secret string
}
func GetAccessToken(dbname, site_id string, appid, secret string, url ...string) (*AccessTokenRes, error) {
conn, err := rpc_server_conn(url...)
data["dbname"] = dbname
data["site_id"] = site_id
data["appid"] = appid
data["secret"] = secret
data := AccessTokenReq{SiteId: site_id, Dbname: dbname, Appid: appid, Secret: secret}
data_json, err := json.Marshal(data)
if err != nil {


+ 11
- 2
common.go View File

@ -7,10 +7,19 @@ type WxApiRes struct {
Errmsg string
}
type Req struct {
SiteId string
Dbname string
}
type AccessTokenReq struct {
Req
Appid string
Secret string
}
type AccessTokenRes struct {
AccessToken string
ExpiresIn string
WxApiRes
}
func rpc_server_conn(url ...string) (*WeixinRpcServiceClient, error) {


Loading…
Cancel
Save