package com.njzscloud.common.wechat.param;

import cn.hutool.extra.spring.SpringUtil;
import com.njzscloud.common.wechat.config.WechatProperties;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

@Getter
@Setter
@ToString
@Accessors(chain = true)
public class Code2SessionParam {
    /**
     * 小程序 Id
     */
    private String appid;
    /**
     * 小程序秘钥
     */
    private String secret;
    /**
     * 授权码
     */
    private String js_code;
    /**
     * 访问令牌
     */
    private String access_token;
    /**
     * 授权方式
     */
    private String grant_type = "authorization_code";

    public Code2SessionParam() {
        WechatProperties wechatProperties = SpringUtil.getBean(WechatProperties.class);
        this.appid = wechatProperties.getAppId();
        this.secret = wechatProperties.getAppSecret();
    }
}
