123
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.cai.manager;
|
||||
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.cai.domain.Rank;
|
||||
import com.ruoyi.cai.domain.User;
|
||||
@@ -44,27 +45,36 @@ public class AwardManager {
|
||||
@Autowired
|
||||
private YunxinHttpService yunxinHttpService;
|
||||
|
||||
public void giveJoinAnchorAsync(Long userId){
|
||||
public void giveJoinAnchorAsync(Long anchorUserId){
|
||||
AwardManager bean = SpringUtil.getBean(AwardManager.class);
|
||||
ExecutorConstant.COMMON_EXECUTOR.execute(() -> {
|
||||
bean.giveJoinAnchor(userId);
|
||||
bean.giveJoinAnchor(anchorUserId);
|
||||
});
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void giveJoinAnchor(Long userId) {
|
||||
public void giveJoinAnchor(Long anchorUserId) {
|
||||
Long price = systemConfigManager.getSystemConfigOfLong(SystemConfigEnum.JOIN_ANCHOR_INVITE_AWARD);
|
||||
if(price == 0){
|
||||
return;
|
||||
}
|
||||
User user = userService.getById(userId);
|
||||
if(user == null){
|
||||
log.error("主播入驻邀请奖励领取失败 用户不存在 userId={}",userId);
|
||||
User anchorUser = userService.getById(anchorUserId);
|
||||
if(anchorUser == null){
|
||||
log.error("主播入驻邀请奖励领取失败 主播不存在 userId={}",anchorUserId);
|
||||
return;
|
||||
}
|
||||
// accountMapper.incsIncomeCoin(userId,price);
|
||||
// accountChangeLogService.saveLogNoAdmin(user.getId(),user.getUsercode(), AccountChangeCodeEnum.FAST_PAY_AWARD,price,traceId);
|
||||
|
||||
Long inviteUserId = anchorUser.getInviteId();
|
||||
if(inviteUserId == null){
|
||||
log.warn("主播邀请入驻无需分成,没有检测到邀请人 anchorUser={}", JSON.toJSONString(anchorUser));
|
||||
return;
|
||||
}
|
||||
User inviteUser = userService.getById(inviteUserId);
|
||||
if(inviteUser == null){
|
||||
log.error("主播邀请入驻无需分成,没有检测到邀请人,邀请人不存在 anchorUser={}", JSON.toJSONString(anchorUser));
|
||||
return;
|
||||
}
|
||||
accountMapper.incsIncomeCoin(inviteUser.getId(),price);
|
||||
accountChangeLogService.saveLogNoAdmin(inviteUser.getId(),inviteUser.getUsercode(), AccountChangeCodeEnum.JOIN_ANCHOR_INVITE,price,null,anchorUserId);
|
||||
}
|
||||
|
||||
public void giveRegisterAsync(Long userId){
|
||||
|
||||
@@ -154,15 +154,7 @@ public class HomeManager {
|
||||
config.setOssDomain(systemConfigManager.getSystemConfig(SystemConfigEnum.COS_DOMAIN));
|
||||
config.setOpenWithdraw(systemConfigManager.getSystemConfigOfBool(SystemConfigEnum.OPEN_WITHDRAW));
|
||||
Long userId = LoginHelper.getUserId();
|
||||
User user = userService.getById(userId);
|
||||
String imei = ServletUtils.getImei();
|
||||
UserForbidManager.CheckForbid forbid = userForbidManager.checkForbid(user.getId(), user.getUsercode(), imei, ServletUtils.getClientIP());
|
||||
if(forbid != null && forbid.isForbid()){
|
||||
throw new ServiceException(forbid.getMessage());
|
||||
}
|
||||
if(user.getStatus() != 0){
|
||||
throw new ServiceException("用户已封禁,请联系客服");
|
||||
}
|
||||
userForbidManager.checkForbid(userId);
|
||||
if(userId != null){
|
||||
LoginNotifyDTO loginUserDTO = new LoginNotifyDTO();
|
||||
loginUserDTO.setUserId(userId);
|
||||
|
||||
@@ -17,6 +17,8 @@ import com.ruoyi.cai.mq.handleDelay.dto.ForbidDelayDto;
|
||||
import com.ruoyi.cai.service.*;
|
||||
import com.ruoyi.cai.util.CaiDateUtil;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -124,6 +126,31 @@ public class UserForbidManager {
|
||||
userForbidService.forbid(userForbidLog,user);
|
||||
}
|
||||
|
||||
public void checkForbid(User user){
|
||||
Long userId = null;
|
||||
String userCode = null;
|
||||
if(user != null){
|
||||
userCode = user.getUsercode();
|
||||
userId = user.getId();
|
||||
}
|
||||
String imei = ServletUtils.getImei();
|
||||
UserForbidManager.CheckForbid forbid = this.checkForbid(userId, userCode, imei, ServletUtils.getClientIP());
|
||||
if(forbid != null && forbid.isForbid()){
|
||||
throw new ServiceException(forbid.getMessage());
|
||||
}
|
||||
if(user != null && user.getStatus() != 0){
|
||||
throw new ServiceException("用户已封禁,请联系客服");
|
||||
}
|
||||
}
|
||||
|
||||
public void checkForbid(Long userId){
|
||||
User user = null;
|
||||
if(userId != null){
|
||||
user = userService.getById(userId);
|
||||
}
|
||||
checkForbid(user);
|
||||
}
|
||||
|
||||
public CheckForbid checkForbid(Long userId,String usercode, String IMEI, String ip){
|
||||
ForbidTypeEnum typeEnum;
|
||||
CheckForbid noForbid = CheckForbid.noForbid();
|
||||
|
||||
Reference in New Issue
Block a user