v3.9.0 APP推送方法优化

This commit is contained in:
JEECG
2025-11-26 22:22:25 +08:00
parent fdf7cd1f6b
commit 435445cb4e

View File

@ -69,6 +69,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.PathMatcher; import org.springframework.util.PathMatcher;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import javax.sql.DataSource; import javax.sql.DataSource;
@ -93,8 +94,8 @@ public class SysBaseApiImpl implements ISysBaseAPI {
/** 当前系统数据库类型 */ /** 当前系统数据库类型 */
private static String DB_TYPE = ""; private static String DB_TYPE = "";
// 云函数的 URL 化地址 // uniapp 推送调用api地址
@Value("${jeecg.unicloud.pushUrl:''}") @Value("${jeecg.unicloud.pushUrl:}")
private String jeecgPushUrl; private String jeecgPushUrl;
@Autowired @Autowired
@ -2117,7 +2118,9 @@ public class SysBaseApiImpl implements ISysBaseAPI {
*/ */
@Override @Override
public void uniPushMsgToUser(PushMessageDTO pushMessageDTO) { public void uniPushMsgToUser(PushMessageDTO pushMessageDTO) {
if(oConvertUtils.isEmpty(jeecgPushUrl) || "??".equals(jeecgPushUrl)) { log.info("UniappPush推送URL:{}", jeecgPushUrl);
try {
if(oConvertUtils.isEmpty(jeecgPushUrl) || "''".equals(jeecgPushUrl) || "??".equals(jeecgPushUrl) ){
log.warn("yml配置项: jeecg.unicloud.pushUrl 未设置APP消息UniPush推送功能未启用"); log.warn("yml配置项: jeecg.unicloud.pushUrl 未设置APP消息UniPush推送功能未启用");
return; return;
} }
@ -2159,6 +2162,9 @@ public class SysBaseApiImpl implements ISysBaseAPI {
} else { } else {
log.error("{} UniPush消息推送失败 返回response:{}", pushType, response.getBody()); log.error("{} UniPush消息推送失败 返回response:{}", pushType, response.getBody());
} }
} catch (RestClientException e) {
log.warn("UniAPP 消息推送异常:"+ e.getMessage(), e);
}
} }
/** /**
* 根据用户名或用户ID获取clientIds * 根据用户名或用户ID获取clientIds