@ -52,7 +52,7 @@ public class FreeVIPService{
public Long getLastGivedFreeVIP ( SteamID steamID ) {
return ( Long ) entityManager . createNativeQuery ( "SELECT UNIX_TIMESTAMP(`date`) as u_time FROM free_vip WHERE steam3 LIKE ?1 ORDER BY `date` DESC" )
. setParameter ( 1 , steamID . steam3 )
. getResultStream ( ) . map ( u_time - > Long . valueOf ( ( String ) u_time ) ) . findFirst ( ) . orElse ( 0L ) ;
. getResultStream ( ) . findFirst ( ) . orElse ( 0L ) ;
}
public Long getLastGivedFreeVIP ( SocialAuth socialAuth ) {
@ -62,11 +62,11 @@ public class FreeVIPService{
else if ( socialAuth . getVk_id ( ) ! = 0 ) {
return ( Long ) entityManager . createNativeQuery ( "SELECT UNIX_TIMESTAMP(`date`) as u_time FROM free_vip WHERE vk_id = ?1 ORDER BY `date` DESC" )
. setParameter ( 1 , socialAuth . getVk_id ( ) )
. getResultStream ( ) . map ( u_time - > Long . valueOf ( ( String ) u_time ) ) . findFirst ( ) . orElse ( 0L ) ;
. getResultStream ( ) . findFirst ( ) . orElse ( 0L ) ;
} else if ( socialAuth . getDiscord_id ( ) ! = 0 ) {
return ( Long ) entityManager . createNativeQuery ( "SELECT UNIX_TIMESTAMP(`date`) as u_time FROM free_vip WHERE discord_id = ?1 ORDER BY `date` DESC" )
. setParameter ( 1 , socialAuth . getDiscord_id ( ) )
. getResultStream ( ) . map ( u_time - > Long . valueOf ( ( String ) u_time ) ) . findFirst ( ) . orElse ( 0L ) ;
. getResultStream ( ) . findFirst ( ) . orElse ( 0L ) ;
} else {
return 0L ;
}