mirror of
https://github.com/Xevion/r2park.git
synced 2025-12-11 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 {
|
func StoreCode(code string, location int64, member_id int) bool {
|
||||||
key := fmt.Sprintf("code:%d:%d", location, member_id)
|
key := fmt.Sprintf("code:%d:%d", location, member_id)
|
||||||
|
already_set := db.Exists(key).Val() == 1
|
||||||
val_exists := db.Exists(key).Val()
|
|
||||||
db.Set(key, code, 0)
|
db.Set(key, code, 0)
|
||||||
val := db.Get(code).Val()
|
|
||||||
|
|
||||||
fmt.Println(val, val_exists)
|
return already_set
|
||||||
|
}
|
||||||
return false
|
|
||||||
|
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