From c800f05775febd54e15aad40c41b8264c1a66170 Mon Sep 17 00:00:00 2001 From: listen <494177603@qq.com> Date: Tue, 5 Oct 2021 15:01:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miniapp_qrcode.client.go | 72 ----------------------------------- miniapp_qrcode.client_test.go | 16 -------- 2 files changed, 88 deletions(-) delete mode 100644 miniapp_qrcode.client.go delete mode 100644 miniapp_qrcode.client_test.go diff --git a/miniapp_qrcode.client.go b/miniapp_qrcode.client.go deleted file mode 100644 index 9371d83..0000000 --- a/miniapp_qrcode.client.go +++ /dev/null @@ -1,72 +0,0 @@ -package weixinrpc - -import ( - "encoding/json" - "log" - "strconv" - "time" - - "git.tetele.net/tgo/crypter" - - "github.com/golang/protobuf/proto" -) - -func GetMiniAppQrcode(appId, appSecret, page,scene string, url ...string) (string, error) { - - conn, err := rpc_server_conn(url...) - if err != nil { - return "", err - } - defer conn.Close() - - data := map[string]string{} - data["app_id"] = appId - data["app_secret"] = appSecret - data["page"] = page - data["scene"] = scene - - data_json, err := json.Marshal(data) - if err != nil { - return "", err - } - - encryData := crypter.DesEn(string(data_json), DES_KEY) - - now_int64 := time.Now().Unix() - - now := strconv.FormatInt(now_int64, 10) - - sign := Sign(encryData, now) - - req := &Request{ - proto.String(encryData), - proto.String(now), - proto.String(sign), - nil} - - res := &Response{} - - err = conn.GetMiniappQrcode(req, res) - - if err != nil { - return "", err - } - - //解密 - res_data_de, err := GetOrgData(res) - - if err != nil { - return "", err - } - - var result string - - err = json.Unmarshal([]byte(res_data_de), &result) - - if err != nil { - log.Println(err, res_data_de) - return "", err - } - - return result, nil -} diff --git a/miniapp_qrcode.client_test.go b/miniapp_qrcode.client_test.go deleted file mode 100644 index b14f816..0000000 --- a/miniapp_qrcode.client_test.go +++ /dev/null @@ -1,16 +0,0 @@ -package weixinrpc - -import ( - "testing" -) - -func Test_GetMiniappCode(t *testing.T){ - appid := "wx3d53ccbaf69f7995" - appSecret := "165983626235636be54a16404e3e70a7" - page := "/pages/home/index/index" - scene := "user_id=2" - qrcode,err := GetMiniAppQrcode(appid,appSecret,page,scene) - - t.Log(qrcode) - t.Log(err) -} \ No newline at end of file