bash_go_service/backend-service/pkg/api/api.go

25 lines
556 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
}