Browse Source

小程序首页显示BUG修改,添加结束时间小于当前时间或者开始时间大于当前时间不显示

anderx 4 weeks ago
parent
commit
608a2063f9

+ 10 - 3
src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java

@@ -2949,25 +2949,32 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 
 	@Override
 	public Object getMyNewPublic() {
+
 		List<PublicRelease> myPublic=publicReleaseMapper.selectMyNewPublic(TokenManager.getAdminId());
 		if(myPublic.isEmpty())return null;
 		Integer id=null;
 		long count=999999;
+		long nowTime=System.currentTimeMillis();
 		for (PublicRelease e : myPublic) {
-			long nowTime=System.currentTimeMillis();
+			long start=e.getReleaseStart().getTime();
+			long end=e.getReleaseEnd().getTime();
+			//添加结束时间小于当前时间或者开始时间大于当前时间不显示
+			if (end<nowTime||start>nowTime){
+				continue;
+			}
 			long time = Math.abs(nowTime-e.getReleaseStart().getTime())/(1000*60);
 			long time2 = Math.abs(e.getReleaseEnd().getTime()-nowTime)/(1000*60);
 
 			//距离当前时间近的开始时间,不大于当前时间
 			if (time<count&&e.getReleaseStart().getTime()<nowTime){
-				if (e.getAlone()!=1 && e.getAssist()!=1){
+				if (e.getAlone()!=1 ){
 					count=time;
 					id=e.getId();
 				}
 			}
 			//距离当前时间近的结束时间,不小于当前时间
 			if (time2<count&&e.getReleaseEnd().getTime()>nowTime){
-				if (e.getAlone()!=1 && e.getAssist()!=1){
+				if (e.getAlone()!=1 ){
 					count=time2;
 					id=e.getId();
 				}