From e3be2346e8d01453d461cffd82790d6c3a14f451 Mon Sep 17 00:00:00 2001 From: hujiebin Date: Wed, 21 Jun 2023 15:53:58 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=BA=86=E5=B9=B8=E6=9C=89?= =?UTF-8?q?=E5=86=97=E4=BD=99=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/cp_pairs_stat.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/script/cp_pairs_stat.go b/script/cp_pairs_stat.go index 18fa460..d55a626 100644 --- a/script/cp_pairs_stat.go +++ b/script/cp_pairs_stat.go @@ -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 } } -- 2.22.0