云算提交任务添加ip信息
This commit is contained in:
parent
d663fec04d
commit
dea9e77de5
|
@ -7,7 +7,6 @@ import (
|
|||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"net/http"
|
||||
)
|
||||
|
@ -21,8 +20,8 @@ func CommitGeneralTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||
return
|
||||
}
|
||||
// 获取ip信息
|
||||
ip := utils.GetClientIP(r)
|
||||
req.UserIp = ip
|
||||
//ip := utils.GetClientIP(r)
|
||||
//req.UserIp = ip
|
||||
// 获取token信息
|
||||
token := r.Header.Get("Authorization")
|
||||
req.Token = token
|
||||
|
|
|
@ -140,7 +140,7 @@ func (l *CommitGeneralTaskLogic) CommitGeneralTask(req *types.GeneralTaskReq) er
|
|||
return err
|
||||
}
|
||||
remoteUtil.Evidence(remoteUtil.EvidenceParam{
|
||||
UserIp: req.UserIp,
|
||||
//UserIp: req.UserIp,
|
||||
Url: l.svcCtx.Config.BlockChain.Url,
|
||||
ContractAddress: l.svcCtx.Config.BlockChain.ContractAddress,
|
||||
FunctionName: l.svcCtx.Config.BlockChain.FunctionName,
|
||||
|
|
|
@ -20,7 +20,7 @@ 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("X-Forwarded-For", EvidenceParam.UserIp).
|
||||
SetHeader("Authorization", EvidenceParam.Token).
|
||||
SetBody(&EvidenceParam).
|
||||
Post(EvidenceParam.Url)
|
||||
|
|
Loading…
Reference in New Issue