解决web段发送的消息转发异常

This commit is contained in:
guozhen
2024-12-10 17:58:47 +08:00
committed by xuhuixiang
parent d6d3391ed5
commit cb05dda558
3 changed files with 16 additions and 7 deletions

View File

@@ -49,12 +49,12 @@ public interface ApiService {
/**
* 正式环境
*/
// String URL = "https://api.letschat2023.com/";
String URL = "https://api.letschat2023.com/";
/**
* 测试环境
*/
String URL = "https://api-test.letschat2023.com/";
//String URL = "https://api-test.letschat2023.com/";
String SUBSTATIONID = "1703655363476242434";

View File

@@ -672,7 +672,7 @@ public abstract class ChatBaseViewModel extends BaseViewModel {
String attachStr = forwardMessage.getAttachStr();
CustomMessageBean customMessageBean = GsonUtils.getObjFromJSON(attachStr, CustomMessageBean.class);
String data = GsonUtils.beanToJSONString(customMessageBean.getData());
if (TextUtils.isEmpty(customMessageBean.getType())) {
if (TextUtils.isEmpty(customMessageBean.getType()) || !isInteger(customMessageBean.getType())) {
return forwardMessage;
}
if (Integer.parseInt(customMessageBean.getType()) == ChatMessageType.CUSTOM_STICKER_ALBUMS) {
@@ -711,6 +711,15 @@ public abstract class ChatBaseViewModel extends BaseViewModel {
return forwardMessage;
}
private boolean isInteger(String type) {
try {
Integer.parseInt(type);
} catch (Exception e) {
return false;
}
return true;
}
public void sendLocationMessage(ChatLocationBean locationBean) {
ALog.d(LIB_TAG, TAG, "sendLocationMessage:" + locationBean);