|
@@ -15,6 +15,8 @@ import com.zhentao.user.service.EmailService;
|
|
|
import com.zhentao.user.service.UserLoginService;
|
|
|
import com.zhentao.user.mapper.UserLoginMapper;
|
|
|
import com.zhentao.user.service.UserOnlineStatusService;
|
|
|
+import com.zhentao.userRelationships.domain.UserRelationships;
|
|
|
+import com.zhentao.userRelationships.service.UserRelationshipsService;
|
|
|
import com.zhentao.utils.HttpUtils;
|
|
|
import com.zhentao.utils.SnowflakeIdGenerator;
|
|
|
import com.zhentao.vo.Result;
|
|
@@ -30,11 +32,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Optional;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.UUID;
|
|
|
+import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
@@ -57,6 +55,8 @@ public class UserLoginServiceImpl extends ServiceImpl<UserLoginMapper, UserLogin
|
|
|
private EmailService emailService;
|
|
|
@Autowired
|
|
|
private UserOnlineStatusService onlineStatusService;
|
|
|
+ @Autowired
|
|
|
+ private UserRelationshipsService userRelationshipsService;
|
|
|
|
|
|
//注册
|
|
|
@Override
|
|
@@ -98,6 +98,7 @@ public class UserLoginServiceImpl extends ServiceImpl<UserLoginMapper, UserLogin
|
|
|
userLoginMapper.insert(user);
|
|
|
String token = TokenUtils.generateToken(user.getId().toString());
|
|
|
stringRedisTemplate.opsForValue().set(user.getId().toString(),token,10, TimeUnit.MINUTES);
|
|
|
+ this.Deekseep(user.getId());
|
|
|
return Result.OK(null,"注册成功");
|
|
|
}
|
|
|
if(userRegister.getType()==2){
|
|
@@ -106,12 +107,26 @@ public class UserLoginServiceImpl extends ServiceImpl<UserLoginMapper, UserLogin
|
|
|
userLoginMapper.insert(user);
|
|
|
String token = TokenUtils.generateToken(user.getId().toString());
|
|
|
stringRedisTemplate.opsForValue().set(user.getUserUsername(),token,10, TimeUnit.MINUTES);
|
|
|
+ this.Deekseep(user.getId());
|
|
|
return Result.OK(null,"注册成功");
|
|
|
}
|
|
|
}
|
|
|
return Result.ERR(null,"用户名已存在");
|
|
|
}
|
|
|
|
|
|
+ public void Deekseep(Long id){
|
|
|
+ UserLogin userLogin = userLoginMapper.selectById("1933707308387405824");
|
|
|
+ UserRelationships userRelationships = new UserRelationships();
|
|
|
+ userRelationships.setUserId(id);
|
|
|
+ userRelationships.setFriendId(userLogin.getId());
|
|
|
+ userRelationships.setStatus(1);
|
|
|
+ userRelationships.setCreatedAt(new Date());
|
|
|
+ userRelationships.setUpdatedAt(new Date());
|
|
|
+ userRelationships.setIsBlacklist(0);
|
|
|
+ userRelationships.setIsDel(0);
|
|
|
+ userRelationships.setIsMoments(0);
|
|
|
+ boolean save = userRelationshipsService.save(userRelationships);
|
|
|
+ }
|
|
|
|
|
|
//验证码
|
|
|
@Override
|
|
@@ -215,7 +230,7 @@ public class UserLoginServiceImpl extends ServiceImpl<UserLoginMapper, UserLogin
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
map.put("token",jwtToken);
|
|
|
map.put("userId",one.getId()+"");
|
|
|
- map.put("image",one.getUserName()+"");
|
|
|
+ map.put("image",one.getAvatar()+"");
|
|
|
//用户上线
|
|
|
onlineStatusService.userGoOnline(one.getId());
|
|
|
|