47 lines
1.4 KiB
Go
47 lines
1.4 KiB
Go
package httpcall
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"errors"
|
|
"finclip-app-manager/infrastructure/config"
|
|
"fmt"
|
|
)
|
|
|
|
type GetAuditDataInfoByBuildInfoIdRsp struct {
|
|
Data AuditDataInfoByBuildInfoIdRsp `json:"data"`
|
|
Errcode string `json:"errcode"`
|
|
Errmsg string `json:"error"`
|
|
}
|
|
|
|
type AuditDataInfoByBuildInfoIdRsp struct {
|
|
AuditId string `json:"auditId"`
|
|
BuildInfoId string `json:"buildInfoId"`
|
|
AppID string `json:"appId"`
|
|
Version string `json:"version"`
|
|
Status int `json:"status"`
|
|
OperOpinion int `json:"operOpinion"`
|
|
Approver string `json:"approver"` //审批人
|
|
}
|
|
|
|
type GetAuditDataInfoByBuildInfoIdReq struct {
|
|
BuildInfoId string `json:"buildInfoId" form:"buildInfoId"`
|
|
}
|
|
|
|
func (c *Client) GetAuditDataInfoByBuildInfoId(ctx context.Context, buildInfoId string) (*GetAuditDataInfoByBuildInfoIdRsp, error) {
|
|
rspInfo := GetAuditDataInfoByBuildInfoIdRsp{}
|
|
|
|
url := fmt.Sprintf(config.GetConfig().GetAuditDataInfoByBuildInfoIdUrl+"?buildInfoId=%s", buildInfoId)
|
|
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).Get(url)
|
|
if err != nil || rsp.StatusCode() != 200 {
|
|
log.Errorf("GetAppletVerByAppId rsp body", rsp.String())
|
|
return nil, errors.New("GetAppletVerByAppId error")
|
|
}
|
|
err = json.Unmarshal(rsp.Body(), &rspInfo)
|
|
if err != nil {
|
|
log.Errorf("GetAppletVerByAppId unmarshal rsp error:%s,rspbody:%+v", err, rsp)
|
|
return nil, err
|
|
}
|
|
return &rspInfo, nil
|
|
}
|