pcm-coordinator/pkg/utils/remoteUtil/BlockChain.go

33 lines
909 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 remoteUtil
import (
"fmt"
"github.com/go-resty/resty/v2"
)
type EvidenceParam struct {
Url string `json:"url"`
Type string `json:"type"`
MemberName string `json:"memberName"`
ContractAddress string `json:"contractAddress"`
FunctionName string `json:"functionName"`
Args []string `json:"args"`
Token string `json:"token"`
UserIp string `json:"userIp"`
Amount int64 `json:"amount"`
}
func Evidence(EvidenceParam EvidenceParam) error {
fmt.Println("输出的user ip为" + EvidenceParam.UserIp)
httpClient := resty.New().R()
_, err := httpClient.SetHeader("Content-Type", "application/json").
SetHeader("X-Forwarded-For", EvidenceParam.UserIp).
SetHeader("Authorization", EvidenceParam.Token).
SetBody(&EvidenceParam).
Post(EvidenceParam.Url)
if err != nil {
return err
}
return nil
}