- 将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 {
|
||||
var bindResult partner.BindPrinterResult
|
||||
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)
|
||||
bindResultMap[v.ID] = &bindResult
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
)
|
||||
|
||||
type BindPrinterResult struct {
|
||||
PrinterSN string
|
||||
PrinterKey string
|
||||
PrinterKey2 string
|
||||
ExpiresIn int64 `json:"expires_in"`
|
||||
PrinterSN string `json:"printerSN"`
|
||||
PrinterKey string `json:"printerKey"`
|
||||
PrinterKey2 string `json:"printerKey2"`
|
||||
ExpiresAt int64 `json:"expiresAt"`
|
||||
}
|
||||
|
||||
type IPrinterHandler interface {
|
||||
|
||||
@@ -172,7 +172,7 @@ func yilianyunToken2BindResult(tokenInfo *yilianyunapi.TokenInfo) (bindResult *p
|
||||
PrinterSN: tokenInfo.MachineCode,
|
||||
PrinterKey: tokenInfo.AccessToken,
|
||||
PrinterKey2: tokenInfo.RefreshToken,
|
||||
ExpiresIn: tokenInfo.ExpiresIn,
|
||||
ExpiresAt: time.Now().Add(time.Duration(tokenInfo.ExpiresIn)).Unix(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user