123
This commit is contained in:
@@ -15,4 +15,8 @@ public interface UserOnlineService extends IService<UserOnline> {
|
||||
UserOnline getByUserId(Long userId);
|
||||
|
||||
OnlineStatusVo onlineStatus(Long userId, Integer openVideoStatus, Integer videoStatus, Integer isAnchor);
|
||||
|
||||
void activeUpdate();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,9 +6,12 @@ import com.ruoyi.cai.domain.UserOnline;
|
||||
import com.ruoyi.cai.dto.app.vo.user.OnlineStatusVo;
|
||||
import com.ruoyi.cai.mapper.UserOnlineMapper;
|
||||
import com.ruoyi.cai.service.UserOnlineService;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 用户在线状态Service业务层处理
|
||||
*
|
||||
@@ -55,4 +58,17 @@ public class UserOnlineServiceImpl extends ServiceImpl<UserOnlineMapper, UserOnl
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activeUpdate() {
|
||||
Long userId = LoginHelper.getUserId();
|
||||
UserOnline userOnline = this.getByUserId(userId);
|
||||
if(userOnline == null){
|
||||
return;
|
||||
}
|
||||
this.update(Wrappers.lambdaUpdate(UserOnline.class)
|
||||
.eq(UserOnline::getUserId,userId)
|
||||
.set(UserOnline::getStatus,1)
|
||||
.set(UserOnline::getLastLiveTime, LocalDateTime.now()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user