package com.qmth.themis.business.util;

import com.qmth.themis.business.config.SystemConfig;
import com.qmth.themis.business.constant.SystemConstant;
import com.tencentyun.TLSSigAPIv2;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @Description: 腾讯云util
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2020/8/21
 */
@Component
public class TencentYunUtil {

    @Resource
    SystemConfig systemConfig;

    /**
     * 获取签名
     *
     * @param sessionId
     * @param expireTime
     * @return
     */
    public String getSign(String sessionId, Long expireTime) {
        Map<String, Object> map = systemConfig.getTencentYunEnv();
        TLSSigAPIv2 api = new TLSSigAPIv2(Long.parseLong(String.valueOf(map.get(SystemConstant.TENCENT_APPID))), String.valueOf(map.get(SystemConstant.TENCENT_KEY)));
        return api.genSig(sessionId, expireTime);
    }
}
