Explorar el Código

新增极光消息已读

anderx hace 7 años
padre
commit
8bb4498caf

+ 12 - 0
src/main/java/com/goafanti/app/controller/AppUserController.java

@@ -240,6 +240,18 @@ public class AppUserController extends CertifyApiController {
 		messageService.updateMessageConsumer(messageId);
 		return res;
 	}
+	/**
+	 * 读取推送消息
+	 * @param messageId
+	 * @throws IllegalAccessException 
+	 * @throws InvocationTargetException 
+	 */
+	@RequestMapping(value = "/readJpushMessage",method = RequestMethod.GET)
+	private Result readJpushMessage(String messageId){
+		Result res = new Result();
+		res.data(messageService.pudateReadJpushMessage(messageId));
+		return res;
+	}
 
 	/**
 	 * 查询环信昵称和头像

+ 2 - 0
src/main/java/com/goafanti/common/dao/JtMessageConsumerMapper.java

@@ -80,4 +80,6 @@ public interface JtMessageConsumerMapper {
 	AppMessageBo selectById(String id);
 	
 	int addBatch(List<JtMessageConsumer> list);
+
+	JtMessageConsumer getMessageConsumer(@Param("messageId")String messageId, @Param("userId")String userId);
 }

+ 1 - 0
src/main/java/com/goafanti/message/service/MessageService.java

@@ -163,6 +163,7 @@ public interface MessageService {
 
 	 Pagination<AppMessageBo> applistMessage(Integer pageNo, Integer pageSize);
 	 AppMessageBo updateAppReadMessage(String id);
+	int pudateReadJpushMessage(String messageId);
 		
 
 	

+ 10 - 0
src/main/java/com/goafanti/message/service/impl/MessageServiceImpl.java

@@ -458,6 +458,16 @@ public class MessageServiceImpl  extends BaseMybatisDao<MessageFromSystemMapper>
 		return jtMessageConsumerMapper.selectById(id);
 	}
 
+	@Override
+	public int pudateReadJpushMessage(String messageId) {
+		JtMessageConsumer j=jtMessageConsumerMapper.getMessageConsumer(messageId,TokenManager.getUserId());
+		if (j!=null) {
+			j.setIsRead(true);
+			jtMessageConsumerMapper.updateByPrimaryKeySelective(j);
+		}
+		return 1;
+	}
+
 	
 
 }