Немного реструктуризации

Добавлен роут для смены скина
This commit is contained in:
ErickSkrauch
2016-07-06 01:25:05 +03:00
parent 87ca1191eb
commit c4cd95cddc
12 changed files with 127 additions and 62 deletions

View File

@@ -6,10 +6,6 @@ import (
"crypto/md5"
"strconv"
"encoding/hex"
"elyby/minecraft-skinsystem/lib/structures"
"elyby/minecraft-skinsystem/lib/services"
"encoding/json"
"log"
)
func ParseUsername(username string) string {
@@ -30,19 +26,6 @@ func BuildNonElyTexturesHash(username string) string {
return hex.EncodeToString(hasher.Sum(nil))
}
func FindRecord(username string) (structures.SkinItem, error) {
var record structures.SkinItem;
result, err := services.Redis.Cmd("GET", BuildKey(username)).Str();
if (err == nil) {
decodeErr := json.Unmarshal([]byte(result), &record)
if (decodeErr != nil) {
log.Println("Cannot decode record data")
}
}
return record, err
}
func BuildKey(username string) string {
return "username:" + strings.ToLower(username)
}