Skip to content

Commit

Permalink
use device timestamp (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
huangzhiran authored Nov 13, 2024
1 parent d493c90 commit f899715
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions api/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"encoding/base64"
"encoding/hex"
"encoding/json"
"fmt"
"log/slog"
"math/big"
"net/http"
Expand Down Expand Up @@ -391,9 +392,9 @@ func (s *httpServer) handleSensor(id string, pkg *proto.BinPackage, data *proto.
}

dr := &db.DeviceRecord{
ID: id + "-" + data.GetRandom(),
ID: id + "-" + fmt.Sprintf("%d", pkg.GetTimestamp()),
Imei: id,
Timestamp: time.Now().Unix(),
Timestamp: int64(pkg.GetTimestamp()),
Signature: hex.EncodeToString(append(pkg.GetSignature(), 0)),
Operator: "",
Snr: strconv.FormatFloat(snr, 'f', 1, 64),
Expand Down

0 comments on commit f899715

Please sign in to comment.