| | |
| | | package cn.gistack.alerts.push.service.impl; |
| | | |
| | | import cn.gistack.alerts.push.service.IPushService; |
| | | import cn.gistack.alerts.push.utils.GeTuiUtils; |
| | | import cn.gistack.alerts.push.vo.PushVO; |
| | | import cn.gistack.alerts.push.vo.UniCloudReturnRes; |
| | | import cn.gistack.sm.message.entity.MessageRecord; |
| | |
| | | |
| | | private BladeRedis bladeRedis; |
| | | private IMessageClient messageClient; |
| | | private GeTuiUtils geTuiUtils; |
| | | |
| | | @Override |
| | | public Boolean saveCId(String userId,String cId) { |
| | |
| | | return pushMessage(pushVO); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean geTuiPushMessage(PushVO pushVO) { |
| | | |
| | | List<String> cIdList = new ArrayList<>(); |
| | | cIdList.add(getClientIdByUserId(pushVO.getUserId())); |
| | | return geTuiUtils.pushMsg(cIdList, pushVO.getTitle(), pushVO.getContent()); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户id从redis中获取cid |
| | | * |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | public String getClientIdByUserId(String userId){ |
| | | |
| | | if (Func.isEmpty(userId)) { |
| | | throw new ServiceException("请填写用户id!"); |
| | | } |
| | | |
| | | |
| | | return bladeRedis.get(PUSH_CLIENT_ID+userId); |
| | | } |
| | | |
| | | /** |
| | | * 消息推送 |
| | | * |
| | | * @param pushVO |
| | | * @return |
| | | */ |