第一次初始化

This commit is contained in:
杨建炊 2025-09-17 16:35:58 +08:00
parent 933bfbcfef
commit 5fa5875570
2 changed files with 152 additions and 0 deletions

152
WeWorkFinanceSdk_C.h Normal file
View File

@ -0,0 +1,152 @@
// All Rights Reserved.
// *File WeWorkFinanceSdk_C.h
// @Brief拉取企业聊天记录与媒体消息sdk头文件
#pragma once
//返回码 错误说明
//10000 参数错误,请求参数错误
//10001 网络错误,网络请求错误
//10002 数据解析失败
//10003 系统失败
//10004 密钥错误导致加密失败
//10005 fileid错误
//10006 解密失败
//10007 找不到消息加密版本的私钥,需要重新传入私钥对
//10008 解析encrypt_key出错
//10009 ip非法
//10010 数据过期
//10011 证书错误
typedef struct WeWorkFinanceSdk_t WeWorkFinanceSdk_t;
// 数据
typedef struct Slice_t
{
char *buf;
int len;
} Slice_t;
typedef struct MediaData
{
char *outindexbuf;
int out_len;
char *data;
int data_len;
int is_finish;
} MediaData_t;
#ifdef __cplusplus
extern "C"
{
#endif
WeWorkFinanceSdk_t *NewSdk();
/**
*
* Return值=0API调用成功
*
* @param [in] sdk NewSdk返回的sdk指针
* @param [in] corpid idwwd08c8exxxx5ab44d----
* @param [in] secret Secret----
*
*
* @return
* 0 -
* !=0 -
*/
int Init(WeWorkFinanceSdk_t *sdk, const char *corpid, const char *secret);
/**
*
* Return值=0API调用成功
*
*
* @param [in] sdk NewSdk返回的sdk指针
* @param [in] seq seq开始拉取消息seq+1seq为之前接口返回的最大seq值使使seq:0
* @param [in] limit 10001000
* @param [in] proxy 使socks5://10.0.0.1:8081 或者 http://10.0.0.1:8081
* @param [in] passwd user_name:passwd_123
* @param [in] timeout
* @param [out] chatDatas slice结构体.errcode/errmsg
{"errcode":0,"errmsg":"ok","chatdata":[{"seq":196,"msgid":"CAQQ2fbb4QUY0On2rYSAgAMgip/yzgs=","publickey_ver":3,"encrypt_random_key":"ftJ+uz3n/z1DsxlkwxNgE+mL38H42/KCvN8T60gbbtPD+Rta1hKTuQPzUzO6Hzne97MgKs7FfdDxDck/v8cDT6gUVjA2tZ/M7euSD0L66opJ/IUeBtpAtvgVSD5qhlaQjvfKJc/zPMGNK2xCLFYqwmQBZXbNT7uA69Fflm512nZKW/piK2RKdYJhRyvQnA1ISxK097sp9WlEgDg250fM5tgwMjujdzr7ehK6gtVBUFldNSJS7ndtIf6aSBfaLktZgwHZ57ONewWq8GJe7WwQf1hwcDbCh7YMG8nsweEwhDfUz+u8rz9an+0lgrYMZFRHnmzjgmLwrR7B/32Qxqd79A==","encrypt_chat_msg":"898WSfGMnIeytTsea7Rc0WsOocs0bIAerF6de0v2cFwqo9uOxrW9wYe5rCjCHHH5bDrNvLxBE/xOoFfcwOTYX0HQxTJaH0ES9OHDZ61p8gcbfGdJKnq2UU4tAEgGb8H+Q9n8syRXIjaI3KuVCqGIi4QGHFmxWenPFfjF/vRuPd0EpzUNwmqfUxLBWLpGhv+dLnqiEOBW41Zdc0OO0St6E+JeIeHlRZAR+E13Isv9eS09xNbF0qQXWIyNUi+ucLr5VuZnPGXBrSfvwX8f0QebTwpy1tT2zvQiMM2MBugKH6NuMzzuvEsXeD+6+3VRqL"}]}
*
* @return
* 0 -
* !=0 -
*/
int GetChatData(WeWorkFinanceSdk_t *sdk, unsigned long long seq, unsigned int limit, const char *proxy, const char *passwd, int timeout, Slice_t *chatDatas);
/**
* @brief .
* @param [in] encrypt_key, getchatdata返回的encrypt_random_key,使RSA解密后的内容
* @param [in] encrypt_msg, getchatdata返回的encrypt_chat_msg
* @param [out] msg,
* @return
* 0 -
* !=0 -
*/
int DecryptData(const char *encrypt_key, const char *encrypt_msg, Slice_t *msg);
/**
*
* Return值=0API调用成功
*
*
* @param [in] sdk NewSdk返回的sdk指针
* @param [in] sdkFileid GetChatData返回的聊天消息中sdkfileid
* @param [in] proxy 使socks5://10.0.0.1:8081 或者 http://10.0.0.1:8081
* @param [in] passwd user_name:passwd_123
* @param [in] indexbuf 512koutindexbuf填入即可
* @param [in] timeout
* @param [out] media_data .MediaData结构体.data()/outindexbuf()/is_finish()
*
* @return
* 0 -
* !=0 -
*/
int GetMediaData(WeWorkFinanceSdk_t *sdk, const char *indexbuf,
const char *sdkFileid, const char *proxy, const char *passwd, int timeout, MediaData_t *media_data);
/**
* @brief sdkNewSdk成对使用
* @return
*/
void DestroySdk(WeWorkFinanceSdk_t *sdk);
//--------------下面接口为了其他语言例如python等调用c接口酌情使用--------------
Slice_t *NewSlice();
/**
* @brief sliceNewSlice成对使用
* @return
*/
void FreeSlice(Slice_t *slice);
/**
* @brief
* @return buf指针
* !=NULL -
* NULL -
*/
char *GetContentFromSlice(Slice_t *slice);
int GetSliceLen(Slice_t *slice);
// 媒体记录相关工具
MediaData_t *NewMediaData();
void FreeMediaData(MediaData_t *media_data);
char *GetOutIndexBuf(MediaData_t *media_data);
char *GetData(MediaData_t *media_data);
int GetIndexLen(MediaData_t *media_data);
int GetDataLen(MediaData_t *media_data);
int IsMediaDataFinish(MediaData_t *media_data);
#ifdef __cplusplus
}
#endif

BIN
libWeWorkFinanceSdk_C.so Normal file

Binary file not shown.