mirror of
https://github.com/pppscn/SmsForwarder
synced 2024-11-09 19:10:51 +00:00
优化:企业微信应用
发送通道允许自定义API地址【通过反向代理(proxy_pass https://qyapi.weixin.qq.com;)绕过IP白名单限制】 #352
This commit is contained in:
parent
8eeb2b1cc2
commit
74346b7291
@ -18,7 +18,7 @@ data class WeworkAgentSetting(
|
||||
val proxyAuthenticator: Boolean? = false,
|
||||
val proxyUsername: String? = "",
|
||||
val proxyPassword: String? = "",
|
||||
val customizeAPI: String = "https://qyapi.weixin.qq.com/cgi-bin",
|
||||
val customizeAPI: String = "https://qyapi.weixin.qq.com",
|
||||
) : Serializable {
|
||||
|
||||
fun getProxyTypeCheckId(): Int {
|
||||
|
@ -47,8 +47,8 @@ class WeworkAgentUtils private constructor() {
|
||||
return sendTextMsg(setting, msgInfo, rule, senderIndex, logId, msgId)
|
||||
}
|
||||
|
||||
val customApi = if (TextUtils.isEmpty(setting.customizeAPI)) "https://qyapi.weixin.qq.com/cgi-bin" else setting.customizeAPI
|
||||
var getTokenUrl = "$customApi/gettoken?"
|
||||
val customApi = if (TextUtils.isEmpty(setting.customizeAPI)) "https://qyapi.weixin.qq.com" else setting.customizeAPI
|
||||
var getTokenUrl = "$customApi/cgi-bin/gettoken?"
|
||||
getTokenUrl += "corpid=" + setting.corpID
|
||||
getTokenUrl += "&corpsecret=" + setting.secret
|
||||
Log.d(TAG, "getTokenUrl:$getTokenUrl")
|
||||
@ -141,8 +141,8 @@ class WeworkAgentUtils private constructor() {
|
||||
textText["content"] = content
|
||||
textMsgMap["text"] = textText
|
||||
val accessToken: String by SharedPreference("access_token_" + setting.agentID, "")
|
||||
val customApi = if (TextUtils.isEmpty(setting.customizeAPI)) "https://qyapi.weixin.qq.com/cgi-bin" else setting.customizeAPI
|
||||
val requestUrl = "$customApi/message/send?access_token=$accessToken"
|
||||
val customApi = if (TextUtils.isEmpty(setting.customizeAPI)) "https://qyapi.weixin.qq.com" else setting.customizeAPI
|
||||
val requestUrl = "$customApi/cgi-bin/message/send?access_token=$accessToken"
|
||||
Log.i(TAG, "requestUrl:$requestUrl")
|
||||
val requestMsg: String = Gson().toJson(textMsgMap)
|
||||
Log.i(TAG, "requestMsg:$requestMsg")
|
||||
|
Loading…
Reference in New Issue
Block a user