Commit 06e548e0 authored by hezhen's avatar hezhen

123

parent 995534dc
...@@ -52,6 +52,9 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel ...@@ -52,6 +52,9 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
@Autowired @Autowired
private AppUserDetailBiz appUserDetailBiz; private AppUserDetailBiz appUserDetailBiz;
@Value("${admin.validTime}")
private Long validTime;
/** /**
* 关系绑定 * 关系绑定
* @param userId * @param userId
...@@ -63,13 +66,16 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel ...@@ -63,13 +66,16 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
return; return;
} }
AppUserRelation relation=getMyBiz().getRelationByUserId(parentId); AppUserRelation relation=getMyBiz().getRelationByUserId(parentId);
Long time=System.currentTimeMillis();
if(relation==null){ if(relation==null){
relation=new AppUserRelation(); relation=new AppUserRelation();
relation.setUserId(parentId); relation.setUserId(parentId);
relation.setIsForever(1);
relation.setBindTime(time);
relation.setBindType(type);
insertSelective(relation); insertSelective(relation);
} }
relation=getMyBiz().getRelationByUserId(userId); relation=getMyBiz().getRelationByUserId(userId);
Long time=System.currentTimeMillis();
if(relation==null){ if(relation==null){
relation=new AppUserRelation(); relation=new AppUserRelation();
relation.setUserId(userId); relation.setUserId(userId);
...@@ -78,7 +84,8 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel ...@@ -78,7 +84,8 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
relation.setBindTime(time); relation.setBindTime(time);
insertSelective(relation); insertSelective(relation);
}else { }else {
if(relation.getParentId()==null||relation.getParentId()==0||(relation.getIsForever()!=1&&(time-relation.getBindTime())>3600)){ //用户存在父id为0的不能成为任何人下线
if((relation.getIsForever()!=1&&(time-relation.getBindTime())>validTime)){
relation.setParentId(parentId); relation.setParentId(parentId);
relation.setBindType(type); relation.setBindType(type);
relation.setBindTime(time); relation.setBindTime(time);
...@@ -86,7 +93,6 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel ...@@ -86,7 +93,6 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
} }
} }
} }
//首页关系绑定 //首页关系绑定
public ObjectRestResponse appBindRelation(Integer userId,String code){ public ObjectRestResponse appBindRelation(Integer userId,String code){
Integer parentId=0; Integer parentId=0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment