Pārlūkot izejas kodu

fix: 测试路由每次生成唯一车牌——避免空车牌重复入场冲突

lq 1 mēnesi atpakaļ
vecāks
revīzija
3b3b655557
1 mainītis faili ar 6 papildinājumiem un 1 dzēšanām
  1. 6 1
      internal/modules/printer/api.go

+ 6 - 1
internal/modules/printer/api.go

@@ -1,6 +1,9 @@
 package printer
 
 import (
+	"fmt"
+	"time"
+
 	"github.com/gin-gonic/gin"
 	"wails-app/internal/dao"
 	"wails-app/internal/global"
@@ -73,8 +76,10 @@ func SetupPrinterPublic(router *gin.RouterGroup) {
 }
 
 func TicketMachineButtonTest(c *gin.Context) {
+	// 每次生成唯一测试车牌
+	testPlate := fmt.Sprintf("TEST%04d", time.Now().Unix()%10000)
 	entryResp, err := vehicleSvc.VehicleEntry(request.VehicleEntry{
-		PlateNumber: "", RFIDTag: "",
+		PlateNumber: testPlate, RFIDTag: "",
 		ParkingLotID: 1, ParkingSpaceID: 1,
 	})
 	if err != nil {