package com.miaxis.wx.service;


import com.miaxis.common.config.FeignConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 *
 * 微信接口
 */
@FeignClient(name="wxService",
        url = "https://api.weixin.qq.com",configuration = FeignConfig.class)
@Component
public interface WxService {
    /**
     *  获取openid
     * @param appid
     * @param secret
     * @param code
     * @param grantType
     * @return
     */
    @GetMapping(value = "/sns/oauth2/access_token")
    String getWxToken(
            @RequestParam("appid") String appid,
            @RequestParam("secret") String secret,
            @RequestParam("code") String code,
            @RequestParam("grant_type") String grantType);


    /**
     * 获取用户信息
     */
    @GetMapping(value = "/sns/userinfo")
    String getUserInfo(
            @RequestParam("lang") String lang,
            @RequestParam("access_token") String accessToken,
            @RequestParam("openid") String openid
    );

}
