初始
This commit is contained in:
122
api/pilot/manage/manage.go
Normal file
122
api/pilot/manage/manage.go
Normal file
@ -0,0 +1,122 @@
|
||||
package manage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
)
|
||||
|
||||
type MANAGE struct {
|
||||
}
|
||||
type UsualRes struct {
|
||||
}
|
||||
type BindReq struct {
|
||||
g.Meta `path:"devices/{device_sn}/binding" summary:"绑定设备" method:"post" tags:"无人机遥控器"`
|
||||
DeviceSN string `json:"device_sn"`
|
||||
UserID string `json:"user_id"`
|
||||
WorkspaceId string `json:"workspace_id"`
|
||||
}
|
||||
|
||||
func (receiver *MANAGE) Bind(ctx context.Context, req *BindReq) (res *UsualRes, err error) {
|
||||
fmt.Println(req.DeviceSN)
|
||||
fmt.Println(req.UserID)
|
||||
fmt.Println(req.WorkspaceId)
|
||||
return
|
||||
}
|
||||
|
||||
type UserCurrentReq struct {
|
||||
g.Meta `path:"users/current" summary:"获取当前用户信息信息" method:"get" tags:"无人机遥控器"`
|
||||
}
|
||||
type UserCurrentRes struct {
|
||||
Username string `json:"username"`
|
||||
UserId string `json:"user_id"`
|
||||
WorkspaceId string `json:"workspace_id"`
|
||||
UserType int `json:"user_type"`
|
||||
MqttUsername string `json:"mqtt_username"`
|
||||
MqttPassword string `json:"mqtt_password"`
|
||||
MqttAddr string `json:"mqtt_addr"`
|
||||
}
|
||||
|
||||
func (receiver *MANAGE) UserCurrent(ctx context.Context, req *UserCurrentReq) (res *UserCurrentRes, err error) {
|
||||
res = &UserCurrentRes{}
|
||||
res.Username = "pilot"
|
||||
res.UserId = "be7c6c3d-afe9-4be4-b9eb-c55066c0914e"
|
||||
res.WorkspaceId = "e3dea0f5-37f2-4d79-ae58-490af3228069"
|
||||
res.UserType = 2
|
||||
res.MqttUsername = "pilot"
|
||||
res.MqttPassword = "pilot123"
|
||||
res.MqttAddr = "tcp://jl.yj-3d.com:1883"
|
||||
return
|
||||
}
|
||||
|
||||
type WorkSpaceCurrentReq struct {
|
||||
g.Meta `path:"workspaces/current" summary:"获取当前工作空间信息" method:"get" tags:"无人机遥控器"`
|
||||
}
|
||||
type WorkSpaceCurrentRes struct {
|
||||
WorkspaceId string `json:"workspace_id"`
|
||||
WorkspaceName string `json:"workspace_name"`
|
||||
WorkspaceDesc string `json:"workspace_desc"`
|
||||
PlatformName string `json:"platform_name"`
|
||||
BindCode string `json:"bind_code"`
|
||||
}
|
||||
|
||||
func (receiver *MANAGE) WorkSpaceCurrent(ctx context.Context, req *WorkSpaceCurrentReq) (res *WorkSpaceCurrentRes, err error) {
|
||||
res = &WorkSpaceCurrentRes{}
|
||||
res.WorkspaceName = "测试组"
|
||||
res.WorkspaceId = "e3dea0f5-37f2-4d79-ae58-490af3228069"
|
||||
res.WorkspaceDesc = "中煤科工测试云平台"
|
||||
res.PlatformName = "中煤科工光伏平台"
|
||||
res.BindCode = "qwe"
|
||||
return
|
||||
}
|
||||
|
||||
type TopologiesReq struct {
|
||||
g.Meta `path:"workspaces/{workspace_id}/devices/topologies" summary:"获取设备拓扑列表)" method:"get" tags:"无人机遥控器"`
|
||||
}
|
||||
type TopologiesRes struct {
|
||||
List []struct {
|
||||
Hosts []struct {
|
||||
Sn string `json:"sn"`
|
||||
DeviceModel struct {
|
||||
Key string `json:"key"`
|
||||
Domain string `json:"domain"`
|
||||
Type string `json:"type"`
|
||||
SubType string `json:"sub_type"`
|
||||
} `json:"device_model"`
|
||||
OnlineStatus bool `json:"online_status"`
|
||||
DeviceCallsign string `json:"device_callsign"`
|
||||
UserId string `json:"user_id"`
|
||||
UserCallsign string `json:"user_callsign"`
|
||||
IconUrls struct {
|
||||
NormalIconUrl string `json:"normal_icon_url"`
|
||||
SelectedIconUrl string `json:"selected_icon_url"`
|
||||
} `json:"icon_urls"`
|
||||
} `json:"hosts"`
|
||||
Parents []struct {
|
||||
Sn string `json:"sn"`
|
||||
OnlineStatus bool `json:"online_status"`
|
||||
DeviceModel struct {
|
||||
Key string `json:"key"`
|
||||
Domain string `json:"domain"`
|
||||
Type string `json:"type"`
|
||||
SubType string `json:"sub_type"`
|
||||
} `json:"device_model"`
|
||||
DeviceCallsign string `json:"device_callsign"`
|
||||
UserId string `json:"user_id"`
|
||||
UserCallsign string `json:"user_callsign"`
|
||||
IconUrls struct {
|
||||
NormalIconUrl string `json:"normal_icon_url"`
|
||||
SelectedIconUrl string `json:"selected_icon_url"`
|
||||
} `json:"icon_urls"`
|
||||
} `json:"parents"`
|
||||
} `json:"list"`
|
||||
}
|
||||
|
||||
func (receiver *MANAGE) Topologies(ctx context.Context, req *TopologiesReq) (res *TopologiesRes, err error) {
|
||||
workspace_id := ghttp.RequestFromCtx(ctx).Get("workspace_id")
|
||||
fmt.Println("workspace_id", workspace_id)
|
||||
res = &TopologiesRes{}
|
||||
|
||||
return
|
||||
}
|
Reference in New Issue
Block a user