Commit 06e548e0 authored by hezhen's avatar hezhen

123

parent 995534dc
......@@ -52,6 +52,9 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
@Autowired
private AppUserDetailBiz appUserDetailBiz;
@Value("${admin.validTime}")
private Long validTime;
/**
* 关系绑定
* @param userId
......@@ -63,13 +66,16 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
return;
}
AppUserRelation relation=getMyBiz().getRelationByUserId(parentId);
Long time=System.currentTimeMillis();
if(relation==null){
relation=new AppUserRelation();
relation.setUserId(parentId);
relation.setIsForever(1);
relation.setBindTime(time);
relation.setBindType(type);
insertSelective(relation);
}
relation=getMyBiz().getRelationByUserId(userId);
Long time=System.currentTimeMillis();
if(relation==null){
relation=new AppUserRelation();
relation.setUserId(userId);
......@@ -78,7 +84,8 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
relation.setBindTime(time);
insertSelective(relation);
}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.setBindType(type);
relation.setBindTime(time);
......@@ -86,7 +93,6 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
}
}
}
//首页关系绑定
public ObjectRestResponse appBindRelation(Integer userId,String code){
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