[fix]修改信息回调
This commit is contained in:
parent
606ffbefdf
commit
ee92264adf
@ -18,6 +18,9 @@ import org.dromara.common.redis.utils.RedisUtils;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -184,7 +187,6 @@ public class IMCallbackServiceImpl implements IMCallbackService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 资料修改回调处理逻辑
|
// 资料修改回调处理逻辑
|
||||||
@Override
|
@Override
|
||||||
public IMCallbackVO handleProfileCallbackPortraitSet(Map<String, Object> callbackData) {
|
public IMCallbackVO handleProfileCallbackPortraitSet(Map<String, Object> callbackData) {
|
||||||
@ -218,6 +220,7 @@ public class IMCallbackServiceImpl implements IMCallbackService {
|
|||||||
return IMCallbackVO.success();
|
return IMCallbackVO.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 只更新 nickname/gender 字段
|
// 只更新 nickname/gender 字段
|
||||||
private void updateMemberProfile(Member member, String tag, Object value) {
|
private void updateMemberProfile(Member member, String tag, Object value) {
|
||||||
if (tag == null || value == null) {
|
if (tag == null || value == null) {
|
||||||
@ -236,6 +239,18 @@ public class IMCallbackServiceImpl implements IMCallbackService {
|
|||||||
member.setGender(0);
|
member.setGender(0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "Tag_Profile_IM_SelfSignature":
|
||||||
|
member.setMark(value.toString());
|
||||||
|
break;
|
||||||
|
case "Tag_Profile_IM_BirthDay":
|
||||||
|
// 1. 将字符串时间戳转换为长整数(1756828800 是秒级时间戳)
|
||||||
|
// 2. 转换为 Instant(UTC 时间)
|
||||||
|
Instant instant = Instant.ofEpochSecond((long) value);
|
||||||
|
|
||||||
|
// 3. 转换为 LocalDate(需指定时区,否则使用系统默认时区)
|
||||||
|
// 例如:使用上海时区(Asia/Shanghai)
|
||||||
|
LocalDate localDate = instant.atZone(ZoneId.of("Asia/Shanghai")).toLocalDate();
|
||||||
|
member.setBirthday(localDate);
|
||||||
default:
|
default:
|
||||||
log.debug("未处理的用户资料字段: tag={}, value={}", tag, value);
|
log.debug("未处理的用户资料字段: tag={}, value={}", tag, value);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user