package com.tiesheng.ding.controller;

import com.tiesheng.annotation.token.TokenIgnore;
import com.tiesheng.ding.config.DingConfig;
import com.tiesheng.ding.pojos.DingJsapiSignature;
import com.tiesheng.util.pojos.ApiResp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hao
 */
@RestController
@RequestMapping("/platform/ding")
public class PlatformDingController {

    @Autowired
    DingConfig dingConfig;

    /**
     * 钉钉授权jssdk
     *
     * @param url
     * @return
     */
    @GetMapping("/jssdk/{service}")
    @TokenIgnore
    public ApiResp<DingJsapiSignature> dingJssdk(@PathVariable String service, String url) {
        DingJsapiSignature jsapiSignature = dingConfig.createJsapiSignature(service, url);
        return ApiResp.respOK(jsapiSignature);
    }

}
