40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
|
package manage
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"github.com/gogf/gf/v2/frame/g"
|
||
|
)
|
||
|
|
||
|
type LOGIN struct {
|
||
|
}
|
||
|
type LoginReq struct {
|
||
|
g.Meta `path:"login" summary:"pilot登录" method:"post" tags:"无人机遥控器"`
|
||
|
|
||
|
Username string `json:"username" v:"required"`
|
||
|
Password string `json:"password" v:"required"`
|
||
|
//Flag int `json:"flag" v:"required"`
|
||
|
}
|
||
|
type LoginRes 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"`
|
||
|
AccessToken string `json:"access_token"`
|
||
|
MqttAddr string `json:"mqtt_addr"`
|
||
|
}
|
||
|
|
||
|
func (receiver *LOGIN) Login(ctx context.Context, req *LoginReq) (res *LoginRes, err error) {
|
||
|
res = &LoginRes{}
|
||
|
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.AccessToken = "abc"
|
||
|
res.MqttAddr = "tcp://jl.yj-3d.com:1883"
|
||
|
return
|
||
|
}
|