更改
This commit is contained in:
parent
a83c885892
commit
248d747604
@ -60,24 +60,38 @@ public class CropController {
|
|||||||
@GetMapping("/crop/chatData")
|
@GetMapping("/crop/chatData")
|
||||||
public List<CropMessage> chatData(Long startSeq, String corpId) throws IOException {
|
public List<CropMessage> chatData(Long startSeq, String corpId) throws IOException {
|
||||||
synchronized (SDK_LOCK) {
|
synchronized (SDK_LOCK) {
|
||||||
long limit = 50;
|
long limit = 10;
|
||||||
long slice = Finance.NewSlice();
|
long slice = Finance.NewSlice();
|
||||||
|
long sdk = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Long sdk = sdkManager.initSdk(corpId, "mEizahrSF6axdfWtSK_f73a3j6-sV02hhyGG7ogmTpM");
|
sdk = sdkManager.initSdk(corpId, "mEizahrSF6axdfWtSK_f73a3j6-sV02hhyGG7ogmTpM");
|
||||||
|
|
||||||
int ret = Finance.GetChatData(sdk, startSeq, limit, "", "", 1000, slice);
|
int ret = Finance.GetChatData(sdk, startSeq, limit, "", "", 1000, slice);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
System.out.println("调用sdk拉取消息接口失败,失败消息为 ret = " + ret);
|
System.out.println("调用sdk拉取消息接口失败,失败消息为 ret = " + ret);
|
||||||
Finance.FreeSlice(slice);
|
//Finance.FreeSlice(slice);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String contentResult = Finance.GetContentFromSlice(slice);
|
String contentResult = Finance.GetContentFromSlice(slice);
|
||||||
log.info("内容字符串" + contentResult);
|
log.info("内容字符串" + contentResult);
|
||||||
return decodeChatData(contentResult, startSeq, sdk, corpId);
|
return decodeChatData(contentResult, startSeq, sdk, corpId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取chat数据异常{}", e.getMessage());
|
||||||
|
// 收集失败情况数据
|
||||||
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
Finance.FreeSlice(slice); // ✅ 无论如何都释放
|
Finance.FreeSlice(slice); // ✅ 无论如何都释放
|
||||||
|
if (sdk != 0) {
|
||||||
|
try {
|
||||||
|
Finance.DestroySdk(sdk); // 重要!
|
||||||
|
} catch (Throwable t) {
|
||||||
|
log.warn("DestroySdk 失败", t);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return Collections.emptyList() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user