
package com.heyu.api.controller.vv;


import com.heyu.api.alibaba.request.vv.AppQrCodeRequest;
import com.heyu.api.common.annotation.AppRealyLogin;
import com.heyu.api.common.annotation.Describe;
import com.heyu.api.data.dto.AccessTokenDTO;
import com.heyu.api.data.utils.R;
import com.heyu.api.data.utils.WeChatUtils;
import com.heyu.api.oss.OssFileUploadService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/app/weixin")
public class AppWeiXinTokenController {


    // 自行配置：正式版为 "release"，体验版为 "trial"，开发版为 "develop"。默认是正式版。
    private String envVersion = "trial";


    @Autowired
    private OssFileUploadService ossFileUploadService;


    @Autowired
    private WeChatUtils weChatUtils;

    /***
     * 列表
     * http://localhost:8888/app/weixin/token
     *
     *
     */
    @Describe("获取token")
    @RequestMapping("/token")
    @AppRealyLogin
    public R create(@RequestBody AppQrCodeRequest request) {

        AccessTokenDTO accessTokenDTO = weChatUtils.getAccessTokenDTO(false);

        return R.ok().setData(accessTokenDTO);
    }

}
