diff --git a/app/integrations/wx_finance_sdk.py b/app/integrations/wx_finance_sdk.py index b6e92a3..5bbe98a 100644 --- a/app/integrations/wx_finance_sdk.py +++ b/app/integrations/wx_finance_sdk.py @@ -50,9 +50,9 @@ class WxFinanceSdk: ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ctypes.c_void_p, ] lib.GetChatData.restype = ctypes.c_int - lib.DecryptData.argtypes = [ - ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_void_p, - ] + # ⚠️ DecryptData 不吃 sdk 句柄(与 GetChatData 不同, 它是纯解密函数)——只有 3 个参数, + # 多传 sdk 会让参数错位、encrypt_key 收到 sdk 指针 → DecryptData 返 10008(解析 encrypt_key 出错)。 + lib.DecryptData.argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_void_p] lib.DecryptData.restype = ctypes.c_int lib.NewSlice.restype = ctypes.c_void_p lib.FreeSlice.argtypes = [ctypes.c_void_p] @@ -87,7 +87,7 @@ class WxFinanceSdk: aes_key = self._priv.decrypt(base64.b64decode(encrypt_random_key_b64), padding.PKCS1v15()) slc = self._lib.NewSlice() try: - ret = self._lib.DecryptData(self._sdk, aes_key, encrypt_chat_msg.encode(), slc) + ret = self._lib.DecryptData(aes_key, encrypt_chat_msg.encode(), slc) if ret != 0: raise WxFinanceError(f"DecryptData 失败 ret={ret}") return json.loads(self._slice_bytes(slc).decode("utf-8"))