1
zj
2025-09-16 3a8764d068b83988fa4c5f61abc4ba359e5aeb29
1
6 files modified
38 ■■■■■ changed files
src/main/java/com/nq/controller/UserApiController.java 2 ●●● patch | view | raw | blame | history
src/main/java/com/nq/controller/protol/UserWithdrawController.java 2 ●●● patch | view | raw | blame | history
src/main/java/com/nq/service/impl/UserServiceImpl.java 17 ●●●● patch | view | raw | blame | history
src/main/java/com/nq/ws/WebSocketClientBeanConfig.java 1 ●●●● patch | view | raw | blame | history
src/main/resources/application.properties 8 ●●●● patch | view | raw | blame | history
src/main/resources/application.yml 8 ●●●● patch | view | raw | blame | history
src/main/java/com/nq/controller/UserApiController.java
@@ -99,7 +99,7 @@
            String keys = "emailCode:" + email;
            RedisShardedPoolUtils.setEx(keys, code, 60);
            GmailSender.sendEmail(email,"verification code",code);
            return ServerResponse.createByErrorMsg("发送成功!",request);
            return ServerResponse.createBySuccess("发送成功!",request);
        }catch (Exception e){
            e.printStackTrace();
            return ServerResponse.createByErrorMsg("验证码发送失败",request);
src/main/java/com/nq/controller/protol/UserWithdrawController.java
@@ -87,7 +87,7 @@
    public static boolean isIntegerGreaterThan100(String str) {
        try {
            int number = Integer.parseInt(str);  // 尝试将字符串转换为整数
            return number > 100;  // 判断是否大于100
            return number >= 100;  // 判断是否大于100
        } catch (NumberFormatException e) {
            return false;  // 如果转换失败,说明不是整数
        }
src/main/java/com/nq/service/impl/UserServiceImpl.java
@@ -43,6 +43,7 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
import java.util.stream.Collectors;
import javax.annotation.Resource;
@@ -157,7 +158,7 @@
        log.info("redis_yzm = {},yzmCode = {}", redis_yzm, yzmCode);
        if (!yzmCode.equals(redis_yzm) && !"6666".equals(yzmCode)) {
            return ServerResponse.createByErrorMsg("验证码不正确或已过期!,注册失败",request);
            return ServerResponse.createByErrorMsg("验证码不正确或已过期,注册失败",request);
        }
        AgentUser agentUser = this.iAgentUserService.findByCode(agentCode);
@@ -171,7 +172,7 @@
        User dbuser = this.userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getPhone,phone).last( " limit 1"));
        if (dbuser != null) {
            return ServerResponse.createByErrorMsg("注册失败,手机号已注册",request);
            return ServerResponse.createByErrorMsg("注册失败,用户名已注册",request);
        }
@@ -1198,11 +1199,19 @@
        if(ObjectUtil.isEmpty(userId)){
            return ServerResponse.createBySuccess(BigDecimal.ZERO);
        }
        // 计算7天前的时间
        Date sevenDaysAgo = Date.from(LocalDateTime.now().minusDays(7).atZone(ZoneId.systemDefault()).toInstant());
        List<UserPosition> userPositions = userPositionMapper.selectList(
                new QueryWrapper<UserPosition>()
                        .eq("user_id", userId)
                        .apply("(sell_order_id IS NOT NULL AND sell_order_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)) " +
                                "OR (sell_order_id IS NULL AND buy_order_time >= DATE_SUB(NOW(), INTERVAL 7 DAY))")
                        .and(wrapper -> wrapper
                                .isNotNull("sell_order_id")
                                .ge("sell_order_time", sevenDaysAgo)
                                .or()
                                .isNull("sell_order_id")
                                .ge("buy_order_time", sevenDaysAgo)
                        )
        );
        BigDecimal weeklyProfit = BigDecimal.ZERO;
        if (userPositions.size() > 0) {
src/main/java/com/nq/ws/WebSocketClientBeanConfig.java
@@ -28,7 +28,6 @@
            new Thread(() -> {
                while (true) {
                    try {
                        Thread.sleep(8000);
                        websocketRunClient.send("heartbeat".getBytes());
                    } catch (Exception e) {
                        websocketRunClient.reconnect();
src/main/resources/application.properties
@@ -17,11 +17,11 @@
ftp.user=ftp_stock
ftp.pass=123456
ftp.address =/www/wwwroot/ftp_stock/
ftp.server.http.prefix=https://img.yanshiz.com/
ftp.server.http.prefix=https://img.isusstock.com/
redis1.ip=localhost
redis1.port=6380
#redis1.port=6379
#redis1.port=6380
redis1.port=6379
redis1.pwd=
redis1.timeout=10000
redis.max.total=50
@@ -54,7 +54,7 @@
JS_IN_KEY = xKChgi47AP1NMwMeYI3c
US_HTTP_API = http://api-us-v2.js-stock.top/
US_WS_URL = ws://api-us-v2-ws.js-stock.top
US_WS_URL = wss://usws.yanshiz.com/websocket-server
US_KEY = SIjHECiI3cIVfHXwsLsL
HK_HTTP_API = http://test.js-stock.top/
src/main/resources/application.yml
@@ -106,8 +106,8 @@
    # 地址
    host: localhost
    # 端口,默认为6379
#    port: 6379
    port: 6380
    port: 6379
#    port: 6380
    # 数据库索引
    database: 2
    # 密码
@@ -127,11 +127,11 @@
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    driverClassName: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:6306/us?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
    url: jdbc:mysql://127.0.0.1:3306/stock?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
#    url: jdbc:mysql://127.0.0.1:6306us?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
#    url: jdbc:mysql://127.0.0.1:3306/cgstock?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
    username: root
    password: Err;2[eoGFUriwdgr
    password: fsdaje5kj34r89sfoi3
    druid:
      # 初始连接数
      initialSize: 5