This commit is contained in:
parent
6a71858448
commit
76db68e203
68
cmd/main.go
68
cmd/main.go
|
@ -25,7 +25,7 @@ func main() {
|
|||
}
|
||||
|
||||
ctx := context.Background()
|
||||
mids := []int64{
|
||||
mids1 := []int64{
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
|
@ -343,6 +343,9 @@ func main() {
|
|||
195763,
|
||||
197811,
|
||||
199188,
|
||||
}
|
||||
|
||||
mids2 := []int64{
|
||||
202826,
|
||||
204372,
|
||||
205940,
|
||||
|
@ -641,16 +644,6 @@ func main() {
|
|||
460716,
|
||||
}
|
||||
|
||||
accounts, err := client.GetAccountListByMids(ctx, mids)
|
||||
if err != nil {
|
||||
fmt.Printf("GetAccountListByMids fail, err :%v\n", err)
|
||||
}
|
||||
|
||||
zones, err := client.GetZoneListByMids(ctx, mids)
|
||||
if err != nil {
|
||||
fmt.Printf("GetZoneListByMids fail, err :%v\n", err)
|
||||
}
|
||||
|
||||
outfilePath := "/app/dataprep/outfile.txt"
|
||||
outfile, err := os.OpenFile(outfilePath, os.O_WRONLY|os.O_CREATE, 0666)
|
||||
if err != nil {
|
||||
|
@ -659,33 +652,42 @@ func main() {
|
|||
defer outfile.Close()
|
||||
writer := bufio.NewWriter(outfile)
|
||||
|
||||
zoneMp := make(map[int64]*dbstruct.Zone, 0)
|
||||
for _, zone := range zones {
|
||||
zoneMp[zone.GetMid()] = zone
|
||||
}
|
||||
midss := [][]int64{mids1, mids2}
|
||||
for _, mids := range midss {
|
||||
accounts, err := client.GetAccountListByMids(ctx, mids)
|
||||
if err != nil {
|
||||
fmt.Printf("GetAccountListByMids fail, err :%v\n", err)
|
||||
}
|
||||
|
||||
for _, account := range accounts {
|
||||
base64DecryptedBytes, err := base64.StdEncoding.DecodeString(*account.MobilePhone)
|
||||
zones, err := client.GetZoneListByMids(ctx, mids)
|
||||
if err != nil {
|
||||
fmt.Printf("DecodeString err :%v\n", err)
|
||||
fmt.Printf("GetZoneListByMids fail, err :%v\n", err)
|
||||
}
|
||||
fmt.Printf("base64DecryptedBytes: %v\n", base64DecryptedBytes)
|
||||
phone, err := cryptoService.DecryptByAES(base64DecryptedBytes)
|
||||
if err != nil {
|
||||
fmt.Printf("DecryptByAES err :%v\n", err)
|
||||
|
||||
zoneMp := make(map[int64]*dbstruct.Zone, 0)
|
||||
for _, zone := range zones {
|
||||
zoneMp[zone.GetMid()] = zone
|
||||
}
|
||||
fmt.Printf("phone: %v\n", phone)
|
||||
phoneStr := string(phone)
|
||||
mid := account.GetMid()
|
||||
name := account.GetName()
|
||||
userId := account.GetUserId()
|
||||
count := int64(0)
|
||||
zone, ok := zoneMp[mid]
|
||||
if ok {
|
||||
count = zone.GetZoneMomentCount()
|
||||
|
||||
for _, account := range accounts {
|
||||
base64DecryptedBytes, _ := base64.StdEncoding.DecodeString(*account.MobilePhone)
|
||||
phone, err := cryptoService.DecryptByAES(base64DecryptedBytes)
|
||||
if err != nil {
|
||||
fmt.Printf("DecryptByAES err :%v\n", err)
|
||||
}
|
||||
fmt.Printf("phone: %v\n", string(phone))
|
||||
phoneStr := string(phone)
|
||||
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)
|
||||
}
|
||||
str := fmt.Sprintf("%v %v %v %v %v\n", mid, name, userId, phoneStr, count)
|
||||
writer.WriteString(str)
|
||||
}
|
||||
|
||||
fmt.Println("End importing...")
|
||||
|
|
Loading…
Reference in New Issue