package io.github.elkan1788.mpsdk4j.vo.api;

import org.nutz.json.JsonField;

/**
 * 网页授权结果
 *
 * @author 凡梦星尘(elkan1788@gmail.com)
 * @since 2.b.2
 */
public class WebOauth2Result {

    /**
     * 网页授权接口调用凭证
     */
    @JsonField(value = "access_token")
    private String accessToken;
    /**
     * 凭证超时时间
     */
    @JsonField(value = "expires_in")
    private long expiresIn;
    /**
     * 用户刷新access_token
     */
    @JsonField(value = "refresh_token")
    private String refreshToken;
    /**
     * 用户唯一标识,请注意,在未关注公众号时,
     * 用户访问公众号的网页,
     * 也会产生一个用户和公众号唯一的OpenID
     */
    @JsonField(value = "openid")
    private String openId;
    /**
     * 用户授权的作用域,使用逗号(,)分隔
     */
    private String scope;

    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public long getExpiresIn() {
        return expiresIn;
    }

    public void setExpiresIn(long expiresIn) {
        this.expiresIn = expiresIn;
    }

    public String getRefreshToken() {
        return refreshToken;
    }

    public void setRefreshToken(String refreshToken) {
        this.refreshToken = refreshToken;
    }

    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    public String getScope() {
        return scope;
    }

    public void setScope(String scope) {
        this.scope = scope;
    }
}

@@ -69,16 +69,43 @@
 onField;
+%0Aimport org.nutz.lang.Lang;
 %0A%0A/**%0A *
@@ -1035,34 +1035,112 @@
     
-this.expiresIn = expiresIn
+// %E8%80%83%E8%99%91%E5%88%B0%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%97%B6%E9%97%B4%E5%90%8C%E6%AD%A5,%E6%95%85%E5%B0%86%E5%88%B7%E6%96%B0%E6%97%B6%E9%97%B4%E6%8F%90%E5%89%8D60%E7%A7%92.%0A        this.expiresIn = System.currentTimeMillis() + (expiresIn - 60) * 1000
 ;%0A  
@@ -1561,24 +1561,24 @@
 ng scope) %7B%0A
-
         this
@@ -1598,11 +1598,578 @@
 e;%0A    %7D
+%0A%0A    public boolean isAvailable() %7B%0A        if (!Lang.isEmpty(accessToken) && this.expiresIn %3E= System.currentTimeMillis()) %7B%0A            return true;%0A        %7D%0A        return false;%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        return %22WebOauth2Result %5BaccessToken=%22%0A               + accessToken%0A               + %22, expiresIn=%22%0A               + expiresIn%0A               + %22, refreshToken=%22%0A               + refreshToken%0A               + %22, openId=%22%0A               + openId%0A               + %22, scope=%22%0A               + scope%0A               + %22%5D%22;%0A    %7D
 %0A%7D%0A

更新weoauth2result方法