gsd 6 days ago
parent
commit
20d4fe9423
  1. 12
      src/main/java/app/controllers/other/ExternalVIPController.java
  2. 8
      src/main/java/app/entities/server/Server.java
  3. 4
      src/main/java/app/repositories/FileRepository.java
  4. 2
      src/main/java/app/repositories/ReportRepository.java

12
src/main/java/app/controllers/other/ExternalVIPController.java

@ -40,16 +40,16 @@ public class ExternalVIPController {
this.vipService = vipService;
this.unique_set = new HashSet<>();
this.fileController = fileController;
setupPrices();
}
@PostConstruct
public void setupPrices() {
prices = new ArrayList<>();
prices.add(new VipPrice("1 Месяц", 200, "1 ключ", "api/file/6243cb6b-2117-4deb-b1d5-ea266a16bf05", "month", true, true, true, 10));
prices.add(new VipPrice("1 Неделя", 100, "40 рефов", "api/file/d0ff82ca-a944-4cdb-b0bc-a0e96ed49de9", "week", true, true, true, 10));
prices.add(new VipPrice("1 День", 35, "10 рефов", "api/file/b8636ebf-c4eb-4355-b2ba-d8d3647d2896", "day", true, true, true, 10));
prices.add(new VipPrice("1 День", 0, "бесплатно", "api/file/794b9bd5-0f43-451f-a566-1ede210e3e10", "free", true, true, true, 10));
prices.add(new VipPrice("Промокод", 0, "бесплатно", "api/file/5dfcdc65-750d-4e35-968d-78d50574d761", "promocode", true, true, true, 10));
prices.add(new VipPrice("1 Месяц", 200, "1 ключ", fileController.getUrl("vip,VIP_1_MOUNTH"), "month", true, true, true, 10));
prices.add(new VipPrice("1 Неделя", 100, "40 рефов", fileController.getUrl("vip,VIP_7_DAYS"), "week", true, true, true, 10));
prices.add(new VipPrice("1 День", 35, "10 рефов", fileController.getUrl("vip,VIP_1_DAY"), "day", true, true, true, 10));
prices.add(new VipPrice("1 День", 0, "бесплатно", fileController.getUrl("vip,freevip"), "free", true, true, true, 10));
prices.add(new VipPrice("Промокод", 0, "бесплатно", fileController.getUrl("vip,promocode"), "promocode", true, true, true, 10));
}
@PostMapping

8
src/main/java/app/entities/server/Server.java

@ -53,6 +53,14 @@ public class Server extends ExternalValveClient {
return map == null || map.isEmpty() ? "" : map.replace("workshop/","").split(".ugc")[0];
}
public Long getWorkshopId() {
try {
return map == null || map.isEmpty() ? null : Long.valueOf(map.split(".ugc")[1]);
} catch (Exception ignored) {
return null;
}
}
@Override
public String toString() {
return "SERVER> %s | %s\nSTATS > %d/%d | %s\nCONFIG> grab limit: %d".formatted(

4
src/main/java/app/repositories/FileRepository.java

@ -11,12 +11,12 @@ public interface FileRepository extends CrudRepository<DbFile, UUID> {
@Query("select f from DbFile f where position(:tags in f.tags) > 0 order by f.timestamp desc limit 1")
DbFile getDbFilesByTag(@Param(value = "tags") String tags);
@Query("select f.id from DbFile f where position(:tags in f.tags) > 0 order by f.timestamp desc limit 1")
@Query(value = "select f.id from tf2_facti13.files f where position(:tags in f.tags) > 0 order by f.ts desc limit 1", nativeQuery = true)
UUID getUUIDFilesByTag(@Param(value = "tags") String tags);
@Query("select f from DbFile f where f.filename like :filename and position(:tag in f.tags) > 0 order by f.timestamp desc limit 1")
DbFile getDbFileByFilenameAndTag(@Param(value = "filename") String filename, @Param(value = "tag") String tag);
@Query("select f.id from DbFile f where f.filename like :filename and position(:tag in f.tags) > 0 order by f.timestamp desc limit 1")
@Query(value = "select f.id from tf2_facti13.files f where f.filename like :filename and position(:tag in f.tags) > 0 order by f.ts desc limit 1", nativeQuery = true)
UUID getUUIDByFilenameAndTag(@Param(value = "filename") String filename, @Param(value = "tag") String tag);
}

2
src/main/java/app/repositories/ReportRepository.java

@ -9,7 +9,7 @@ import org.springframework.data.repository.query.Param;
public interface ReportRepository extends PagingAndSortingRepository<Report, Long> {
@Query(value = "select r from Report r where " +
"(:authors_ne = true or position(r.a_steam2 in :authors) > 0) and " +
"(:authors_ne = true or (position(r.a_steam2 in :authors) > 0 or position(r.r_steam2 in :authors) > 0)) and " +
"(:reportes_ne = true or position(r.r_steam2 in :reportes) > 0) and " +
"(:begin_date is null or r.utime >= :begin_date) and " +
"(:end_date is null or :end_date >= r.utime) and " +

Loading…
Cancel
Save