package com.miaxis.feign.service;


import com.miaxis.common.config.FeignConfig;
import com.miaxis.feign.dto.DyUserInfoDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 *
 * 抖音
 */
@FeignClient(name="dyService",
        url = "https://open.douyin.com",configuration = FeignConfig.class)
@Component
public interface DyService {
    /**
     *  获取openid
     * @return
     */
    @PostMapping(value = "/oauth/access_token/",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    String getDyToken(@RequestBody MultiValueMap dyTokenDTO);


    @PostMapping(value = "/oauth/access_token/",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    String getDyToken1(@RequestParam("client_secret") String  client_secret,@RequestParam("code") String  code
                       ,@RequestParam("grant_type") String  grant_type,@RequestParam("client_key") String  client_key);





    /**
     * 获取用户信息
     */
    @PostMapping(value = "/oauth/userinfo/",consumes = MediaType.APPLICATION_JSON_VALUE)
//    @PostMapping(value = "/oauth/userinfo/")
    String getUserInfo(
            @RequestBody DyUserInfoDTO dyUserInfoDTO
    );


}
