update 推送链接小程序优化

This commit is contained in:
gallonyin
2023-08-12 11:38:34 +08:00
parent 2efff67b6c
commit 5e910b6b62

View File

@@ -577,8 +577,10 @@ object WeworkOperationImpl {
receivedContent: String, receivedContent: String,
originalContent: String, originalContent: String,
fileUrl: String, fileUrl: String,
extraText: String? = null extraText: String? = null,
maxRetryCount: Int? = null
): Boolean { ): Boolean {
val retryCount = maxRetryCount ?: 2
val startTime = System.currentTimeMillis() val startTime = System.currentTimeMillis()
if (IWWAPIUtil.sendMicroProgram(fileUrl, originalContent, objectName, receivedContent)) { if (IWWAPIUtil.sendMicroProgram(fileUrl, originalContent, objectName, receivedContent)) {
if (relaySelectTarget(titleList, extraText)) { if (relaySelectTarget(titleList, extraText)) {
@@ -586,7 +588,10 @@ object WeworkOperationImpl {
return true return true
} else { } else {
LogUtils.e("转发失败") 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 return false
} }
} else { } else {
@@ -840,8 +845,10 @@ object WeworkOperationImpl {
receivedContent: String, receivedContent: String,
originalContent: String, originalContent: String,
fileUrl: String, fileUrl: String,
extraText: String? = null extraText: String? = null,
maxRetryCount: Int? = null
): Boolean { ): Boolean {
val retryCount = maxRetryCount ?: 2
val startTime = System.currentTimeMillis() val startTime = System.currentTimeMillis()
if (IWWAPIUtil.sendLink(fileUrl, originalContent, objectName, receivedContent)) { if (IWWAPIUtil.sendLink(fileUrl, originalContent, objectName, receivedContent)) {
if (relaySelectTarget(titleList, extraText)) { if (relaySelectTarget(titleList, extraText)) {
@@ -849,7 +856,10 @@ object WeworkOperationImpl {
return true return true
} else { } else {
LogUtils.e("转发失败") 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 return false
} }
} else { } else {