From 30e4e1d689a7c465e0d940e13179a4330d72ad0c Mon Sep 17 00:00:00 2001 From: listen <494177603@qq.com> Date: Mon, 29 Nov 2021 15:03:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E7=A0=81=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miniapp_qrcode.client.go | 7 +++---- miniapp_qrcode.client_test.go | 7 ++++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/miniapp_qrcode.client.go b/miniapp_qrcode.client.go index 5572cae..37bbff5 100644 --- a/miniapp_qrcode.client.go +++ b/miniapp_qrcode.client.go @@ -10,7 +10,7 @@ import ( "github.com/golang/protobuf/proto" ) -func GetMiniAppQrcode(appId, appSecret, page,scene string, url ...string) (string, error) { +func GetMiniAppQrcode(appId, appSecret string, qrcodeParams map[string]interface{}, url ...string) (string, error) { conn, err := rpc_server_conn(url...) if err != nil { @@ -18,11 +18,10 @@ func GetMiniAppQrcode(appId, appSecret, page,scene string, url ...string) (strin } defer conn.Close() - data := map[string]string{} + data := map[string]interface{}{} data["app_id"] = appId data["app_secret"] = appSecret - data["page"] = page - data["scene"] = scene + data["qrcode"] = qrcodeParams data_json, err := json.Marshal(data) if err != nil { diff --git a/miniapp_qrcode.client_test.go b/miniapp_qrcode.client_test.go index 5a7a1b2..cacbfa9 100644 --- a/miniapp_qrcode.client_test.go +++ b/miniapp_qrcode.client_test.go @@ -9,7 +9,12 @@ func Test_GetMiniappCode(t *testing.T){ appSecret := "165983626235636be54a16404e3e70a7" page := "" scene := "user_id=2" - qrcode,err := GetMiniAppQrcode(appid,appSecret,page,scene) + qrcodeParams := map[string]interface{}{ + "page":page, + "scene":scene, + "is_hyaline":true, + } + qrcode,err := GetMiniAppQrcode(appid,appSecret,qrcodeParams) t.Log(qrcode) t.Log(err)