diff --git a/cmd/main.go b/cmd/main.go index b5e54e8..8f6df5f 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -668,11 +668,15 @@ func main() { base64DecryptedBytes, _ := base64.StdEncoding.DecodeString(*account.MobilePhone) phone, _ := cryptoService.DecryptByAES(base64DecryptedBytes) phoneStr := string(phone) - mid := *account.Mid - name := *account.Name - userId := *account.UserId - zoneMomentCount, _ := client.GetZoneMomentCountByMid(ctx, mid) - str := fmt.Sprintf("%v %v %v %v %v\n", mid, name, userId, phoneStr, zoneMomentCount) + mid := account.GetMid() + name := account.GetName() + userId := account.GetUserId() + count := int64(0) + zone, ok := zoneMp[mid] + if ok { + count = zone.GetZoneMomentCount() + } + str := fmt.Sprintf("%v %v %v %v %v\n", mid, name, userId, phoneStr, count) writer.WriteString(str) } diff --git a/dbstruct/account.go b/dbstruct/account.go index 3fa04fc..ce606de 100644 --- a/dbstruct/account.go +++ b/dbstruct/account.go @@ -31,3 +31,24 @@ type Account struct { Ut *int64 `json:"ut" bson:"ut"` // 更新时间 DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记,0-否,1-是 } + +func (p *Account) GetMid() int64 { + if p != nil && p.Mid != nil { + return *p.Mid + } + return 0 +} + +func (p *Account) GetName() string { + if p != nil && p.Name != nil { + return *p.Name + } + return "" +} + +func (p *Account) GetUserId() int64 { + if p != nil && p.UserId != nil { + return *p.UserId + } + return 0 +} diff --git a/dbstruct/zone.go b/dbstruct/zone.go index 1b89ec0..8a5ad98 100644 --- a/dbstruct/zone.go +++ b/dbstruct/zone.go @@ -28,6 +28,13 @@ func (p *Zone) GetMid() int64 { return 0 } +func (p *Zone) GetZoneMomentCount() int64 { + if p != nil && p.ZoneMomentCount != nil { + return *p.ZoneMomentCount + } + return 0 +} + func (p *Zone) GetLastZoneMomentCt() int64 { if p != nil && p.LastZoneMomentCt != nil { return *p.LastZoneMomentCt