作用:存放一些錯誤、提示信息。
package com.zlinepay.api.test;
import com.zlinepay.core.exception.BaseConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import java.io.IOException;
import java.util.Properties;
public class T{
private static final Logger log= LoggerFactory.getLogger(T.class);
public static String getErrorMessage(String propKey) {
try {
Properties properties = PropertiesLoaderUtils.loadAllProperties("properties/errorMessages.properties");
return properties.getProperty(propKey);
} catch (IOException e) {
log.error("[ZLXT] error occurred: get " + BaseConstant.ERROR_MESSAGE + " " + propKey + " failure!", e);
}
return null;
}
public static void main(String[] args) {
System.out.println(T.getErrorMessage("51545"));
}
}
public interface BaseConstant {
String APP_DEFAULT_CONFIG = "config";
String APP_CONFIG_LOCATION = ".location";
// String ERROR_CODE = "properties/ErrorCodes.properties";
String ERROR_MESSAGE = "properties/errorMessages.properties";
}
92042036 = 當前虛擬商品不存在,請確認優惠券面配置
92042037 = 可領取物品不足,領取失敗
92042038 = 當前系統繁忙,稍後重試
92042039 = 參數【{}】必傳
92042040 =兌換記錄不存在,請確認優惠券編號
92042041 =當前兌換物品已禁止兌換