update 推送link
This commit is contained in:
@@ -18,6 +18,9 @@ object Constant {
|
|||||||
var key = "9876543210abcdef".toByteArray()
|
var key = "9876543210abcdef".toByteArray()
|
||||||
var iv = "0123456789abcdef".toByteArray()
|
var iv = "0123456789abcdef".toByteArray()
|
||||||
val transformation = "AES/CBC/PKCS7Padding"
|
val transformation = "AES/CBC/PKCS7Padding"
|
||||||
|
val weworkCorpId = ""
|
||||||
|
val weworkAgentId = ""
|
||||||
|
val weworkSchema = ""
|
||||||
var encryptType = SPUtils.getInstance().getInt("encryptType", 1)
|
var encryptType = SPUtils.getInstance().getInt("encryptType", 1)
|
||||||
var autoReply = SPUtils.getInstance().getInt("autoReply", 1)
|
var autoReply = SPUtils.getInstance().getInt("autoReply", 1)
|
||||||
var groupStrict = false
|
var groupStrict = false
|
||||||
@@ -26,6 +29,7 @@ object Constant {
|
|||||||
var autoPublishComment = false
|
var autoPublishComment = false
|
||||||
var groupQrCode = false
|
var groupQrCode = false
|
||||||
var enableMediaProject = false
|
var enableMediaProject = false
|
||||||
|
var enableSdkShare = false
|
||||||
var robotId: String
|
var robotId: String
|
||||||
get() = SPUtils.getInstance().getString("robotId", SPUtils.getInstance().getString("LISTEN_CHANNEL_ID", ""))
|
get() = SPUtils.getInstance().getString("robotId", SPUtils.getInstance().getString("LISTEN_CHANNEL_ID", ""))
|
||||||
set(value) {
|
set(value) {
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import com.blankj.utilcode.util.Utils
|
|||||||
import com.efs.sdk.base.core.util.PackageUtil
|
import com.efs.sdk.base.core.util.PackageUtil
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.hjq.toast.ToastUtils
|
import com.hjq.toast.ToastUtils
|
||||||
|
import com.tencent.wework.api.IWWAPI
|
||||||
|
import com.tencent.wework.api.WWAPIFactory
|
||||||
import com.tendcloud.tenddata.TalkingDataSDK
|
import com.tendcloud.tenddata.TalkingDataSDK
|
||||||
import com.umeng.commonsdk.UMConfigure
|
import com.umeng.commonsdk.UMConfigure
|
||||||
import org.yameida.worktool.config.GlobalException
|
import org.yameida.worktool.config.GlobalException
|
||||||
@@ -20,6 +22,7 @@ class MyApplication : Application() {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
|
var iwwapi: IWWAPI? = null
|
||||||
/**
|
/**
|
||||||
* 回到WorkTool首页 需要先授权显示悬浮窗
|
* 回到WorkTool首页 需要先授权显示悬浮窗
|
||||||
*/
|
*/
|
||||||
@@ -57,6 +60,11 @@ class MyApplication : Application() {
|
|||||||
PlayNotifyManager.show()
|
PlayNotifyManager.show()
|
||||||
//设置全局异常捕获重启
|
//设置全局异常捕获重启
|
||||||
Thread.setDefaultUncaughtExceptionHandler(GlobalException.getInstance())
|
Thread.setDefaultUncaughtExceptionHandler(GlobalException.getInstance())
|
||||||
|
//注册企微分享
|
||||||
|
if (Constant.enableSdkShare) {
|
||||||
|
iwwapi = WWAPIFactory.createWWAPI(this)
|
||||||
|
iwwapi?.registerApp(Constant.weworkSchema)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -37,6 +37,7 @@ public class WeworkMessageBean {
|
|||||||
* 添加待办 ADD_NEED_DEAL
|
* 添加待办 ADD_NEED_DEAL
|
||||||
* 打卡 CLOCK_IN
|
* 打卡 CLOCK_IN
|
||||||
* 切换企业 SWITCH_CORP
|
* 切换企业 SWITCH_CORP
|
||||||
|
* 推送链接 PUSH_LINK
|
||||||
* <p>
|
* <p>
|
||||||
* 非操作类型 300
|
* 非操作类型 300
|
||||||
* 机器人普通日志记录 ROBOT_LOG
|
* 机器人普通日志记录 ROBOT_LOG
|
||||||
@@ -77,6 +78,7 @@ public class WeworkMessageBean {
|
|||||||
public static final int ADD_NEED_DEAL = 221;
|
public static final int ADD_NEED_DEAL = 221;
|
||||||
public static final int CLOCK_IN = 222;
|
public static final int CLOCK_IN = 222;
|
||||||
public static final int SWITCH_CORP = 223;
|
public static final int SWITCH_CORP = 223;
|
||||||
|
public static final int PUSH_LINK = 224;
|
||||||
|
|
||||||
public static final int ROBOT_LOG = 301;
|
public static final int ROBOT_LOG = 301;
|
||||||
public static final int ROBOT_ERROR_LOG = 302;
|
public static final int ROBOT_ERROR_LOG = 302;
|
||||||
|
|||||||
@@ -159,6 +159,9 @@ object MyLooper {
|
|||||||
WeworkMessageBean.PUSH_FILE -> {
|
WeworkMessageBean.PUSH_FILE -> {
|
||||||
WeworkController.pushFile(message)
|
WeworkController.pushFile(message)
|
||||||
}
|
}
|
||||||
|
WeworkMessageBean.PUSH_LINK -> {
|
||||||
|
WeworkController.pushLink(message)
|
||||||
|
}
|
||||||
WeworkMessageBean.DISMISS_GROUP -> {
|
WeworkMessageBean.DISMISS_GROUP -> {
|
||||||
WeworkController.dismissGroup(message)
|
WeworkController.dismissGroup(message)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -339,6 +339,30 @@ object WeworkController {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送链接
|
||||||
|
* @see WeworkMessageBean.PUSH_LINK
|
||||||
|
* @param message#titleList 待发送姓名列表
|
||||||
|
* @param message#objectName 文章标题
|
||||||
|
* @param message#receivedContent 文章副标题
|
||||||
|
* @param message#originalContent 文章链接地址
|
||||||
|
* @param message#fileUrl 图片地址
|
||||||
|
* @param message#extraText 附加留言 可选
|
||||||
|
*/
|
||||||
|
@RequestMapping
|
||||||
|
fun pushLink(message: WeworkMessageBean): Boolean {
|
||||||
|
LogUtils.d("pushLink(): ${message.titleList} ${message.objectName} ${message.receivedContent} ${message.originalContent} ${message.fileUrl} ${message.extraText}")
|
||||||
|
return WeworkOperationImpl.pushLink(
|
||||||
|
message,
|
||||||
|
message.titleList,
|
||||||
|
message.objectName,
|
||||||
|
message.receivedContent,
|
||||||
|
message.originalContent,
|
||||||
|
message.fileUrl,
|
||||||
|
message.extraText
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按手机号添加好友
|
* 按手机号添加好友
|
||||||
* @see WeworkMessageBean.ADD_FRIEND_BY_PHONE
|
* @see WeworkMessageBean.ADD_FRIEND_BY_PHONE
|
||||||
|
|||||||
@@ -718,6 +718,43 @@ object WeworkOperationImpl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送链接
|
||||||
|
* @see WeworkMessageBean.PUSH_LINK
|
||||||
|
* @param titleList 待发送姓名列表
|
||||||
|
* @param objectName 文章标题
|
||||||
|
* @param receivedContent 文章副标题
|
||||||
|
* @param originalContent 文章链接地址
|
||||||
|
* @param fileUrl 图片地址
|
||||||
|
* @param extraText 附加留言 可选
|
||||||
|
*/
|
||||||
|
fun pushLink(
|
||||||
|
message: WeworkMessageBean,
|
||||||
|
titleList: List<String>,
|
||||||
|
objectName: String,
|
||||||
|
receivedContent: String,
|
||||||
|
originalContent: String,
|
||||||
|
fileUrl: String,
|
||||||
|
extraText: String? = null,
|
||||||
|
maxRetryCount: Int? = null
|
||||||
|
): Boolean {
|
||||||
|
val startTime = System.currentTimeMillis()
|
||||||
|
if (IWWAPIUtil.sendLink(fileUrl, originalContent, objectName, receivedContent)) {
|
||||||
|
if (relaySelectTarget(titleList, extraText)) {
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.SUCCESS, "", startTime)
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
LogUtils.e("转发失败")
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.ERROR_RELAY, "转发失败", startTime)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LogUtils.e("非法操作")
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.ERROR_ILLEGAL_OPERATION, "非法操作", startTime)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手机号添加好友或修改好友信息
|
* 手机号添加好友或修改好友信息
|
||||||
* @see WeworkMessageBean.ADD_FRIEND_BY_PHONE
|
* @see WeworkMessageBean.ADD_FRIEND_BY_PHONE
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ object IWWAPIUtil {
|
|||||||
iwwapi?.registerApp(schema)
|
iwwapi?.registerApp(schema)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun sendLink(thumbUrl: String?, webpageUrl: String?, title: String?, description: String?) {
|
fun sendLink(thumbUrl: String?, webpageUrl: String?, title: String?, description: String?): Boolean {
|
||||||
val link = WWMediaLink()
|
val link = WWMediaLink()
|
||||||
link.thumbUrl = thumbUrl
|
link.thumbUrl = thumbUrl
|
||||||
link.webpageUrl = webpageUrl
|
link.webpageUrl = webpageUrl
|
||||||
@@ -37,7 +37,7 @@ object IWWAPIUtil {
|
|||||||
link.appName = AppUtils.getAppName()
|
link.appName = AppUtils.getAppName()
|
||||||
link.appId = appid
|
link.appId = appid
|
||||||
link.agentId = agentid
|
link.agentId = agentid
|
||||||
iwwapi?.sendMessage(link)
|
return iwwapi?.sendMessage(link) ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun sendMicroProgram() {
|
fun sendMicroProgram() {
|
||||||
|
|||||||
Reference in New Issue
Block a user