Compare commits

...

2 Commits

Author SHA1 Message Date
雷欧(林平凡)
98204bb9f9 接入 2025-06-16 09:41:43 +08:00
雷欧(林平凡)
8e8726804b 礼金过期 2025-06-13 15:27:09 +08:00
2 changed files with 17 additions and 4 deletions

View File

@@ -23,7 +23,7 @@ import java.util.List;
@RequestMapping("/recordOrder") @RequestMapping("/recordOrder")
public class OrderController { public class OrderController {
public static String TOKEN = "cc0313"; public static String TOKEN = "dd7f298cc465e7a9791796ae1303a1f6c031a18d4894ecd9e75d44fdb0ef32d80a49e4c5811b98d8ac65d73d22a54083630d5329c7c9de2276317669ecb2e544";
@Autowired @Autowired
private JDUtil jdUtils; private JDUtil jdUtils;
@Autowired @Autowired
@@ -35,14 +35,27 @@ public class OrderController {
return TOKEN.equals(token); return TOKEN.equals(token);
} }
@RequestMapping("/testToken")
@ResponseBody
public ApiResponse testToken(String token) {
if (!checkToken(token)){
return ApiResponse.unauthorized();
}
return ApiResponse.success();
}
@RequestMapping("/list") @RequestMapping("/list")
@ResponseBody @ResponseBody
public ApiResponse<List<ProductOrder>> list(String token) throws Exception { public ApiResponse list(String token) throws Exception {
if (!checkToken(token)){
return ApiResponse.unauthorized();
}
try { try {
List<ProductOrder> all = productOrderRepository.findAll(); List<ProductOrder> all = productOrderRepository.findAll();
return ApiResponse.success(all); return ApiResponse.success(all);
} catch (Exception e) { } catch (Exception e) {
return (ApiResponse<List<ProductOrder>>) ApiResponse.error(500, "Server Error: " + e.getMessage()); return ApiResponse.error(500, "Server Error: " + e.getMessage());
} }
} }

View File

@@ -548,7 +548,7 @@ public class JDScheduleJob {
hashOps.putAll(key, hours.stream().collect(Collectors.toMap(h -> h, h -> "1"))); hashOps.putAll(key, hours.stream().collect(Collectors.toMap(h -> h, h -> "1")));
} }
@Scheduled(cron = "0 0 0 * * ?") // 每天 0 点执行 @Scheduled(cron = "0 0 0,8 * * ?")
public void checkGiftCouponsExpiry() { public void checkGiftCouponsExpiry() {
Set<String> keys = redisTemplate.keys("gift_coupon:*"); Set<String> keys = redisTemplate.keys("gift_coupon:*");
if (keys == null || keys.isEmpty()) return; if (keys == null || keys.isEmpty()) return;