Administrator
2025-06-30 c8c289aa8fc649b90a539eb76d864230db51796e
test(config): 更新数据源配置并注释定时任务

- 修改数据源用户名、密码和 URL
- 注释微信小程序定时任务 getAccessToken
2 files modified
62 ■■■■ changed files
src/main/java/cc/mrbird/febs/mall/quartz/WxxcxJob.java 56 ●●●● patch | view | raw | blame | history
src/main/resources/application-test.yml 6 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/quartz/WxxcxJob.java
@@ -48,34 +48,34 @@
     * 获取access_token
     * 有效期两小时
     */
    @Scheduled(cron = "0 0 0/1 * * ? ")
    public void getAccessToken() throws IOException {
        log.info("执行access_token刷新");
        String appId = xcxProperties.getXcxAppid();
        String appSecret = xcxProperties.getXcxSecret();
        String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appId + "&secret=" + appSecret;
        String jsonStr = restTemplate.getForObject(url, String.class);
        /**
         * 返回结果
         * {"access_token":"ACCESS_TOKEN","expires_in":7200}
         */
        if (!jsonStr.contains("access_token")) {
            System.out.println("获取微信access_token失败");
        }
        String accessTokenKey = WechatConfigure.WX_ACCESS_TOKEN_REDIS_KEY;
        JSONObject jsonObject = JSONObject.parseObject(jsonStr);
        String accessToken = jsonObject.getString(accessTokenKey);
        if (StrUtil.isEmpty(accessToken)) {
            log.error("获取access token失败: {}" , jsonObject.getString("errmsg"));
            throw new ApiException("获取access token失败");
        } else {
            log.info("wx access_token : {}",accessToken);
            redisUtils.set(accessTokenKey,accessToken);
        }
    }
//    @Scheduled(cron = "0 0 0/1 * * ? ")
//    public void getAccessToken() throws IOException {
//        log.info("执行access_token刷新");
//        String appId = xcxProperties.getXcxAppid();
//        String appSecret = xcxProperties.getXcxSecret();
//        String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appId + "&secret=" + appSecret;
//        String jsonStr = restTemplate.getForObject(url, String.class);
//
//        /**
//         * 返回结果
//         * {"access_token":"ACCESS_TOKEN","expires_in":7200}
//         */
//        if (!jsonStr.contains("access_token")) {
//            System.out.println("获取微信access_token失败");
//        }
//
//        String accessTokenKey = WechatConfigure.WX_ACCESS_TOKEN_REDIS_KEY;
//        JSONObject jsonObject = JSONObject.parseObject(jsonStr);
//        String accessToken = jsonObject.getString(accessTokenKey);
//        if (StrUtil.isEmpty(accessToken)) {
//            log.error("获取access token失败: {}" , jsonObject.getString("errmsg"));
//            throw new ApiException("获取access token失败");
//        } else {
//            log.info("wx access_token : {}",accessToken);
//            redisUtils.set(accessTokenKey,accessToken);
//        }
//
//    }
    @Scheduled(cron = "0 0 0/1 * * ? ")
    public void expireCoupon() {
src/main/resources/application-test.yml
@@ -15,10 +15,10 @@
      datasource:
        # 数据源-1,名称为 base
        base:
          username: happy_community_365
          password: happy_community_365!@#
          username: ct_test
          password: 123456
          driver-class-name: com.mysql.cj.jdbc.Driver
          url: jdbc:mysql://8.155.56.10:3306/happy_community_365?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8
          url: jdbc:mysql://120.27.238.55:3406/clothes_test?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8
  redis:
    # Redis数据库索引(默认为 0)