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 4a487b1f
authored
Dec 28, 2017
by
xuzhenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加了redis工具库中的方法
1 parent
f73ac45f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 additions
and
9 deletions
sdkredis/ice_gametopREDIS.go
sdkredis/ice_gametopREDIS.go
View file @
4a487b1
...
...
@@ -398,7 +398,6 @@ func IceGameTopRedisGetSingleUserRangeRankInfo(uid string, gtid string, gid stri
err
=
errors
.
New
(
"用户未提交分数"
)
return
nil
,
"105201"
,
err
}
log
.
Println
(
score
)
scoreString
:=
"("
+
string
(
score
.
([]
uint8
))
// 获取当前用户前x位和后x位的排名数据
var
prerankIndex
int
...
...
@@ -427,7 +426,6 @@ func IceGameTopRedisGetSingleUserRangeRankInfo(uid string, gtid string, gid stri
}
else
{
resIndex
=
prerankIndex
+
1
}
log
.
Println
(
"nextrankIndex:"
,
nextrankIndex
,
"prerankIndex:"
,
prerankIndex
,
"sorceorder:"
,
sorceorder
)
// 排序
var
strList
,
strList1
,
strList2
[]
string
if
sorceorder
==
"1"
{
...
...
@@ -436,7 +434,6 @@ func IceGameTopRedisGetSingleUserRangeRankInfo(uid string, gtid string, gid stri
if
err
!=
nil
{
log
.
Println
(
"zrangebyscore:"
,
err
)
}
log
.
Println
(
"strList1:"
,
strList1
)
//将结果倒序
var
tempList
[]
string
for
i
:=
len
(
strList1
)
-
1
;
i
>=
0
;
i
-=
2
{
...
...
@@ -444,7 +441,6 @@ func IceGameTopRedisGetSingleUserRangeRankInfo(uid string, gtid string, gid stri
tempList
=
append
(
tempList
,
strList1
[
i
])
}
strList1
=
tempList
log
.
Println
(
"tempList : "
,
strList1
)
}
if
nextrankIndex
!=
0
{
strList2
,
err
=
RedisZRevRangeByScore
(
redisConn
,
"sortset:gtid:"
+
gtid
+
":gid:"
+
gid
+
":toptype:"
+
toptype
,
scoreString
,
"-inf"
,
"true"
,
0
,
nextrankIndex
)
...
...
@@ -472,22 +468,18 @@ func IceGameTopRedisGetSingleUserRangeRankInfo(uid string, gtid string, gid stri
}
else
if
sorceorder
==
"0"
{
if
prerankIndex
!=
0
{
strList1
,
err
=
RedisZRevRangeByScore
(
redisConn
,
"sortset:gtid:"
+
gtid
+
":gid:"
+
gid
+
":toptype:"
+
toptype
,
scoreString
,
"-inf"
,
"true"
,
0
,
prerankIndex
)
log
.
Println
(
"strList1 : "
,
strList1
)
//将结果倒序
var
tempList
[]
string
log
.
Println
(
len
(
strList1
))
for
i
:=
len
(
strList1
)
-
1
;
i
>=
0
;
i
-=
2
{
tempList
=
append
(
tempList
,
strList1
[
i
-
1
])
tempList
=
append
(
tempList
,
strList1
[
i
])
}
strList1
=
tempList
log
.
Println
(
"tempList : "
,
strList1
)
}
if
nextrankIndex
!=
0
{
strList2
,
err
=
RedisZRangeByScore
(
redisConn
,
"sortset:gtid:"
+
gtid
+
":gid:"
+
gid
+
":toptype:"
+
toptype
,
scoreString
,
"+inf"
,
"true"
,
0
,
nextrankIndex
)
log
.
Println
(
"strList2 : "
,
strList2
)
}
if
len
(
strList1
)
==
0
{
strList
=
append
(
strList
,
"ice_gametop:uid:"
+
uid
+
":gtid:"
+
gtid
+
":gid:"
+
gid
+
":toptype:"
+
toptype
+
":mykey"
)
...
...
@@ -547,7 +539,7 @@ func IceGameTopRedisGetSingleUserRangeRankInfo(uid string, gtid string, gid stri
return
nil
,
rank
.
(
string
),
err
}
igt
[
s
]
.
RankIndex
=
int
(
count
.
(
int64
))
-
1
-
rank
.
(
int
)
igt
[
s
]
.
RankIndex
=
int
(
count
.
(
int64
))
-
rank
.
(
int
)
igt
[
s
]
.
MyKey
=
strList
[
i
+
1
]
//查询储存昵称以及头像url的redis
resultstr
,
err
=
RedisGetKV
(
redisConn
,
"GUID:"
+
igt
[
s
]
.
UID
)
...
...
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