This commit is contained in:
邹宗楠
2024-01-16 16:24:32 +08:00
parent 2fd23aff1f
commit 2182c1ce93
7 changed files with 61 additions and 57 deletions

View File

@@ -237,12 +237,18 @@ func (a *API) GetPrintStatusWithToken(machineCode, token string) (state int, err
return a.getPrintStatus(machineCode, token)
}
func (a *API) GetPrinterToken(machineCode, qrKey string) (tokenInfo *TokenInfo, err error) {
result, err := a.AccessAPI(scanCodemodelApiPath, map[string]interface{}{
func (a *API) GetPrinterToken(machineCode, qrKey, msign string) (tokenInfo *TokenInfo, err error) {
parameter := map[string]interface{}{
"machine_code": machineCode,
"qr_key": qrKey,
"scope": "all",
}, "")
}
if qrKey != "" {
parameter["qr_key"] = qrKey
} else if msign != "" {
parameter["msign"] = msign
}
result, err := a.AccessAPI(scanCodemodelApiPath, parameter, "")
if err == nil {
err = utils.Map2StructByJson(result, &tokenInfo, false)
}