REQ-3284: 推送声音

This commit is contained in:
yanglin 2024-12-03 10:53:03 +08:00
parent 4d1d6520e6
commit ab77cf915e

View File

@ -21,6 +21,7 @@ import cn.axzo.msg.center.nimpush.NimPushService;
import cn.axzo.msg.center.nimpush.PushChannel;
import cn.axzo.msg.center.nimpush.PushPeer;
import cn.axzo.msg.center.nimpush.device.PushDeviceSnapshots;
import cn.axzo.msg.center.nimpush.payload.intent.Intent;
import cn.axzo.msg.center.push.PushData;
import cn.axzo.msg.center.service.dto.PersonV3DTO;
import cn.axzo.msg.center.service.enums.Channel;
@ -32,6 +33,7 @@ import lombok.Data;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationContext;
import java.util.ArrayList;
@ -151,6 +153,8 @@ public class TemplateMessage {
PushData pushData = templateModel.getTemplate().parsePushData();
boolean pushable = pushData.determinePushable(log, getTemplateCode());
// 扩展信息
JSONObject ext = new JSONObject();
for (PersonV3DTO receiver : sendBasicInfo.receivers()) {
PersonV3DTO.ReceiveModel imReceiveModel = receiver.getImReceiveModel();
Long ouId = imReceiveModel == null ? sendBasicInfo.determineReceiversOuId() : imReceiveModel.getOuId();
@ -166,6 +170,8 @@ public class TemplateMessage {
excludePush.setPersonId(receiver.getId() + "");
excludePush.setAppType(appType);
imReq.getExcludePushPayloads().add(excludePush);
if (StringUtils.isNotBlank(pushData.getVoiceFile()))
ext.put(Intent.INTENT_SOUND, pushData.getVoiceFile());
}
receivers.add(new ReceivePerson(String.valueOf(receiver.getId()), ouId, appType));
@ -175,8 +181,6 @@ public class TemplateMessage {
cmpUnique.add(new OuAndPerson(ouId, receiver.getId()));
}
imReq.setReceivePersons(receivers);
// 扩展信息
JSONObject ext = new JSONObject();
ext.put("minAppVersion", templateModel.getTemplate().getMinAppVersion());
if (sample.getReceiverWorkspaceId() != null) {
ext.put("workspaceId", String.valueOf(sample.getReceiverWorkspaceId()));