Ben 1 年間 前
コミット
7320e6f337
2 ファイル変更8 行追加0 行削除
  1. 1 0
      internal/dto/response.go
  2. 7 0
      internal/server/server.go

+ 1 - 0
internal/dto/response.go

@@ -67,4 +67,5 @@ type ConfigResponse struct {
 
 type ConfigResult struct {
 	FreeTrialDuration uint64 `json:"freeTrialDuration"`
+	Timestamp         int64  `json:"timestamp"`
 }

+ 7 - 0
internal/server/server.go

@@ -28,6 +28,7 @@ func Config(c *gin.Context) {
 		Response: dto.NewOkResponse(),
 		Data: dto.ConfigResult{
 			FreeTrialDuration: totalFreeDuration - usedDuration,
+			Timestamp:         time.Now().Unix(),
 		},
 	})
 }
@@ -44,10 +45,16 @@ func UpdateUsedDuration(c *gin.Context) {
 		dto.Error(c, err)
 		return
 	}
+	usedDuration, err = storage.GetUsedDuration(deviceId)
+	if err != nil {
+		dto.Error(c, err)
+		return
+	}
 	c.JSON(http.StatusOK, dto.ConfigResponse{
 		Response: dto.NewOkResponse(),
 		Data: dto.ConfigResult{
 			FreeTrialDuration: totalFreeDuration - usedDuration,
+			Timestamp:         time.Now().Unix(),
 		},
 	})
 }