Browse Source

还原无效代码

xsx 1 year ago
parent
commit
7323342430

+ 0 - 6
im-platform/src/main/java/com/bx/implatform/contant/RedisKey.java

@@ -10,11 +10,6 @@ public final class RedisKey {
      * 已读群聊消息位置(已读最大id)
      */
     public static final String IM_GROUP_READED_POSITION = "im:readed:group:position";
-
-    /**
-     * 私聊离线通知
-     */
-    public static final String IM_OFFLINE_NOTIFY_PRIVATE = "im:notify:private";
     /**
      * webrtc 单人通话
      */
@@ -57,5 +52,4 @@ public final class RedisKey {
      */
     public static final String IM_LOCK_RTC_GROUP =  "im:lock:rtc:group";
 
-
 }

+ 0 - 3
im-platform/src/main/java/com/bx/implatform/dto/LoginDTO.java

@@ -25,7 +25,4 @@ public class LoginDTO {
     @Schema(description = "用户密码")
     private String password;
 
-    @ApiModelProperty(value = "用户客户端id")
-    private String cid;
-
 }

+ 0 - 19
im-platform/src/main/java/com/bx/implatform/dto/LogoutDTO.java

@@ -1,19 +0,0 @@
-package com.bx.implatform.dto;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-
-@Data
-@ApiModel("用户登录DTO")
-public class LogoutDTO {
-
-    @ApiModelProperty(value = "用户客户端id")
-    private String cid;
-
-}

+ 0 - 5
im-platform/src/main/java/com/bx/implatform/entity/User.java

@@ -69,11 +69,6 @@ public class User {
      */
     private String reason;
 
-    /**
-     * 客户端id,用于uni-push推送
-     */
-    @TableField("cid")
-    private String cid;
     /**
      * 最后登录时间
      */

+ 4 - 32
im-platform/src/main/java/com/bx/implatform/listener/PrivateMessageListener.java

@@ -6,12 +6,10 @@ import com.bx.imclient.annotation.IMListener;
 import com.bx.imclient.listener.MessageListener;
 import com.bx.imcommon.enums.IMListenerType;
 import com.bx.imcommon.enums.IMSendCode;
-import com.bx.imcommon.enums.IMTerminalType;
 import com.bx.imcommon.model.IMSendResult;
 import com.bx.implatform.entity.PrivateMessage;
 import com.bx.implatform.enums.MessageStatus;
 import com.bx.implatform.service.PrivateMessageService;
-import com.bx.implatform.service.INotifyPrivateService;
 import com.bx.implatform.vo.PrivateMessageVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -24,36 +22,22 @@ import java.util.Set;
 @Slf4j
 @IMListener(type = IMListenerType.PRIVATE_MESSAGE)
 public class PrivateMessageListener implements MessageListener<PrivateMessageVO> {
-
     @Lazy
     @Autowired
     private PrivateMessageService privateMessageService;
-
-    @Lazy
-    @Autowired
-    private NotifyPrivateService uniPushService;
-
     @Override
     public void process(List<IMSendResult<PrivateMessageVO>> results) {
-        // 更新消息状态
-        updateMessageStatus(results);
-        // 推送离线通知
-        sendOfflineNotify(results);
-    }
-
-    private void updateMessageStatus(List<IMSendResult<PrivateMessageVO>> results) {
         Set<Long> messageIds = new HashSet<>();
-        for (IMSendResult<PrivateMessageVO> result : results) {
+        for(IMSendResult<PrivateMessageVO> result : results){
             PrivateMessageVO messageInfo = result.getData();
             // 更新消息状态,这里只处理成功消息,失败的消息继续保持未读状态
             if (result.getCode().equals(IMSendCode.SUCCESS.code())) {
                 messageIds.add(messageInfo.getId());
-                log.info("消息送达,消息id:{},发送者:{},接收者:{},终端:{}", messageInfo.getId(),
-                    result.getSender().getId(), result.getReceiver().getId(), result.getReceiver().getTerminal());
+                log.info("消息送达,消息id:{},发送者:{},接收者:{},终端:{}", messageInfo.getId(), result.getSender().getId(), result.getReceiver().getId(), result.getReceiver().getTerminal());
             }
         }
-        // 对发送成功的消息修改状态
-        if (CollUtil.isNotEmpty(messageIds)) {
+        // 批量修改状态
+        if(CollUtil.isNotEmpty(messageIds)){
             UpdateWrapper<PrivateMessage> updateWrapper = new UpdateWrapper<>();
             updateWrapper.lambda().in(PrivateMessage::getId, messageIds)
                 .eq(PrivateMessage::getStatus, MessageStatus.UNSEND.code())
@@ -61,16 +45,4 @@ public class PrivateMessageListener implements MessageListener<PrivateMessageVO>
             privateMessageService.update(updateWrapper);
         }
     }
-
-    private void sendOfflineNotify(List<IMSendResult<PrivateMessageVO>> results) {
-        for (IMSendResult<PrivateMessageVO> result : results) {
-            PrivateMessageVO messageInfo = result.getData();
-            if (result.getCode().equals(IMSendCode.SUCCESS.code()) && result.getReceiver().getTerminal()
-                .equals(IMTerminalType.APP.code())) {
-                uniPushService.sendMessage(messageInfo.getSendId(), messageInfo.getRecvId(), messageInfo.getContent());
-                log.info("推送离线通知,消息id:{},发送者:{},接收者:{}", messageInfo.getId(), result.getSender().getId(),
-                    result.getReceiver().getId());
-            }
-        }
-    }
 }

+ 0 - 107
im-platform/src/main/java/com/bx/implatform/service/INotifyPrivateService.java

@@ -1,107 +0,0 @@
-package com.bx.implatform.service;
-
-import cn.hutool.core.util.StrUtil;
-import com.bx.implatform.contant.RedisKey;
-import com.bx.implatform.entity.User;
-import com.bx.implatform.session.NotifySession;
-import com.bx.implatform.service.thirdparty.UniPushService;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Lazy;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-/**
- * 私聊离线通知服务
- *
- * @author: blue
- * @date: 2024-07-06
- * @version: 1.0
- */
-@Slf4j
-@Service
-@RequiredArgsConstructor
-public class INotifyPrivateService {
-    @Lazy
-    @Autowired
-    private IUserService userService;
-    private final UniPushService uniPushService;
-    private final RedisTemplate<String, Object> redisTemplate;
-    @Value("${notify.enable}")
-    private Boolean enable = false;
-    @Value("${notify.max.private}")
-    private Integer max = -1;
-    public void sendMessage(Long sendId, Long recvId, String content) {
-        if(!enable){
-            return;
-        }
-        NotifySession session = findNotifySession(sendId, recvId);
-        if (Objects.isNull(session)) {
-            session = createNotifySession(sendId, recvId);
-        }
-        // 未上报cid,无法推送
-        if (StrUtil.isEmpty(session.getCid())) {
-            log.info("用户'{}'未上报cid,无法推送离线通知", recvId);
-            return;
-        }
-        // 已达到最大数量
-        if (max > 0 && session.getCount() >= max) {
-            log.info("用户'{}'已到达推送数量上线,不再推送离线通知", recvId);
-            return;
-        }
-        // 消息数量加1
-        session.setCount(session.getCount()+1);
-        String body = String.format("%s:%s", session.getSendNickName(),content);
-        // 大于1条时需要展示数量
-        if (session.getCount() > 1) {
-            body = String.format("[%d条] ", session.getCount()) + body;
-        }
-        uniPushService.pushByCid(session,body);
-        // 保存会话
-        saveNotifySession(session,sendId,recvId);
-    }
-
-    public void removeNotifySession( Long recvId){
-        String key = StrUtil.join(":", RedisKey.IM_OFFLINE_NOTIFY_PRIVATE, "*", recvId);
-        Set<String> keys =  redisTemplate.keys(key);
-        redisTemplate.delete(keys);
-    }
-
-    public void removeNotifySession(Long sendId, Long recvId){
-        String key = StrUtil.join(":", RedisKey.IM_OFFLINE_NOTIFY_PRIVATE, sendId, recvId);
-        redisTemplate.delete(key);
-    }
-
-    private NotifySession createNotifySession(Long sendId, Long recvId) {
-        String key = StrUtil.join(":", RedisKey.IM_OFFLINE_NOTIFY_PRIVATE, sendId, recvId);
-        User sendUser = userService.getById(sendId);
-        User recvUser = userService.getById(recvId);
-        NotifySession session = new NotifySession();
-        session.setCount(0);
-        session.setCid(recvUser.getCid());
-        session.setTitle(sendUser.getNickName());
-        session.setSendNickName(sendUser.getNickName());
-        session.setNotifyId(Math.abs(key.hashCode()));
-        session.setLogo(sendUser.getHeadImageThumb());
-        redisTemplate.opsForValue().set(key, session, 30, TimeUnit.DAYS);
-        return session;
-    }
-
-    private NotifySession findNotifySession(Long sendId, Long recvId) {
-        String key = StrUtil.join(":", RedisKey.IM_OFFLINE_NOTIFY_PRIVATE, sendId, recvId);
-        return (NotifySession)redisTemplate.opsForValue().get(key);
-    }
-
-    private void saveNotifySession(NotifySession session, Long sendId, Long recvId) {
-        String key = StrUtil.join(":", RedisKey.IM_OFFLINE_NOTIFY_PRIVATE, sendId, recvId);
-        redisTemplate.opsForValue().set(key, session);
-    }
-
-}

+ 0 - 9
im-platform/src/main/java/com/bx/implatform/service/UserService.java

@@ -2,7 +2,6 @@ package com.bx.implatform.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.bx.implatform.dto.LoginDTO;
-import com.bx.implatform.dto.LogoutDTO;
 import com.bx.implatform.dto.ModifyPwdDTO;
 import com.bx.implatform.dto.RegisterDTO;
 import com.bx.implatform.entity.User;
@@ -22,14 +21,6 @@ public interface UserService extends IService<User> {
      */
     LoginVO login(LoginDTO dto);
 
-    /**
-     * 用户退出登陆
-     *
-     * @param dto 退出登陆dto
-     * @return
-     */
-    void logout(LogoutDTO dto);
-
     /**
      * 修改用户密码
      *

+ 14 - 18
im-platform/src/main/java/com/bx/implatform/service/impl/PrivateMessageServiceImpl.java

@@ -20,7 +20,6 @@ import com.bx.implatform.exception.GlobalException;
 import com.bx.implatform.mapper.PrivateMessageMapper;
 import com.bx.implatform.service.FriendService;
 import com.bx.implatform.service.PrivateMessageService;
-import com.bx.implatform.service.NotifyPrivateService;
 import com.bx.implatform.session.SessionContext;
 import com.bx.implatform.session.UserSession;
 import com.bx.implatform.util.BeanUtils;
@@ -44,7 +43,7 @@ public class PrivateMessageServiceImpl extends ServiceImpl<PrivateMessageMapper,
     private final FriendService friendService;
     private final IMClient imClient;
     private final SensitiveFilterUtil sensitiveFilterUtil;
-    private final INotifyPrivateService notifyPrivateService;
+
     @Override
     public PrivateMessageVO sendMessage(PrivateMessageDTO dto) {
         UserSession session = SessionContext.getSession();
@@ -122,13 +121,13 @@ public class PrivateMessageServiceImpl extends ServiceImpl<PrivateMessageMapper,
         long stIdx = (page - 1) * size;
         QueryWrapper<PrivateMessage> wrapper = new QueryWrapper<>();
         wrapper.lambda().and(wrap -> wrap.and(
-                wp -> wp.eq(PrivateMessage::getSendId, userId)
+                    wp -> wp.eq(PrivateMessage::getSendId, userId)
                         .eq(PrivateMessage::getRecvId, friendId))
                 .or(wp -> wp.eq(PrivateMessage::getRecvId, userId)
-                        .eq(PrivateMessage::getSendId, friendId)))
-                .ne(PrivateMessage::getStatus, MessageStatus.RECALL.code())
-                .orderByDesc(PrivateMessage::getId)
-                .last("limit " + stIdx + "," + size);
+                    .eq(PrivateMessage::getSendId, friendId)))
+            .ne(PrivateMessage::getStatus, MessageStatus.RECALL.code())
+            .orderByDesc(PrivateMessage::getId)
+            .last("limit " + stIdx + "," + size);
 
         List<PrivateMessage> messages = this.list(wrapper);
         List<PrivateMessageVO> messageInfos = messages.stream().map(m -> BeanUtils.copyProperties(m, PrivateMessageVO.class)).collect(Collectors.toList());
@@ -216,13 +215,10 @@ public class PrivateMessageServiceImpl extends ServiceImpl<PrivateMessageMapper,
         // 修改消息状态为已读
         LambdaUpdateWrapper<PrivateMessage> updateWrapper = Wrappers.lambdaUpdate();
         updateWrapper.eq(PrivateMessage::getSendId, friendId)
-                .eq(PrivateMessage::getRecvId, session.getUserId())
-                .eq(PrivateMessage::getStatus, MessageStatus.SENDED.code())
-                .set(PrivateMessage::getStatus, MessageStatus.READED.code());
+            .eq(PrivateMessage::getRecvId, session.getUserId())
+            .eq(PrivateMessage::getStatus, MessageStatus.SENDED.code())
+            .set(PrivateMessage::getStatus, MessageStatus.READED.code());
         this.update(updateWrapper);
-        // 清除通知会话信息
-        notifyPrivateService.removeNotifySession(friendId,session.getUserId());
-
         log.info("消息已读,接收方id:{},发送方id:{}", session.getUserId(), friendId);
     }
 
@@ -232,11 +228,11 @@ public class PrivateMessageServiceImpl extends ServiceImpl<PrivateMessageMapper,
         UserSession session = SessionContext.getSession();
         LambdaQueryWrapper<PrivateMessage> wrapper = Wrappers.lambdaQuery();
         wrapper.eq(PrivateMessage::getSendId, session.getUserId())
-                .eq(PrivateMessage::getRecvId, friendId)
-                .eq(PrivateMessage::getStatus, MessageStatus.READED.code())
-                .orderByDesc(PrivateMessage::getId)
-                .select(PrivateMessage::getId)
-                .last("limit 1");
+            .eq(PrivateMessage::getRecvId, friendId)
+            .eq(PrivateMessage::getStatus, MessageStatus.READED.code())
+            .orderByDesc(PrivateMessage::getId)
+            .select(PrivateMessage::getId)
+            .last("limit 1");
         PrivateMessage message = this.getOne(wrapper);
         if(Objects.isNull(message)){
             return -1L;

+ 0 - 28
im-platform/src/main/java/com/bx/implatform/service/impl/UserServiceImpl.java

@@ -1,9 +1,7 @@
 package com.bx.implatform.service.impl;
 
-import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -12,7 +10,6 @@ import com.bx.imcommon.enums.IMTerminalType;
 import com.bx.imcommon.util.JwtUtil;
 import com.bx.implatform.config.JwtProperties;
 import com.bx.implatform.dto.LoginDTO;
-import com.bx.implatform.dto.LogoutDTO;
 import com.bx.implatform.dto.ModifyPwdDTO;
 import com.bx.implatform.dto.RegisterDTO;
 import com.bx.implatform.entity.Friend;
@@ -23,7 +20,6 @@ import com.bx.implatform.exception.GlobalException;
 import com.bx.implatform.mapper.UserMapper;
 import com.bx.implatform.service.FriendService;
 import com.bx.implatform.service.GroupMemberService;
-import com.bx.implatform.service.NotifyPrivateService;
 import com.bx.implatform.service.UserService;
 import com.bx.implatform.session.SessionContext;
 import com.bx.implatform.session.UserSession;
@@ -33,7 +29,6 @@ import com.bx.implatform.vo.OnlineTerminalVO;
 import com.bx.implatform.vo.UserVO;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.logging.log4j.util.Strings;
 import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -51,7 +46,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
     private final FriendService friendService;
     private final JwtProperties jwtProperties;
     private final IMClient imClient;
-    private final INotifyPrivateService notifyPrivateService;
 
     @Override
     public LoginVO login(LoginDTO dto) {
@@ -66,14 +60,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
         if (!passwordEncoder.matches(dto.getPassword(), user.getPassword())) {
             throw new GlobalException(ResultCode.PASSWOR_ERROR);
         }
-        // 更新用户登陆时间和cid
-        user.setLastLoginTime(new Date());
-        // 用户更换了设备,记录新的cid
-        if(StrUtil.isNotEmpty(dto.getCid()) && dto.getCid().equals(user.getCid())){
-            user.setCid(dto.getCid());
-            notifyPrivateService.removeNotifySession(user.getId());
-        }
-        this.updateById(user);
         // 生成token
         UserSession session = BeanUtils.copyProperties(user, UserSession.class);
         session.setUserId(user.getId());
@@ -91,20 +77,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
         return vo;
     }
 
-    @Override
-    public void logout(LogoutDTO dto) {
-        UserSession session = SessionContext.getSession();
-        if(StrUtil.isNotEmpty(dto.getCid())){
-            // 清除cid,不再推送离线通知
-            notifyPrivateService.removeNotifySession(session.getUserId());
-            LambdaUpdateWrapper<User> wrapper =  Wrappers.lambdaUpdate();
-            wrapper.eq(User::getId,session.getUserId());
-            wrapper.eq(User::getCid,dto.getCid());
-            wrapper.set(User::getCid, Strings.EMPTY);
-            this.update(wrapper);
-        }
-    }
-
     @Override
     public LoginVO refreshToken(String refreshToken) {
         //验证 token

+ 0 - 122
im-platform/src/main/java/com/bx/implatform/service/thirdparty/UniPushService.java

@@ -1,122 +0,0 @@
-package com.bx.implatform.service.thirdparty;
-
-import com.bx.implatform.session.NotifySession;
-import com.getui.push.v2.sdk.api.PushApi;
-import com.getui.push.v2.sdk.common.ApiResult;
-import com.getui.push.v2.sdk.dto.req.Audience;
-import com.getui.push.v2.sdk.dto.req.Settings;
-import com.getui.push.v2.sdk.dto.req.message.PushChannel;
-import com.getui.push.v2.sdk.dto.req.message.PushDTO;
-import com.getui.push.v2.sdk.dto.req.message.PushMessage;
-import com.getui.push.v2.sdk.dto.req.message.android.AndroidDTO;
-import com.getui.push.v2.sdk.dto.req.message.android.GTNotification;
-import com.getui.push.v2.sdk.dto.req.message.android.ThirdNotification;
-import com.getui.push.v2.sdk.dto.req.message.android.Ups;
-import com.getui.push.v2.sdk.dto.req.message.ios.Alert;
-import com.getui.push.v2.sdk.dto.req.message.ios.Aps;
-import com.getui.push.v2.sdk.dto.req.message.ios.IosDTO;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Component;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author: 谢绍许
- * @date: 2024-07-06
- * @version: 1.0
- */
-@Slf4j
-@Component
-@RequiredArgsConstructor
-public class UniPushService {
-
-    private final PushApi pushApi;
-
-    public void pushByCid(NotifySession session, String body){
-        //根据cid进行单推
-        PushDTO<Audience> pushDTO = new PushDTO<Audience>();
-        // 设置推送参数,requestid需要每次变化唯一
-        pushDTO.setRequestId(System.currentTimeMillis()+"");
-        Settings settings = new Settings();
-        pushDTO.setSettings(settings);
-        //消息有效期,走厂商消息必须设置该值
-        settings.setTtl(3600000);
-        //在线走个推通道时推送的消息体
-        PushMessage pushMessage = new PushMessage();
-        pushDTO.setPushMessage(pushMessage);
-        //此格式的透传消息由 unipush 做了特殊处理,会自动展示通知栏。开发者也可自定义其它格式,在客户端自己处理。
-        GTNotification gtNotification = new GTNotification();
-        gtNotification.setTitle(session.getTitle());
-        gtNotification.setBody(body);
-        gtNotification.setClickType("startapp");
-        gtNotification.setNotifyId(session.getNotifyId().toString());
-        gtNotification.setLogoUrl(session.getLogo());
-        gtNotification.setBadgeAddNum("1");
-        pushMessage.setNotification(gtNotification);
-        // 设置接收人信息
-        Audience audience = new Audience();
-        pushDTO.setAudience(audience);
-        audience.addCid(session.getCid());
-        //设置离线推送时的消息体
-        PushChannel pushChannel = new PushChannel();
-        //安卓离线厂商通道推送的消息体
-        AndroidDTO androidDTO = new AndroidDTO();
-        Ups ups = new Ups();
-        ThirdNotification thirdNotification = new ThirdNotification();
-        ups.setNotification(thirdNotification);
-        ups.setOptions(buildOptions(session.getLogo()));
-        thirdNotification.setTitle(session.getTitle());
-        thirdNotification.setBody(body);
-        thirdNotification.setNotifyId(session.getNotifyId().toString());
-        // 打开首页
-        thirdNotification.setClickType("startapp");
-        androidDTO.setUps(ups);
-        pushChannel.setAndroid(androidDTO);
-        // ios离线apn通道推送的消息体
-        Alert alert = new Alert();
-        alert.setTitle(session.getTitle());
-        alert.setBody(body);
-        Aps aps = new Aps();
-        // 0:普通通知消息  1:静默推送(无通知栏消息),静默推送时不需要填写其他参数。苹果建议1小时最多推送3条静默消息
-        aps.setContentAvailable(0);
-        // default: 系统铃声  不填:无声
-        aps.setSound("default");
-        aps.setAlert(alert);
-
-        IosDTO iosDTO = new IosDTO();
-        iosDTO.setAps(aps);
-        iosDTO.setType("notify");
-        pushChannel.setIos(iosDTO);
-        pushDTO.setPushChannel(pushChannel);
-        // 进行cid单推
-        ApiResult<Map<String, Map<String, String>>> apiResult = pushApi.pushToSingleByCid(pushDTO);
-        if (apiResult.isSuccess()) {
-            log.info("推送成功,{}",apiResult.getData());
-        } else {
-            log.info("推送失败,code:{},msg:{}",apiResult.getCode(),apiResult.getMsg());
-        }
-    }
-
-
-    private Map<String, Map<String, Object>> buildOptions(String logo){
-        Map<String, Map<String, Object>> options = new HashMap<>();
-        // 小米
-        Map<String,Object> xm = new HashMap<>();
-        xm.put("/extra.notification_style_type",1);
-        xm.put("/extra.notification_large_icon_uri",logo);
-        options.put("XM",xm);
-        // 华为
-        Map<String,Object> hw = new HashMap<>();
-        hw.put("/message/android/notification/image",logo);
-        hw.put("/message/android/notification/style",1);
-        options.put("HW",hw);
-        // 荣耀
-        Map<String,Object> ho = new HashMap<>();
-        hw.put("/android/notification/badge/addNum",1);
-        hw.put("/android/notification/icon",logo);
-        options.put("HW",hw);
-        return options;
-    }
-}

+ 0 - 17
im-uniapp/App.vue

@@ -21,7 +21,6 @@
 				store.dispatch("load").then(() => {
 					// 初始化websocket
 					this.initWebSocket();
-					this.initUniPush();
 				}).catch((e) => {
 					console.log(e);
 					this.exit();
@@ -331,21 +330,6 @@
 					url: '/user/self',
 					method: 'GET'
 				})
-			},
-			initUniPush(){
-				// #ifdef APP-PLUS  
-					plus.push.setAutoNotification(true);
-					const clientInfo = plus.push.getClientInfo();
-					console.log("clientInfo",clientInfo);
-					plus.push.addEventListener('click', (message)=>{
-						const messages = plus.push.getAllMessage();
-						console.log("messages",messages)
-						console.log("click",message)
-					});  
-					plus.push.addEventListener('receive', (message)=>{
-						console.log("receive",message)
-					});  
-				// #endif  
 			}
 		},
 		onLaunch() {
@@ -367,7 +351,6 @@
 				})
 				// #endif
 			}
-			
 		}
 	}
 </script>

+ 1 - 7
im-uniapp/pages/login/login.vue

@@ -23,8 +23,7 @@
 				loginForm: {
 					terminal: 1, // APP终端
 					userName: '',
-					password: '',
-					cid: ''
+					password: ''
 				},
 				rules: {
 					userName: {
@@ -44,11 +43,6 @@
 		},
 		methods: {
 			submit() {
-				// APP需要上报cid,用于离线推送
-				// #ifdef APP-PLUS
-					const clientInfo = plus.push.getClientInfo();
-					this.loginForm.cid = clientInfo.clientid;
-				// #endif  
 				this.$http({
 					url: '/login',
 					data: this.loginForm,