优化:webhook通道webParam分割键值对方式 #472

This commit is contained in:
pppscn 2024-05-23 15:38:22 +08:00
parent 8cc4c76735
commit f7d2544ee9

View File

@ -161,10 +161,11 @@ class WebhookUtils {
else -> XHttp.post(requestUrl).keepJson(true) else -> XHttp.post(requestUrl).keepJson(true)
} }
webParams.trim('&').split("&").forEach { webParams.trim('&').split("&").forEach {
val param = it.split("=") val sepIndex = it.indexOf("=")
if (param.size == 2) { if (sepIndex != -1) {
postRequest.params( val key = it.substring(0, sepIndex).trim()
param[0], param[1].replace("[from]", from) val value = it.substring(sepIndex + 1).trim()
postRequest.params(key, value.replace("[from]", from)
.replace("[content]", content) .replace("[content]", content)
.replace("[msg]", content) .replace("[msg]", content)
.replace("[org_content]", orgContent) .replace("[org_content]", orgContent)