|
|
@ -410,6 +410,7 @@ public class AppMaster {
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_UPLOAD_LOGS)) {
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_UPLOAD_LOGS)) {
|
|
|
|
String url = jsonObject.optString("url", null);
|
|
|
|
String url = jsonObject.optString("url", null);
|
|
|
|
uploadLogs(url);
|
|
|
|
uploadLogs(url);
|
|
|
|
|
|
|
|
uploadMasterLogs(url);
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_SET_CMA)) {
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_SET_CMA)) {
|
|
|
|
String ip = jsonObject.optString("value_str", null);
|
|
|
|
String ip = jsonObject.optString("value_str", null);
|
|
|
|
int port = jsonObject.optInt("value_int", 0);
|
|
|
|
int port = jsonObject.optInt("value_int", 0);
|
|
|
@ -717,6 +718,77 @@ public class AppMaster {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void uploadMasterLogs(String url) {
|
|
|
|
|
|
|
|
String appDir = mService.buildAppDir();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long ts = System.currentTimeMillis();//long now = android.os.SystemClock.uptimeMillis();
|
|
|
|
|
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
|
|
|
|
|
Date dt = new Date(ts);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final String fileName = mCmdid + "_mst_" + format.format(dt) + ".zip";
|
|
|
|
|
|
|
|
final File file = File.createTempFile(fileName, null, new File(appDir));
|
|
|
|
|
|
|
|
if (file == null) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final String mpAppDir = MicroPhotoContext.buildMasterAppDir(mService.getApplicationContext());
|
|
|
|
|
|
|
|
final File logDir = new File(mpAppDir + "logs" + File.separator);
|
|
|
|
|
|
|
|
if (!logDir.exists()) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ZipUtils.ZipFolder(logDir, file);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!file.exists()) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FileUploader fileUploader = new FileUploader(url);
|
|
|
|
|
|
|
|
fileUploader.addFilePart("file", file, fileName, "application/x-zip-compressed");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String response = fileUploader.finish();
|
|
|
|
|
|
|
|
if (response != null) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void uploadLogs(String url, String tempPath, String path, String ext, String uploadFileName) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final File pathFile = new File(path);
|
|
|
|
|
|
|
|
if (!pathFile.exists()) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final File file = File.createTempFile(uploadFileName, null, new File(tempPath));
|
|
|
|
|
|
|
|
if (file == null) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ZipUtils.ZipFolder(pathFile, file);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!file.exists()) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FileUploader fileUploader = new FileUploader(url);
|
|
|
|
|
|
|
|
fileUploader.addFilePart("file", file, uploadFileName, "application/x-zip-compressed");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String response = fileUploader.finish();
|
|
|
|
|
|
|
|
if (response != null) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void uploadFiles(String url, List<String> paths) {
|
|
|
|
private void uploadFiles(String url, List<String> paths) {
|
|
|
|
String appDir = mService.buildAppDir();
|
|
|
|
String appDir = mService.buildAppDir();
|
|
|
|
|
|
|
|
|
|
|
|