Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
xuzhenhao
/
rlw-dev
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5c6bb579
authored
Jan 02, 2018
by
xuzhenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了获取用户个人信息的算法
1 parent
b7d200a2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
23 deletions
sdkredis/ice_gametopREDIS.go
sdkredis/ice_gametopREDIS.go
View file @
5c6bb57
...
...
@@ -291,38 +291,48 @@ func IceGameTopRedisGetSingleUserRankInfo(uid string, gtid string, gid string, t
}
// 排序
var
strList
[]
string
var
sorterr
error
var
rankIndex
int64
if
sorceorder
==
"0"
{
strList
,
sorterr
=
RedisSort
(
redisConn
,
"sortset:gtid:"
+
gtid
+
":gid:"
+
gid
+
":toptype:"
+
toptype
,
0
,
-
1
)
}
else
if
sorceorder
==
"1"
{
strList
,
sorterr
=
RedisReverseSort
(
redisConn
,
"sortset:gtid:"
+
gtid
+
":gid:"
+
gid
+
":toptype:"
+
toptype
,
0
,
-
1
)
rank
,
err
:=
GetSingleUserRank
(
redisConn
,
"sortset:gtid:"
+
gtid
+
":gid:"
+
gid
+
":toptype:"
+
toptype
,
"ice_gametop:uid:"
+
uid
+
":gtid:"
+
gtid
+
":gid:"
+
gid
+
":toptype:"
+
toptype
+
":mykey"
)
if
err
!=
nil
{
log
.
Println
(
err
,
" errno:"
,
rank
.
(
string
))
return
}
if
sorterr
!=
nil
{
log
.
Println
(
"RedisSort err[%v]"
,
sorterr
)
count
,
err
:=
RedisZCount
(
redisConn
,
"sortset:gtid:"
+
gtid
+
":gid:"
+
gid
+
":toptype:"
+
toptype
,
"-inf"
,
"+inf"
)
if
err
!=
nil
{
log
.
Println
(
err
)
return
}
else
if
len
(
strList
)
==
0
{
log
.
Println
(
"rank has no data"
)
}
rankIndex
=
count
.
(
int64
)
-
rank
.
(
int64
)
-
1
}
else
if
sorceorder
==
"1"
{
rank
,
err
:=
GetSingleUserRank
(
redisConn
,
"sortset:gtid:"
+
gtid
+
":gid:"
+
gid
+
":toptype:"
+
toptype
,
"ice_gametop:uid:"
+
uid
+
":gtid:"
+
gtid
+
":gid:"
+
gid
+
":toptype:"
+
toptype
+
":mykey"
)
if
err
!=
nil
{
log
.
Println
(
err
,
" errno:"
,
rank
.
(
string
))
return
}
rankIndex
=
rank
.
(
int64
)
+
1
}
score
,
err
:=
RedisZScore
(
redisConn
,
"sortset:gtid:"
+
gtid
+
":gid:"
+
gid
+
":toptype:"
+
toptype
,
"ice_gametop:uid:"
+
uid
+
":gtid:"
+
gtid
+
":gid:"
+
gid
+
":toptype:"
+
toptype
+
":mykey"
)
if
err
!=
nil
{
resIndex
=
"105202"
return
nil
,
resIndex
,
err
}
if
score
==
nil
{
err
=
errors
.
New
(
"用户未提交分数"
)
return
nil
,
"105201"
,
err
}
scoreString
:=
string
(
score
.
([]
uint8
))
igt
=
new
(
IGT
)
index
:=
1
var
resultstr
string
var
valuecount
=
2
_
,
err
=
RedisDBSelect
(
redisConn
,
4
)
if
err
!=
nil
{
log
.
Printf
(
"select db err:"
,
err
)
}
for
i
:=
0
;
i
<
len
(
strList
);
i
+=
2
{
startIndex
:=
strings
.
Index
(
strList
[
i
],
"uid:"
)
+
4
endIndex
:=
strings
.
Index
(
strList
[
i
],
":gtid"
)
currUID
:=
common
.
Substr2
(
strList
[
i
],
startIndex
,
endIndex
)
if
currUID
==
uid
{
igt
.
UID
=
uid
igt
.
RankIndex
=
index
igt
.
MyKey
=
strList
[
i
+
1
]
igt
.
RankIndex
=
int
(
rankIndex
)
igt
.
MyKey
=
scoreString
//查询储存昵称以及头像url的redis
var
err
error
resultstr
,
err
=
RedisGetKV
(
redisConn
,
"GUID:"
+
igt
.
UID
)
if
err
!=
nil
{
log
.
Println
(
"get redis err:"
,
err
)
...
...
@@ -345,10 +355,6 @@ func IceGameTopRedisGetSingleUserRankInfo(uid string, gtid string, gid string, t
igt
.
NickName
=
result
[
0
]
//第一个为昵称
igt
.
HeadPortraitURL
=
result
[
1
]
//第二个为头像url
}
}
index
++
}
_
,
err
=
RedisDBSelect
(
redisConn
,
2
)
if
err
!=
nil
{
log
.
Printf
(
"select db err:"
,
err
)
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment