@@ -26,9 +26,10 @@ trait PaymentTokenComponent { self: HasDatabaseConfigProvider[JdbcProfile] =>
26
26
def type_tokens = column[String ](" TYPE_TOKENS" )
27
27
def tx_id = column[String ](" TXID" )
28
28
def username = column[String ](" USERNAME" )
29
+ def ip = column[String ](" IP" )
29
30
def created_time = column[LocalDateTime ](" CREATED_TIME" , O .Default (LocalDateTime .now()))
30
31
def done = column[Boolean ](" DONE" , O .Default (false ))
31
- def * = (username, address, erg_amount, type_tokens, tx_id, created_time, done) <> (TokenPayment .tupled, TokenPayment .unapply)
32
+ def * = (username, address, erg_amount, type_tokens, ip, tx_id, created_time, done) <> (TokenPayment .tupled, TokenPayment .unapply)
32
33
def user_token = index(" USER_TOKEN" , (username, type_tokens), unique = true )
33
34
}
34
35
@@ -38,9 +39,10 @@ trait PaymentTokenComponent { self: HasDatabaseConfigProvider[JdbcProfile] =>
38
39
def type_tokens = column[String ](" TYPE_TOKENS" )
39
40
def tx_id = column[String ](" TXID" )
40
41
def username = column[String ](" USERNAME" )
42
+ def ip = column[String ](" IP" )
41
43
def created_time = column[LocalDateTime ](" CREATED_TIME" )
42
44
def done = column[Boolean ](" DONE" )
43
- def * = (username, address, erg_amount, type_tokens, tx_id, created_time, done) <> (TokenPayment .tupled, TokenPayment .unapply)
45
+ def * = (username, address, erg_amount, type_tokens, ip, tx_id, created_time, done) <> (TokenPayment .tupled, TokenPayment .unapply)
44
46
def user_token = index(" USER_TOKEN_ARCHIVE" , (username, type_tokens, created_time), unique = true )
45
47
}
46
48
@@ -92,9 +94,9 @@ class PaymentTokenDAO @Inject() (protected val dbConfigProvider: DatabaseConfigP
92
94
* @param type_tokens Type batch of assets
93
95
* @return boolean result
94
96
*/
95
- def exists (username : String , address : String , type_tokens : String ): Boolean = {
97
+ def exists (username : String , address : String , ip : String , type_tokens : String ): Boolean = {
96
98
val res = db.run(tokenPayments.filter(payment => {
97
- (payment.address === address || payment.username === username) && (payment.type_tokens === type_tokens)
99
+ (payment.address === address || payment.username === username || payment.ip === ip ) && (payment.type_tokens === type_tokens)
98
100
} ).exists.result)
99
101
Await .result(res, Duration .Inf )
100
102
}
0 commit comments