当有新文章发布menu里添加提示按钮思路


## 当用户点击菜单的时候查询出当前菜单里文章的最大id
select max(id) from contents where menu_id=27    //2036

## 存一条数据到user_join_menu表
userid:590
menuId:27
maxContentId:2036, 

## 通过user和menuId查出上次已读的最大文章id
select maxContentId from user_join_menu where userid=590 and menuId = 27; 


## 当用户刷新页面的时候再次请求接口获取最新的menuTree 
contnets表:select max(id) from contents where menu_id=27                                    //2037
user_join_menu表:select maxContentId from user_join_menu where userid=590 and menuId = 27; //2036

## 如果 contnets表 >  user_join_menu表 则 readFlag=true    表示有新消息 



## 当用户点击menu的时候,就update;
update user_join_menu set maxContentId = (select max(id) from contents where menu_id=27) 
where userid=590 menuId=27;

猜你喜欢

转载自blog.csdn.net/helloworld_dream/article/details/79015023