diff --git a/platformapi/dingdingapi/callback.go b/platformapi/dingdingapi/callback.go index 1805cd88..2052ee5c 100644 --- a/platformapi/dingdingapi/callback.go +++ b/platformapi/dingdingapi/callback.go @@ -181,6 +181,7 @@ func (a *API) GetCallbackMsg(formMap map[string]interface{}, bodyData []byte) (m } else { var descryptMsg string if descryptMsg, err = a.Decrypt(encrypt); err == nil { + baseapi.SugarLogger.Debugf("dingding GetCallbackMsg descryptMsg:%s", descryptMsg) err = utils.UnmarshalUseNumber([]byte(descryptMsg), &msgMap) } } diff --git a/platformapi/dingdingapi/callback_test.go b/platformapi/dingdingapi/callback_test.go index 1ee4b877..aef6f138 100644 --- a/platformapi/dingdingapi/callback_test.go +++ b/platformapi/dingdingapi/callback_test.go @@ -1,14 +1,29 @@ package dingdingapi -import "testing" +import ( + "testing" -func TestEncrypt(t *testing.T) { + "git.rosy.net.cn/baseapi" +) + +func TestCrypt(t *testing.T) { api.RegisterCallback(nil, "token", "M3Z1b1FIXjlAWW84bEVxNENHSlZOUFJEbkAlRUZQXnE", "") encryptedMsg, err := api.Encrypt("hello") decryptedMsg, err := api.Decrypt(encryptedMsg) t.Log(encryptedMsg, decryptedMsg, err) } +func TestDecrypt(t *testing.T) { + api.RegisterCallback(nil, "j9JMGyaZs&vxqt&S", "VFFjTnZrZDJZZmZHJksxeTlxcnp5aG42WmRCbXl3REE", "") + encryptedMsg := "UsgVSPqyJg1aLBmVSbAP19AcIgK/O2UgOfo7lOuwRbSfPDP8XnDUuE+os+nnxsbaMTJ4DSu/twE5aNrZk7RDE9vZYiT/gXqXNvj7y45R32xfOLecVNTvy13wF4vDzuUB" + decryptedMsg, err := api.Decrypt(encryptedMsg) + if err != nil { + t.Fatal(err) + } else { + baseapi.SugarLogger.Debugf("decryptedMsg:%s\n", decryptedMsg) + } +} + func TestPackCallbackResult(t *testing.T) { api.RegisterCallback(nil, "token", "M3Z1b1FIXjlAWW84bEVxNENHSlZOUFJEbkAlRUZQXnE", "") success := api.PackCallbackResult("success")