package com.union.ai.api.util;

import org.springframework.util.DigestUtils;

/**
 * Created by IntelliJ IDEA.
 * Author: xingxin.jing
 * Date: 2019/3/24
 * Time: 下午7:22
 */
public class AuthUtil {

    /**
     * 根据规则生成token
     *
     * @param appId
     * @param apiKey
     * @param secretKey
     * @return
     */
    public static String getToken(Integer appId, String apiKey, String secretKey) {
        return DigestUtils.md5DigestAsHex((System.currentTimeMillis() + appId + apiKey + Config.getInstance().getTokenKey() + secretKey).getBytes());
    }
}
