update 优化错误提示和响应速度

This commit is contained in:
gallonyin
2023-01-06 12:08:16 +08:00
parent 4684ebc927
commit bd6570bcdc
6 changed files with 16 additions and 3 deletions

View File

@@ -54,7 +54,7 @@ object Constant {
fun getMyConfig() = "${getBaseUrl()}/robot/robotInfo/get?robotId=$robotId" fun getMyConfig() = "${getBaseUrl()}/robot/robotInfo/get?robotId=$robotId"
fun getRobotUpdateUrl() = "${getBaseUrl()}/robot/robotInfo/update" fun getRobotUpdateUrl() = "${getBaseUrl()}/robot/robotInfo/update?robotId=$robotId"
fun getTestUrl() = "${getBaseUrl()}/test" fun getTestUrl() = "${getBaseUrl()}/test"

View File

@@ -142,6 +142,8 @@ public class WeworkMessageBean {
//消息id(解析指令时同步) //消息id(解析指令时同步)
public String messageId; public String messageId;
//api类型(解析指令时同步) 0=后台消息 1=API指令调用
public Integer apiSend;
//标题 通常是群名或联系人 //标题 通常是群名或联系人
public List<String> titleList; public List<String> titleList;

View File

@@ -28,6 +28,9 @@ class WeworkMessageListBean<T> {
//消息id //消息id
var messageId = TimeUtils.date2String(Date()).replace(" ", "#") + "#" + UUID.randomUUID() var messageId = TimeUtils.date2String(Date()).replace(" ", "#") + "#" + UUID.randomUUID()
//api类型 0=后台消息 1=API指令调用
var apiSend: Int? = null
//消息列表 //消息列表
var list: ArrayList<T> = arrayListOf() var list: ArrayList<T> = arrayListOf()

View File

@@ -191,8 +191,11 @@ fun uploadCommandResult(message: WeworkMessageBean, errorCode: Int, errorReason:
), true ), true
) )
if (errorCode != 0) { if (errorCode != 0) {
if (message.apiSend == 1) {
ToastUtils.show("错误提示 错误码: $errorCode 错误信息: $errorReason") ToastUtils.show("错误提示 错误码: $errorCode 错误信息: $errorReason")
} }
LogUtils.v("错误提示 错误码: $errorCode 错误信息: $errorReason")
}
} }
/** /**

View File

@@ -96,7 +96,10 @@ object MyLooper {
LogUtils.v("加入指令到执行队列", if (message.fileBase64.isNullOrEmpty()) GsonUtils.toJson(message) else message.type) LogUtils.v("加入指令到执行队列", if (message.fileBase64.isNullOrEmpty()) GsonUtils.toJson(message) else message.type)
getInstance().sendMessage(Message.obtain().apply { getInstance().sendMessage(Message.obtain().apply {
what = message.type * message.hashCode() what = message.type * message.hashCode()
obj = message.apply { messageId = messageList.messageId } obj = message.apply {
messageId = messageList.messageId
apiSend = messageList.apiSend
}
}) })
} }
getInstance().removeMessages(WeworkMessageBean.LOOP_RECEIVE_NEW_MESSAGE) getInstance().removeMessages(WeworkMessageBean.LOOP_RECEIVE_NEW_MESSAGE)

View File

@@ -86,6 +86,8 @@ object WeworkOperationImpl {
val startTime = System.currentTimeMillis() val startTime = System.currentTimeMillis()
if (receivedContent.isNullOrEmpty()) { if (receivedContent.isNullOrEmpty()) {
LogUtils.d("未发现回复内容") LogUtils.d("未发现回复内容")
uploadCommandResult(message, ExecCallbackBean.ERROR_ILLEGAL_DATA, "回复内容为空", startTime, listOf(), titleList)
goHome()
return false return false
} }
for (title in titleList) { for (title in titleList) {