Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-common
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujiebin
hilo-common
Commits
e3be2346
You need to sign in or sign up before continuing.
Commit
e3be2346
authored
Jun 21, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:庆幸有冗余数据
parent
f44d7fed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
cp_pairs_stat.go
script/cp_pairs_stat.go
+6
-4
No files found.
script/cp_pairs_stat.go
View file @
e3be2346
...
...
@@ -81,13 +81,14 @@ type CpInfo struct {
}
type
CpLevel
struct
{
CpId
uint64
Level
uint64
CpId
uint64
Level
uint64
CreatedTime
time
.
Time
}
func
main
()
{
var
cpInfos
[]
*
CpInfo
if
err
:=
mysql
.
ProdReadOnlyDB
.
Table
(
"cp_relation"
)
.
Select
(
"id,user_id1,user_id2
,created_time
"
)
.
Find
(
&
cpInfos
)
.
Error
;
err
!=
nil
{
if
err
:=
mysql
.
ProdReadOnlyDB
.
Table
(
"cp_relation"
)
.
Select
(
"id,user_id1,user_id2"
)
.
Find
(
&
cpInfos
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
var
cpIds
[]
uint64
...
...
@@ -95,7 +96,7 @@ func main() {
cpIds
=
append
(
cpIds
,
v
.
Id
)
}
var
cpLevels
[]
CpLevel
if
err
:=
mysql
.
ProdReadOnlyDB
.
Table
(
"cp_level"
)
.
Select
(
"cp_id,level"
)
.
Where
(
"cp_id in ?"
,
cpIds
)
.
Find
(
&
cpLevels
)
.
Error
;
err
!=
nil
{
if
err
:=
mysql
.
ProdReadOnlyDB
.
Table
(
"cp_level"
)
.
Select
(
"cp_id,level
,created_time
"
)
.
Where
(
"cp_id in ?"
,
cpIds
)
.
Find
(
&
cpLevels
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
var
userIds
[]
uint64
...
...
@@ -106,6 +107,7 @@ func main() {
for
_
,
v2
:=
range
cpLevels
{
if
v
.
Id
==
v2
.
CpId
{
cpInfos
[
i
]
.
Level
=
v2
.
Level
cpInfos
[
i
]
.
CreatedTime
=
v2
.
CreatedTime
break
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment