fix
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.tailbet.service;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 推送服务接口
|
||||
*/
|
||||
@@ -11,6 +13,21 @@ public interface IPushService {
|
||||
String PUSH_TYPE_GAME_END = "game_end"; // 游戏结束
|
||||
String PUSH_TYPE_RESULT = "result"; // 开奖结果
|
||||
|
||||
/**
|
||||
* 推送消息
|
||||
*/
|
||||
@Data
|
||||
class PushMessage {
|
||||
private String type;
|
||||
private String title;
|
||||
private String content;
|
||||
private Long userId;
|
||||
private Long groupId;
|
||||
private Long roundId;
|
||||
private String roundNo;
|
||||
private Integer digit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送尾数试算完成通知给白名单用户
|
||||
*/
|
||||
@@ -29,10 +46,10 @@ public interface IPushService {
|
||||
/**
|
||||
* 发送单用户推送
|
||||
*/
|
||||
void sendPush(PushService.PushMessage message);
|
||||
void sendPush(PushMessage message);
|
||||
|
||||
/**
|
||||
* 广播推送消息给群成员
|
||||
*/
|
||||
void broadcastToGroup(Long groupId, PushService.PushMessage message);
|
||||
void broadcastToGroup(Long groupId, PushMessage message);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.tailbet.service;
|
||||
|
||||
import com.tailbet.model.entity.User;
|
||||
import com.tailbet.model.dto.UpdateUserDTO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
@@ -27,4 +28,9 @@ public interface IUserService extends IService<User> {
|
||||
* 获取当前登录用户
|
||||
*/
|
||||
User getCurrentUser();
|
||||
|
||||
/**
|
||||
* 更新用户信息
|
||||
*/
|
||||
void updateUserInfo(Long userId, UpdateUserDTO dto);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.tailbet.service.impl;
|
||||
|
||||
import com.tailbet.entity.GameRound;
|
||||
import com.tailbet.entity.DrawRecord;
|
||||
import com.tailbet.entity.BetOrder;
|
||||
import com.tailbet.entity.Group;
|
||||
import com.tailbet.entity.User;
|
||||
|
||||
import com.tailbet.mapper.GameRoundMapper;
|
||||
import com.tailbet.mapper.DrawRecordMapper;
|
||||
import com.tailbet.mapper.BetOrderMapper;
|
||||
import com.tailbet.mapper.GroupMapper;
|
||||
import com.tailbet.mapper.UserMapper;
|
||||
import com.tailbet.model.entity.BetOrder;
|
||||
import com.tailbet.model.entity.DrawRecord;
|
||||
import com.tailbet.model.entity.GameRound;
|
||||
import com.tailbet.model.entity.Group;
|
||||
import com.tailbet.service.IGameService;
|
||||
import com.tailbet.service.IPointsService;
|
||||
import com.tailbet.service.IAuditService;
|
||||
@@ -333,4 +333,4 @@ public class GameServiceImpl implements IGameService {
|
||||
.orderByDesc(DrawRecord::getCreateTime);
|
||||
return drawRecordMapper.selectPage(page, wrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.tailbet.service.impl;
|
||||
|
||||
import com.tailbet.entity.User;
|
||||
import com.tailbet.entity.DigitWhite;
|
||||
|
||||
import com.tailbet.mapper.UserMapper;
|
||||
import com.tailbet.mapper.DigitWhiteMapper;
|
||||
import com.tailbet.model.entity.DigitWhite;
|
||||
import com.tailbet.model.entity.User;
|
||||
import com.tailbet.openim.OpenIMClient;
|
||||
import com.tailbet.service.IPushService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -34,7 +35,7 @@ public class PushServiceImpl implements IPushService {
|
||||
for (DigitWhite white : whites) {
|
||||
User user = userMapper.selectById(white.getUserId());
|
||||
if (user != null) {
|
||||
PushService.PushMessage message = new PushService.PushMessage();
|
||||
IPushService.PushMessage message = new IPushService.PushMessage();
|
||||
message.setType(PUSH_TYPE_DIGIT_TRIAL);
|
||||
message.setTitle("尾数试算完成");
|
||||
message.setContent("可前往修改尾数");
|
||||
@@ -52,7 +53,7 @@ public class PushServiceImpl implements IPushService {
|
||||
*/
|
||||
@Override
|
||||
public void pushGameStart(Long groupId, String roundNo) {
|
||||
PushService.PushMessage message = new PushService.PushMessage();
|
||||
IPushService.PushMessage message = new IPushService.PushMessage();
|
||||
message.setType(PUSH_TYPE_GAME_START);
|
||||
message.setTitle("游戏开始");
|
||||
message.setContent(roundNo + "期已开始下注");
|
||||
@@ -68,7 +69,7 @@ public class PushServiceImpl implements IPushService {
|
||||
*/
|
||||
@Override
|
||||
public void pushGameResult(Long groupId, String roundNo, int digit, String playWins) {
|
||||
PushService.PushMessage message = new PushService.PushMessage();
|
||||
IPushService.PushMessage message = new IPushService.PushMessage();
|
||||
message.setType(PUSH_TYPE_RESULT);
|
||||
message.setTitle("开奖结果");
|
||||
message.setContent(roundNo + "期开奖\n尾数: " + digit + "\n中奖玩法: " + playWins);
|
||||
@@ -84,7 +85,7 @@ public class PushServiceImpl implements IPushService {
|
||||
* 发送单用户推送
|
||||
*/
|
||||
@Override
|
||||
public void sendPush(PushService.PushMessage message) {
|
||||
public void sendPush(IPushService.PushMessage message) {
|
||||
try {
|
||||
User user = userMapper.selectById(message.getUserId());
|
||||
if (user == null) {
|
||||
@@ -111,7 +112,7 @@ public class PushServiceImpl implements IPushService {
|
||||
* 广播推送消息给群成员
|
||||
*/
|
||||
@Override
|
||||
public void broadcastToGroup(Long groupId, PushService.PushMessage message) {
|
||||
public void broadcastToGroup(Long groupId, IPushService.PushMessage message) {
|
||||
try {
|
||||
// 通过OpenIM群消息发送
|
||||
openIMClient.sendGroupMessage(String.valueOf(groupId),
|
||||
@@ -122,4 +123,4 @@ public class PushServiceImpl implements IPushService {
|
||||
groupId, message.getType(), e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.tailbet.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.tailbet.model.entity.User;
|
||||
import com.tailbet.mapper.UserMapper;
|
||||
import com.tailbet.model.dto.UpdateUserDTO;
|
||||
@@ -19,16 +20,12 @@ import java.util.List;
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class UserServiceImpl implements IUserService {
|
||||
public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements IUserService {
|
||||
|
||||
private final UserMapper userMapper;
|
||||
private final PasswordUtil passwordUtil;
|
||||
private final JwtUtil jwtUtil;
|
||||
|
||||
@Override
|
||||
public User getById(Long id) {
|
||||
return userMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户名查询用户
|
||||
@@ -81,13 +78,7 @@ public class UserServiceImpl implements IUserService {
|
||||
return jwtUtil.generateToken(user.getId(), user.getUsername());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户
|
||||
*/
|
||||
@Override
|
||||
public boolean updateUser(User user) {
|
||||
return userMapper.updateById(user) > 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新用户信息
|
||||
|
||||
Reference in New Issue
Block a user