{"id":19263911,"url":"https://github.com/nicexai/weworkfinancesdk","last_synced_at":"2025-04-09T04:02:00.676Z","repository":{"id":37456585,"uuid":"340234240","full_name":"NICEXAI/WeWorkFinanceSDK","owner":"NICEXAI","description":"企业微信会话存档SDK（基于企业微信C版官方SDK封装）","archived":false,"fork":false,"pushed_at":"2024-11-25T15:20:46.000Z","size":5402,"stargazers_count":283,"open_issues_count":5,"forks_count":39,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-02T02:13:06.552Z","etag":null,"topics":["finance","go","wechat"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NICEXAI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-19T02:15:40.000Z","updated_at":"2025-03-18T14:32:54.000Z","dependencies_parsed_at":"2024-06-18T18:40:23.889Z","dependency_job_id":"184c9b8e-f356-4858-95e6-47fbdce5548a","html_url":"https://github.com/NICEXAI/WeWorkFinanceSDK","commit_stats":{"total_commits":44,"total_committers":9,"mean_commits":4.888888888888889,"dds":0.6363636363636364,"last_synced_commit":"14e5b390af12bd4c8bff490d201e872b7965811b"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NICEXAI%2FWeWorkFinanceSDK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NICEXAI%2FWeWorkFinanceSDK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NICEXAI%2FWeWorkFinanceSDK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NICEXAI%2FWeWorkFinanceSDK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NICEXAI","download_url":"https://codeload.github.com/NICEXAI/WeWorkFinanceSDK/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247974717,"owners_count":21026742,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["finance","go","wechat"],"created_at":"2024-11-09T19:37:29.219Z","updated_at":"2025-04-09T04:02:00.656Z","avatar_url":"https://github.com/NICEXAI.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WeWorkFinanceSDK\r\n企业微信会话存档SDK（基于企业微信C版官方SDK封装），暂时只支持在`linux`环境下使用当前SDK。\r\n\r\n### 官方文档地址\r\nhttps://open.work.weixin.qq.com/api/doc/90000/90135/91774\r\n\r\n### 使用方式\r\n\r\n1、安装 go module\r\n\u003e go get -u github.com/NICEXAI/WeWorkFinanceSDK\r\n\r\n2、从 `github.com/NICEXAI/WeWorkFinanceSDK/lib` 文件夹下复制 `libWeWorkFinanceSdk_C.so` 动态库文件到系统动态链接库默认文件夹下，或者复制到任意文件夹并在当前文件夹下执行 `export LD_LIBRARY_PATH=$(pwd)`命令设置动态链接库检索地址\r\n\r\n3、把 `module` 引入到项目中即可使用\r\n\r\n### Example\r\n\r\n```go\r\npackage main\r\n\r\nimport (\r\n\t\"bytes\"\r\n\t\"fmt\"\r\n\t\"github.com/NICEXAI/WeWorkFinanceSDK\"\r\n\t\"io/ioutil\"\r\n\t\"os\"\r\n\t\"path\"\r\n)\r\n\r\nfunc main() {\r\n\tcorpID := \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\r\n\tcorpSecret := \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\r\n\trsaPrivateKey := `\r\n-----BEGIN RSA PRIVATE KEY-----\r\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\r\n-----END RSA PRIVATE KEY-----\r\n`\r\n\r\n\t//初始化客户端\r\n\tclient, err := WeWorkFinanceSDK.NewClient(corpID, corpSecret, rsaPrivateKey)\r\n\tif err != nil {\r\n\t\tfmt.Printf(\"SDK 初始化失败：%v \\n\", err)\r\n\t\treturn\r\n\t}\r\n\r\n\t//同步消息\r\n\tchatDataList, err := client.GetChatData(0, 100, \"\", \"\", 3)\r\n\tif err != nil {\r\n\t\tfmt.Printf(\"消息同步失败：%v \\n\", err)\r\n\t\treturn\r\n\t}\r\n\r\n\tfor _, chatData := range chatDataList {\r\n\t\t//消息解密\r\n\t\tchatInfo, err := client.DecryptData(chatData.EncryptRandomKey, chatData.EncryptChatMsg)\r\n\t\tif err != nil {\r\n\t\t\tfmt.Printf(\"消息解密失败：%v \\n\", err)\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\tif chatInfo.Type == \"image\" {\r\n\t\t\timage := chatInfo.GetImageMessage()\r\n\t\t\tsdkfileid := image.Image.SdkFileID\r\n\r\n\t\t\tisFinish := false\r\n\t\t\tbuffer := bytes.Buffer{}\r\n\t\t\tindex_buf := \"\"\r\n\t\t\tfor !isFinish {\r\n\t\t\t\t//获取媒体数据\r\n\t\t\t\tmediaData, err := client.GetMediaData(index_buf, sdkfileid, \"\", \"\", 5)\r\n\t\t\t\tif err != nil {\r\n\t\t\t\t\tfmt.Printf(\"媒体数据拉取失败：%v \\n\", err)\r\n\t\t\t\t\treturn\r\n\t\t\t\t}\r\n\t\t\t\tbuffer.Write(mediaData.Data)\r\n\t\t\t\tif mediaData.IsFinish {\r\n\t\t\t\t\tisFinish = mediaData.IsFinish\r\n\t\t\t\t}\r\n\t\t\t\tindex_buf = mediaData.OutIndexBuf\r\n\t\t\t}\r\n\t\t\tfilePath, _ := os.Getwd()\r\n\t\t\tfilePath = path.Join(filePath, \"test.png\")\r\n\t\t\terr := ioutil.WriteFile(filePath, buffer.Bytes(), 0666)\r\n\t\t\tif err != nil {\r\n\t\t\t\tfmt.Printf(\"文件存储失败：%v \\n\", err)\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t\tbreak\r\n\t\t}\r\n\t}\r\n}\r\n\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicexai%2Fweworkfinancesdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicexai%2Fweworkfinancesdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicexai%2Fweworkfinancesdk/lists"}