6 changed files with 131 additions and 3 deletions
@ -1,5 +1,16 @@ |
|||||
package app.entities; |
package app.entities; |
||||
|
|
||||
public enum VipGiveMethod { |
public enum VipGiveMethod { |
||||
FREE, STEAM, QIWI, MANUAL, AFTERTIME |
FREE("Бесплатно"), |
||||
|
STEAM("Steam"), |
||||
|
QIWI("Qiwi"), |
||||
|
MANUAL("Админ"), |
||||
|
AFTERTIME("Убрана"), |
||||
|
TOTAL("Итого"); |
||||
|
|
||||
|
String human_name; |
||||
|
|
||||
|
VipGiveMethod(String human_name) { |
||||
|
this.human_name = human_name; |
||||
|
} |
||||
} |
} |
||||
|
@ -0,0 +1,86 @@ |
|||||
|
package app.entities.db; |
||||
|
|
||||
|
import app.entities.DonateStatistic; |
||||
|
import app.entities.VipGiveMethod; |
||||
|
import com.fasterxml.jackson.annotation.JsonGetter; |
||||
|
import com.fasterxml.jackson.annotation.JsonIgnore; |
||||
|
import com.fasterxml.jackson.annotation.JsonValue; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Data |
||||
|
public class DonateStat { |
||||
|
@JsonIgnore |
||||
|
int id; |
||||
|
@JsonIgnore |
||||
|
String steam2; |
||||
|
int amount; |
||||
|
@JsonIgnore |
||||
|
VipGiveMethod giveMethod; |
||||
|
@JsonIgnore |
||||
|
String reserved; |
||||
|
@JsonIgnore |
||||
|
boolean extended; |
||||
|
int utime; |
||||
|
|
||||
|
public DonateStat(Object[] obj) { |
||||
|
this.id = (int) obj[0]; |
||||
|
this.steam2 = String.valueOf(obj[1]); |
||||
|
this.amount = (int) obj[2]; |
||||
|
this.giveMethod = (VipGiveMethod) obj[4]; |
||||
|
this.reserved = String.valueOf(obj[5]); |
||||
|
this.utime = (int) obj[6]; |
||||
|
} |
||||
|
|
||||
|
public DonateStat(Integer rubles, Integer keys, Integer refs) { |
||||
|
//потом бля
|
||||
|
} |
||||
|
|
||||
|
@JsonValue |
||||
|
public Integer getRubles() { |
||||
|
if (this.giveMethod == VipGiveMethod.QIWI) return Integer.valueOf(this.reserved.split(";")[0].split("=")[1]); |
||||
|
return 0; |
||||
|
} |
||||
|
|
||||
|
@JsonValue |
||||
|
public Integer getKeys() { |
||||
|
if (this.giveMethod == VipGiveMethod.STEAM) return Integer.valueOf(this.reserved.split(";")[0].split("=")[1]); |
||||
|
return 0; |
||||
|
} |
||||
|
|
||||
|
@JsonValue |
||||
|
public Integer getRefs() { |
||||
|
if (this.giveMethod == VipGiveMethod.STEAM) return Integer.valueOf(this.reserved.split(";")[1].split("=")[1]); |
||||
|
return 0; |
||||
|
} |
||||
|
|
||||
|
@JsonValue |
||||
|
public String getStatus() { |
||||
|
switch (this.giveMethod) { |
||||
|
case FREE -> { |
||||
|
return "Получен бесплатно"; |
||||
|
} |
||||
|
case QIWI -> { |
||||
|
return "Оплачено Qiwi: " + getRubles().toString() + " рублей"; |
||||
|
} |
||||
|
case STEAM -> { |
||||
|
return "Оплачено инвентарём: " |
||||
|
+ (getKeys() > 0?getKeys().toString() + " ключ":"") |
||||
|
+ (getRefs() > 0?getRefs().toString() + " рефов":""); |
||||
|
} |
||||
|
case MANUAL -> { |
||||
|
return "Выдана админом"; |
||||
|
} |
||||
|
case AFTERTIME -> { |
||||
|
return "Снята"; |
||||
|
} |
||||
|
} |
||||
|
return "Неизвестно"; |
||||
|
} |
||||
|
|
||||
|
@JsonValue |
||||
|
public String getHasExtended() { |
||||
|
return extended?"Была продлена":""; |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue