This commit is contained in:
jack ning
2025-04-29 12:49:04 +08:00
parent 7bc70ce212
commit d6303d0f09
4 changed files with 21 additions and 36 deletions

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-01-29 16:21:24
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-03-21 12:54:20
* @LastEditTime: 2025-04-29 12:37:47
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
* Please be aware of the BSL license restrictions before installing Bytedesk IM
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
@@ -40,9 +40,9 @@ public abstract class BaseResponse implements Serializable {
private String platform;
private LocalDateTime createdAt;
protected LocalDateTime createdAt;
private LocalDateTime updatedAt;
protected LocalDateTime updatedAt;
public String getCreatedAt() {
return BdDateUtils.formatDatetimeToString(createdAt);

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-02-21 10:00:55
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-04-27 13:08:35
* @LastEditTime: 2025-04-29 12:46:07
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
* Please be aware of the BSL license restrictions before installing Bytedesk IM
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
@@ -14,7 +14,6 @@
package com.bytedesk.core.message;
import com.bytedesk.core.base.BaseResponse;
import com.bytedesk.core.enums.ClientEnum;
import com.bytedesk.core.rbac.user.UserProtobuf;
import com.bytedesk.core.thread.ThreadResponse;
@@ -40,27 +39,26 @@ public class MessageResponse extends BaseResponse {
private static final long serialVersionUID = 1L;
// private String type;
private MessageTypeEnum type;
private String type;
// private MessageTypeEnum type;
private String content;
// private String status;
private MessageStatusEnum status;
private String status;
// private MessageStatusEnum status;
// private String client;
private ClientEnum client;
private String client;
// private ClientEnum client;
private ThreadResponse thread;
private UserProtobuf user;
// extra格式不固定前端需要根据type字段来解析所以此处不能使用MessageExtra
// private MessageExtra extra;
private String extra;
// 有帮助、没帮助
private String helpful;
// private String helpful;
// 通过解析user字段中的type字段来判断 type=robot则为机器人否则为访客
public boolean isRobot() {
@@ -80,4 +78,10 @@ public class MessageResponse extends BaseResponse {
return user.getType().toLowerCase().contains("system");
}
// 将createdAt转换为时间戳
public Long timestamp() {
// 使用中国时区与BdDateUtils保持一致
return this.createdAt.atZone(java.time.ZoneId.of("Asia/Shanghai")).toInstant().toEpochMilli();
}
}

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-03-01 17:20:46
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-04-27 22:46:45
* @LastEditTime: 2025-04-29 12:48:31
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
* Please be aware of the BSL license restrictions before installing Bytedesk IM
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
@@ -176,7 +176,6 @@ public class ConvertUtils {
MessageResponse messageResponse = modelMapper.map(message, MessageResponse.class);
//
if (message.getUser() != null) {
// UserProtobuf user = JSON.parseObject(message.getUser(), UserProtobuf.class);
UserProtobuf user = UserProtobuf.fromJson(message.getUser());
if (user.getExtra() == null) {
user.setExtra(BytedeskConsts.EMPTY_JSON_STRING);