update
This commit is contained in:
@@ -136,11 +136,6 @@ func NewTaxHealthService(userID, privateKey string) *TaxHealthService {
|
||||
|
||||
// GetCompanyInfo 查询公司信息
|
||||
func (s *CompanyInfoService) GetCompanyInfo(companyName string, apis []string) (*CompanyInfoResponse, error) {
|
||||
// 生成随机数和时间戳
|
||||
r, _ := rand.Int(rand.Reader, big.NewInt(10000))
|
||||
nonce := strconv.FormatInt(r.Int64(), 10)
|
||||
timestamp := strconv.FormatInt(time.Now().Unix()*1000, 10)
|
||||
|
||||
// 构建查询参数
|
||||
params := url.Values{}
|
||||
params.Set("name", companyName)
|
||||
@@ -148,20 +143,9 @@ func (s *CompanyInfoService) GetCompanyInfo(companyName string, apis []string) (
|
||||
|
||||
apiURL := "https://a.cmdp.cn/cmds/v1/company/info-rest/custom?" + params.Encode()
|
||||
|
||||
// 生成签名
|
||||
signData := s.userID + timestamp + nonce + apiURL
|
||||
signature, err := s.generateSignature([]byte(signData))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("生成签名失败: %v", err)
|
||||
}
|
||||
|
||||
// 设置请求头
|
||||
headers := map[string]string{
|
||||
"Accept": "application/json",
|
||||
"x-gi-user-id": s.userID,
|
||||
"x-gi-user-sig": signature,
|
||||
"x-gi-nonce": nonce,
|
||||
"x-gi-timestamp": timestamp,
|
||||
"Accept": "application/json",
|
||||
}
|
||||
|
||||
// 发送GET请求
|
||||
@@ -182,7 +166,8 @@ func (s *CompanyInfoService) GetCompanyInfo(companyName string, apis []string) (
|
||||
// EvaluateTaxHealth 执行税务健康测评
|
||||
func (s *TaxHealthService) EvaluateTaxHealth(request TaxEvalRequest) (*TaxEvalResponse, error) {
|
||||
// 生成随机数和时间戳
|
||||
nonce := "12345"
|
||||
r, _ := rand.Int(rand.Reader, big.NewInt(10000))
|
||||
nonce := strconv.FormatInt(r.Int64(), 10)
|
||||
timestamp := strconv.FormatInt(time.Now().Unix()*1000, 10)
|
||||
apiURL := "https://api.cmdp.cn/v1/eval/tax-risk"
|
||||
// 序列化请求体
|
||||
@@ -246,8 +231,6 @@ func (s *TaxHealthService) QueryTaxEvalResult(orderNo string) (*TaxEvalQueryResp
|
||||
"x-gi-nonce": nonce,
|
||||
"x-gi-timestamp": timestamp,
|
||||
}
|
||||
fmt.Println(headers)
|
||||
fmt.Println(apiURL)
|
||||
// 发送GET请求
|
||||
response, err := s.httpClient.Get(apiURL, headers)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user