From 51af54397e50e4287fe0b96f7b1c06482064827d Mon Sep 17 00:00:00 2001 From: guzeng Date: Mon, 29 Mar 2021 22:44:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=BF=E7=94=A8=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- access_token.client.go | 10 +--------- common.go | 13 +++++++++++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/access_token.client.go b/access_token.client.go index 27fe7f3..ebbc6f5 100644 --- a/access_token.client.go +++ b/access_token.client.go @@ -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 { diff --git a/common.go b/common.go index efcd300..b8151a5 100644 --- a/common.go +++ b/common.go @@ -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) {