From 5e910b6b629c1dbb7024510e86107167fcaddfa2 Mon Sep 17 00:00:00 2001 From: gallonyin Date: Sat, 12 Aug 2023 11:38:34 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=8E=A8=E9=80=81=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../worktool/service/WeworkOperationImpl.kt | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/yameida/worktool/service/WeworkOperationImpl.kt b/app/src/main/java/org/yameida/worktool/service/WeworkOperationImpl.kt index 2596d53..b874be3 100644 --- a/app/src/main/java/org/yameida/worktool/service/WeworkOperationImpl.kt +++ b/app/src/main/java/org/yameida/worktool/service/WeworkOperationImpl.kt @@ -577,8 +577,10 @@ object WeworkOperationImpl { receivedContent: String, originalContent: String, fileUrl: String, - extraText: String? = null + extraText: String? = null, + maxRetryCount: Int? = null ): Boolean { + val retryCount = maxRetryCount ?: 2 val startTime = System.currentTimeMillis() if (IWWAPIUtil.sendMicroProgram(fileUrl, originalContent, objectName, receivedContent)) { if (relaySelectTarget(titleList, extraText)) { @@ -586,7 +588,10 @@ object WeworkOperationImpl { return true } else { LogUtils.e("转发失败") - uploadCommandResult(message, ExecCallbackBean.ERROR_RELAY, "转发失败", startTime, listOf(), titleList) + if (retryCount > 0) { + return pushMicroDiskImage(message, titleList, objectName, extraText, retryCount - 1) + } + uploadCommandResult(message, ExecCallbackBean.ERROR_RELAY, "转发失败: $objectName", startTime, listOf(), titleList) return false } } else { @@ -840,8 +845,10 @@ object WeworkOperationImpl { receivedContent: String, originalContent: String, fileUrl: String, - extraText: String? = null + extraText: String? = null, + maxRetryCount: Int? = null ): Boolean { + val retryCount = maxRetryCount ?: 2 val startTime = System.currentTimeMillis() if (IWWAPIUtil.sendLink(fileUrl, originalContent, objectName, receivedContent)) { if (relaySelectTarget(titleList, extraText)) { @@ -849,7 +856,10 @@ object WeworkOperationImpl { return true } else { LogUtils.e("转发失败") - uploadCommandResult(message, ExecCallbackBean.ERROR_RELAY, "转发失败", startTime, listOf(), titleList) + if (retryCount > 0) { + return pushMicroDiskImage(message, titleList, objectName, extraText, retryCount - 1) + } + uploadCommandResult(message, ExecCallbackBean.ERROR_RELAY, "转发失败: $objectName", startTime, listOf(), titleList) return false } } else {