vehicle.go 846 B

123456789101112131415161718192021222324252627282930313233
  1. package vehicle
  2. import (
  3. "context"
  4. "gd_crontab/apis"
  5. "encoding/json"
  6. "fmt"
  7. "strings"
  8. "time"
  9. )
  10. func RunProviderExport(){
  11. now := time.Now().Format("2006-01-02 15:04:05")
  12. array := strings.Split(now, " ")
  13. now = fmt.Sprintf("%s 00:00:00", array[0])
  14. loc, _ := time.LoadLocation("Local")
  15. end, _ := time.ParseInLocation("2006-01-02 15:04:05", now, loc)
  16. start := end.AddDate(0, 0, -2)
  17. end = end.AddDate(0, 0, -1)
  18. req := apis.LogQueryProviderCountExportReq{}
  19. reply := apis.LogQueryProviderCountExportReply{}
  20. req.StartTimestamp = start.Unix()
  21. req.EndTimestamp = end.Unix()
  22. //err := crontab.LogQueryProviderCountExportNew(&req,&reply)
  23. if err := xcli.Call(context.Background(), "ExportProviderDay", req, &reply); err != nil {
  24. fmt.Println("failed to call: ", err)
  25. } else {
  26. d, _ := json.Marshal(reply)
  27. fmt.Println(string(d))
  28. }
  29. }