mirror of
https://github.com/Xevion/r2park.git
synced 2025-12-10 10:08:18 -06:00
Fix StoreCode bool return, add GetCode
This commit is contained in:
13
data.go
13
data.go
@@ -6,12 +6,13 @@ import (
|
||||
|
||||
func StoreCode(code string, location int64, member_id int) bool {
|
||||
key := fmt.Sprintf("code:%d:%d", location, member_id)
|
||||
|
||||
val_exists := db.Exists(key).Val()
|
||||
already_set := db.Exists(key).Val() == 1
|
||||
db.Set(key, code, 0)
|
||||
val := db.Get(code).Val()
|
||||
|
||||
fmt.Println(val, val_exists)
|
||||
|
||||
return false
|
||||
return already_set
|
||||
}
|
||||
|
||||
func GetCode(location int64, member_id int) string {
|
||||
key := fmt.Sprintf("code:%d:%d", location, member_id)
|
||||
return db.Get(key).Val()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user