// Copyright 2021 getensh.com. All rights reserved. // Use of this source code is governed by getensh.com. package bill import ( "context" "fmt" "git.getensh.com/common/gopkgs/cache" "git.getensh.com/common/gopkgs/logger" "go.uber.org/zap" "property-task/impl/v1/common" "property-task/pb" pb_v1 "property-task/pb/v1" "time" ) // 定时生成账单 func GenerateBill() { cache.RedisLock(common.TaskKey) defer cache.RedisUnlock(common.TaskKey) // 获取小区列表 ids := common.GetGardenList() mreq := pb_v1.GenerateBillRequest{} fmt.Printf("开始生成账单:%v\n", time.Now().Format("2006-01-02 15:04:05")) for _, v := range ids { mreq.GardenId = v.GardenId _, err := pb.Garden.GenerateBill(context.Background(), &mreq) if err != nil { logger.Error("func", zap.String("call", "pb.Garden.GenerateBill "), zap.String("error", err.Error())) } } }