Skip to content

Commit

Permalink
添加代发下载地址
Browse files Browse the repository at this point in the history
  • Loading branch information
ahKevinXy committed Jul 11, 2023
1 parent da9e75a commit c3bcc56
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions handler/payroll_old/statement.go
Original file line number Diff line number Diff line change
@@ -1 +1,51 @@
package payroll_old

import (
"encoding/json"
"github.com/ahKevinXy/go-cmb/cmb_errors"
"github.com/ahKevinXy/go-cmb/constants"
"github.com/ahKevinXy/go-cmb/help"
"github.com/ahKevinXy/go-cmb/models"
"strconv"
"time"
)

// QueryPayrollStatementDownloadUrl
// @Description: 获取回单地址
// @param userId
// @param sm4PrivateKey
// @param userPrivateKey
// @param taskid 查询ID
// @return *models.QueryBatchTransListResponse
// @return error
// @Author ahKevinXy
// @Date 2023-04-14 17:33:31
func QueryPayrollStatementDownloadUrl(userId, sm4PrivateKey, userPrivateKey, taskid string) (*models.QueryBatchTransListResponse, error) {
reqData := new(models.QueryPayrollStatementDownloadUrlRequest)
reqData.Request.Head.Reqid = time.Now().Format("20060102150405000") + strconv.Itoa(time.Now().Nanosecond())
reqData.Request.Head.Funcode = constants.CmbPayrollStatementDownloadUrl
reqData.Request.Head.Userid = userId
reqData.Signature.Sigtim = time.Now().Format("20060102150405")
reqData.Signature.Sigdat = "__signature_sigdat__"
reqData.Request.Body.Taskid = taskid
req, err := json.Marshal(reqData)
if err != nil {
return nil, err
}

res, err := help.CmbSignRequest(string(req), constants.CmbPayrollStatementDownloadUrl, userId, userPrivateKey, sm4PrivateKey)
if err != nil {
return nil, err
}
if res == "" {
return nil, cmb_errors.SystemError
}

var resp models.QueryBatchTransListResponse

if err := json.Unmarshal([]byte(res), &resp); err != nil {
return nil, err
}

return &resp, err
}

0 comments on commit c3bcc56

Please sign in to comment.