|
@@ -9,6 +9,7 @@ import (
|
|
|
"confrontation-training/middleware"
|
|
|
"confrontation-training/models"
|
|
|
modelsChat "confrontation-training/models/chat"
|
|
|
+ modelsDevice "confrontation-training/models/gateway"
|
|
|
"fmt"
|
|
|
"github.com/gin-gonic/gin"
|
|
|
swaggerFiles "github.com/swaggo/files"
|
|
@@ -19,7 +20,7 @@ import (
|
|
|
func Router() {
|
|
|
|
|
|
//初始化表格
|
|
|
- initTableErr := global.Db.AutoMigrate(&models.User{}, &modelsChat.Question{}, &modelsChat.Answer{})
|
|
|
+ initTableErr := global.Db.AutoMigrate(&models.User{}, &modelsChat.Question{}, &modelsChat.Answer{}, &modelsDevice.DeviceInfo{})
|
|
|
if initTableErr != nil {
|
|
|
fmt.Printf("初始化表格异常:%s", initTableErr.Error())
|
|
|
return
|
|
@@ -51,7 +52,7 @@ func Router() {
|
|
|
user.POST("/reset", gateway.GetUser().ResetPassword)
|
|
|
user.GET("/find", gateway.GetUser().UserList)
|
|
|
user.POST("/change/password", gateway.GetUser().ModePass)
|
|
|
- device := v1.Group("/device")
|
|
|
+ device := v1.Group("/device/")
|
|
|
device.GET("/scan", gateway.ScanDevice)
|
|
|
device.GET("/connection", gateway.ConnectDevice)
|
|
|
device.POST("/write/data/", gateway.WriteData)
|
|
@@ -60,7 +61,7 @@ func Router() {
|
|
|
device.GET("/:mac/stop/collect/", gateway.StopCollect)
|
|
|
device.GET("/:mac/disconnect/", gateway.Disconnect)
|
|
|
device.POST("/add/", gateway.GetDeviceService().DeviceAdd)
|
|
|
- device.DELETE("/:mac/remove", gateway.GetDeviceService().DeviceRemove)
|
|
|
+ device.DELETE("/:mac/remove/", gateway.GetDeviceService().DeviceRemove)
|
|
|
device.GET("/list/:type", gateway.GetDeviceService().DeviceList)
|
|
|
chats := v1.Group("/chat")
|
|
|
chats.GET("/get/chat/", chat.GetQuestionService().GetQuestion)
|