- 将BindPrinterResult.ExpiresIn改为ExpiresAt
This commit is contained in:
@@ -139,7 +139,7 @@ func RebindAllPrinters(ctx *jxcontext.Context, isForce, isAsync bool) (hint stri
|
|||||||
for _, v := range storeList {
|
for _, v := range storeList {
|
||||||
var bindResult partner.BindPrinterResult
|
var bindResult partner.BindPrinterResult
|
||||||
if err = utils.UnmarshalUseNumber([]byte(v.PrinterBindInfo), &bindResult); err == nil {
|
if err = utils.UnmarshalUseNumber([]byte(v.PrinterBindInfo), &bindResult); err == nil {
|
||||||
if isForce || now.Sub(utils.Timestamp2Time(bindResult.ExpiresIn)) > -24*time.Hour {
|
if isForce || now.Sub(utils.Timestamp2Time(bindResult.ExpiresAt)) > -48*time.Hour {
|
||||||
needRebindList = append(needRebindList, v)
|
needRebindList = append(needRebindList, v)
|
||||||
bindResultMap[v.ID] = &bindResult
|
bindResultMap[v.ID] = &bindResult
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type BindPrinterResult struct {
|
type BindPrinterResult struct {
|
||||||
PrinterSN string
|
PrinterSN string `json:"printerSN"`
|
||||||
PrinterKey string
|
PrinterKey string `json:"printerKey"`
|
||||||
PrinterKey2 string
|
PrinterKey2 string `json:"printerKey2"`
|
||||||
ExpiresIn int64 `json:"expires_in"`
|
ExpiresAt int64 `json:"expiresAt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type IPrinterHandler interface {
|
type IPrinterHandler interface {
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ func yilianyunToken2BindResult(tokenInfo *yilianyunapi.TokenInfo) (bindResult *p
|
|||||||
PrinterSN: tokenInfo.MachineCode,
|
PrinterSN: tokenInfo.MachineCode,
|
||||||
PrinterKey: tokenInfo.AccessToken,
|
PrinterKey: tokenInfo.AccessToken,
|
||||||
PrinterKey2: tokenInfo.RefreshToken,
|
PrinterKey2: tokenInfo.RefreshToken,
|
||||||
ExpiresIn: tokenInfo.ExpiresIn,
|
ExpiresAt: time.Now().Add(time.Duration(tokenInfo.ExpiresIn)).Unix(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user