123456789101112131415161718192021222324252627282930 |
- // Copyright 2021 getensh.com. All rights reserved.
- // Use of this source code is governed by getensh.com.
- package common
- import (
- "context"
- "property-task/pb"
- pb_v1 "property-task/pb/v1"
- "time"
- )
- const TaskKey = "property_bill_task"
- // 获取小区列表
- var ids []*pb_v1.GardenIdInfo
- var timestamp int64
- func GetGardenList() []*pb_v1.GardenIdInfo {
- now := time.Now()
- nowDay := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
- if len(ids) > 0 && nowDay.Unix() == timestamp {
- return ids
- }
- reply, err := pb.System.GardenIds(context.Background(), &pb_v1.GardenIdsRequest{})
- if err != nil {
- return nil
- }
- ids = reply.GardenIds
- timestamp = nowDay.Unix()
- return reply.GardenIds
- }
|