Browse Source

disable donate

master
gsd 1 year ago
parent
commit
97f505dc72
  1. 28
      src/main/java/app/controllers/other/ExternalVIPController.java
  2. 1
      src/main/java/app/controllers/user/ProfileController.java
  3. 2
      src/main/java/app/entities/VipPrice.java

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

@ -1,11 +1,13 @@
package app.controllers.other;
import app.annotations.enums.AuthMethod;
import app.annotations.interfaces.CheckPermitionFlag;
import app.annotations.interfaces.CheckWebAccess;
import app.entities.VipGiveMethod;
import app.entities.VipPrice;
import app.services.db.VIPService;
import app.utils.SteamIDConverter;
import com.google.common.collect.ImmutableMap;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@ -23,6 +25,9 @@ public class ExternalVIPController {
List<VipPrice> prices;
private boolean steam = true;
private boolean qiwi = true;
@Autowired
public ExternalVIPController(VIPService vipService) {
this.vipService = vipService;
@ -32,10 +37,10 @@ public class ExternalVIPController {
public void setupPrices() {
prices = new ArrayList<>();
prices.add(new VipPrice("1 Месяц", 200, "1 ключ", "site_content/images/vip/VIP_1_MOUNTH.jpg", "month"));
prices.add(new VipPrice("1 Неделя", 100, "40 рефов", "site_content/images/vip/VIP_7_DAYS.jpg", "week"));
prices.add(new VipPrice("1 День", 35, "10 рефов", "site_content/images/vip/VIP_1_DAY.jpg", "day"));
prices.add(new VipPrice("1 День", 0, "бесплатно", "site_content/images/vip/freevip.jpg", "free"));
prices.add(new VipPrice("1 Месяц", 200, "1 ключ", "site_content/images/vip/VIP_1_MOUNTH.jpg", "month", true, true));
prices.add(new VipPrice("1 Неделя", 100, "40 рефов", "site_content/images/vip/VIP_7_DAYS.jpg", "week", true, true));
prices.add(new VipPrice("1 День", 35, "10 рефов", "site_content/images/vip/VIP_1_DAY.jpg", "day", true, true));
prices.add(new VipPrice("1 День", 0, "бесплатно", "site_content/images/vip/freevip.jpg", "free", true, true));
}
@PostMapping
@ -62,6 +67,19 @@ public class ExternalVIPController {
@GetMapping
public ResponseEntity getPrices() {
return new ResponseEntity(prices, HttpStatus.OK);
return new ResponseEntity(prices.stream()
.peek(price -> price.setQiwi(qiwi))
.peek(price -> price.setSteam(steam)), HttpStatus.OK);
}
@GetMapping("/change")
@CheckWebAccess
@CheckPermitionFlag(flag = "z")
public ResponseEntity disable(HttpServletRequest request, @RequestParam(value = "type", required = false) String type) {
switch (type) {
case "steam": this.steam = !this.steam;
case "qiwi": this.qiwi = !this.qiwi;
}
return new ResponseEntity(ImmutableMap.of("steam", this.steam, "qiwi", this.qiwi), HttpStatus.OK);
}
}

1
src/main/java/app/controllers/user/ProfileController.java

@ -98,6 +98,7 @@ public class ProfileController {
.build();
}
case "qiwi":
if (cost != null && cost < 0) return ResponseEntity.status(HttpStatus.NOT_ACCEPTABLE).build();
String steam2 = profileService.GetProfile(steam64, "").getSteamids().steam2;
return ResponseEntity.status(HttpStatus.FOUND)
.header("Location", String.valueOf(QIWI_LINK).replace("(AMOUNT)", String.valueOf(cost)).replace("(COMMENT)", steam2))

2
src/main/java/app/entities/VipPrice.java

@ -11,4 +11,6 @@ public class VipPrice {
String item_price;
String img_url;
String period;
boolean steam = true;
boolean qiwi = true;
}

Loading…
Cancel
Save