数据
This commit is contained in:
@@ -7,6 +7,7 @@ import lombok.Data;
|
|||||||
public class AnchorTopResp {
|
public class AnchorTopResp {
|
||||||
@Schema(description = "置顶是否成功")
|
@Schema(description = "置顶是否成功")
|
||||||
private boolean topSuccess;
|
private boolean topSuccess;
|
||||||
|
// private String topFailMessage;
|
||||||
@Schema(description = "下一次置顶间隔(秒)")
|
@Schema(description = "下一次置顶间隔(秒)")
|
||||||
private Long nextTopDate = 0L;
|
private Long nextTopDate = 0L;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -302,12 +302,13 @@ public class CurrentUserManager {
|
|||||||
if(lock.isLocked()){
|
if(lock.isLocked()){
|
||||||
throw new ServiceException("操作太频繁");
|
throw new ServiceException("操作太频繁");
|
||||||
}
|
}
|
||||||
|
long inter = 0;
|
||||||
try {
|
try {
|
||||||
lock.lock(3, TimeUnit.SECONDS);
|
lock.lock(3, TimeUnit.SECONDS);
|
||||||
String userGreetSendTime = String.format(RedisHttpConstant.ANCHOR_TOP_TIME_REDIS,userId); // 最近一次的发送时间
|
String userGreetSendTime = String.format(RedisHttpConstant.ANCHOR_TOP_TIME_REDIS,userId); // 最近一次的发送时间
|
||||||
String lastTime = stringRedisTemplate.opsForValue().get(userGreetSendTime);
|
String lastTime = stringRedisTemplate.opsForValue().get(userGreetSendTime);
|
||||||
if(StringUtils.isNotBlank(lastTime)){
|
if(StringUtils.isNotBlank(lastTime)){
|
||||||
int inter = systemConfigManager.getSystemConfigOfInt(SystemConfigEnum.ANCHOR_TOP_MIN) * 60;
|
inter = systemConfigManager.getSystemConfigOfInt(SystemConfigEnum.ANCHOR_TOP_MIN) * 60;
|
||||||
long jiange = DateUtil.currentSeconds() - Long.parseLong(lastTime); // 距离上次发送的间隔
|
long jiange = DateUtil.currentSeconds() - Long.parseLong(lastTime); // 距离上次发送的间隔
|
||||||
long diff = inter - jiange;
|
long diff = inter - jiange;
|
||||||
if(diff > 0){
|
if(diff > 0){
|
||||||
@@ -326,6 +327,7 @@ public class CurrentUserManager {
|
|||||||
}
|
}
|
||||||
AnchorTopResp resp = new AnchorTopResp();
|
AnchorTopResp resp = new AnchorTopResp();
|
||||||
resp.setTopSuccess(true);
|
resp.setTopSuccess(true);
|
||||||
|
resp.setNextTopDate(inter);
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user