|
|
@@ -16,19 +16,19 @@ func GetChannelEvents(c *gin.Context) {
|
|
|
response.OkWithData(events, c)
|
|
|
}
|
|
|
|
|
|
-// SimulateEvent 模拟RFID扫描(测试用)
|
|
|
+// SimulateEvent 模拟RFID/车牌识别(测试用)
|
|
|
func SimulateEvent(c *gin.Context) {
|
|
|
rfid := c.Query("rfid")
|
|
|
+ plate := c.Query("plate")
|
|
|
direction := c.Query("direction") // in / out
|
|
|
- if rfid == "" {
|
|
|
- response.FailWithMessage("rfid参数不能为空", c)
|
|
|
+ if rfid == "" && plate == "" {
|
|
|
+ response.FailWithMessage("rfid或plate参数不能同时为空", c)
|
|
|
return
|
|
|
}
|
|
|
if direction == "" {
|
|
|
direction = "in"
|
|
|
}
|
|
|
|
|
|
- // 获取第一个通道名
|
|
|
var channelName string
|
|
|
global.GVA_DB.Raw("SELECT channel_name FROM channel LIMIT 1").Scan(&channelName)
|
|
|
if channelName == "" {
|
|
|
@@ -38,6 +38,7 @@ func SimulateEvent(c *gin.Context) {
|
|
|
uhf.PushChannelEvent(uhf.ChannelEvent{
|
|
|
DeviceCode: "SIM-001",
|
|
|
RFIDTag: rfid,
|
|
|
+ PlateNumber: plate,
|
|
|
Direction: direction,
|
|
|
ChannelName: channelName,
|
|
|
Timestamp: time.Now().Unix(),
|