yshop1.9,新增城市接口,修复小程序登陆与支付问题,发布mpvue1.0小程序

This commit is contained in:
hupeng
2020-01-19 09:59:40 +08:00
parent 1d0fef87b2
commit 90b29e6b86
18 changed files with 113 additions and 31 deletions

View File

@ -114,7 +114,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
/**
* inputStream 转 File
*/
static File inputStreamToFile(InputStream ins, String name) throws Exception{
public static File inputStreamToFile(InputStream ins, String name) throws Exception{
File file = new File(System.getProperty("java.io.tmpdir") + File.separator + name);
if (file.exists()) {
return file;
@ -310,4 +310,31 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
return getMd5(getByte(file));
}
/**
* 读取json文件返回json串
* @param fileName
* @return
*/
public static String readJsonFile(String fileName) {
String jsonStr = "";
try {
File jsonFile = new File(fileName);
FileReader fileReader = new FileReader(jsonFile);
Reader reader = new InputStreamReader(new FileInputStream(jsonFile),"utf-8");
int ch = 0;
StringBuffer sb = new StringBuffer();
while ((ch = reader.read()) != -1) {
sb.append((char) ch);
}
fileReader.close();
reader.close();
jsonStr = sb.toString();
return jsonStr;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
}