package com.fdkankan.fyun.util;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.fdkankan.common.util.DateExtUtil;

import java.util.Date;
import java.util.UUID;

public class OssFileUtil {

    public static final String tempBasePath = "download/temp/";

    public static String getUploadTempFileKey(String prefix, String extName){
        String fileName = StrUtil.isNotEmpty(prefix) ? prefix : UUID.randomUUID().toString();
        if(StrUtil.isNotEmpty(extName)){
            fileName += "." + extName;
        }
        return tempBasePath + DateUtil.format(new Date(), DateExtUtil.dateStyle6) + "/" + fileName;
    }

}
