25 lines
556 B
Go
25 lines
556 B
Go
package client
|
||
|
||
import (
|
||
"bash_go_service/shared/pkg/client"
|
||
"bash_go_service/shared/pkg/constants"
|
||
"fmt"
|
||
|
||
"backend-service/pkg/machine"
|
||
)
|
||
|
||
type Result struct {
|
||
Success bool `json:"success"` // 使用大写字段名,并添加json tag
|
||
Msg string `json:"msg"`
|
||
}
|
||
|
||
func SendMachineInfo(info *machine.Info) (Result, error) {
|
||
var result Result
|
||
client := client.NewClient()
|
||
err := client.Post(constants.MachineInfoApi, info, nil, &result)
|
||
if err != nil {
|
||
return result, fmt.Errorf("send machine info failed: %w", err)
|
||
}
|
||
return result, nil
|
||
}
|