fixed indexing API issues
This commit is contained in:
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
|
distributionUrl=http://services.gradle.org/distributions/gradle-4.4-all.zip
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import java.util.List;
|
|||||||
public class WebAPICallbacks {
|
public class WebAPICallbacks {
|
||||||
|
|
||||||
public interface SignInCallback {
|
public interface SignInCallback {
|
||||||
void onSignInSuccess(UserApp admin);
|
void onSignInSuccess(UserApp userApp);
|
||||||
void onSignInFailed();
|
void onSignInFailed();
|
||||||
void onSignInError();
|
void onSignInError();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package net.irext.webapi;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import net.irext.webapi.model.*;
|
import net.irext.webapi.model.*;
|
||||||
@@ -38,6 +39,11 @@ public class WebAPIs {
|
|||||||
private static final String DEFAULT_APP = "/irext-server";
|
private static final String DEFAULT_APP = "/irext-server";
|
||||||
private static String URL_PREFIX = DEFAULT_ADDRESS + DEFAULT_APP;
|
private static String URL_PREFIX = DEFAULT_ADDRESS + DEFAULT_APP;
|
||||||
|
|
||||||
|
// download bin from OSS
|
||||||
|
private static final String IR_BIN_FILE_PREFIX = "irda_";
|
||||||
|
private static final String IR_BIN_FILE_SUFFIX = ".bin";
|
||||||
|
private static final String IR_BIN_DOWNLOAD_PREFIX = "http://irext-debug.oss-cn-hangzhou.aliyuncs.com/";
|
||||||
|
|
||||||
private static final String SERVICE_SIGN_IN = "/app/app_login";
|
private static final String SERVICE_SIGN_IN = "/app/app_login";
|
||||||
private static final String SERVICE_LIST_CATEGORIES = "/indexing/list_categories";
|
private static final String SERVICE_LIST_CATEGORIES = "/indexing/list_categories";
|
||||||
private static final String SERVICE_LIST_BRANDS = "/indexing/list_brands";
|
private static final String SERVICE_LIST_BRANDS = "/indexing/list_brands";
|
||||||
@@ -48,7 +54,7 @@ public class WebAPIs {
|
|||||||
private static final String SERVICE_DOWNLOAD_BIN = "/operation/download_bin";
|
private static final String SERVICE_DOWNLOAD_BIN = "/operation/download_bin";
|
||||||
private static final String SERVICE_ONLINE_DECODE = "/operation/decode";
|
private static final String SERVICE_ONLINE_DECODE = "/operation/decode";
|
||||||
|
|
||||||
private int adminId;
|
private int id;
|
||||||
private String token;
|
private String token;
|
||||||
|
|
||||||
private OkHttpClient mHttpClient;
|
private OkHttpClient mHttpClient;
|
||||||
@@ -72,6 +78,16 @@ public class WebAPIs {
|
|||||||
return mInstance;
|
return mInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private InputStream getFileByteStreamByURL(String url) throws IOException {
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url(url)
|
||||||
|
.get()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Response response = new OkHttpClient().newCall(request).execute();
|
||||||
|
return response.body().byteStream();
|
||||||
|
}
|
||||||
|
|
||||||
private String postToServer(String url, String json) throws IOException {
|
private String postToServer(String url, String json) throws IOException {
|
||||||
MediaType JSON
|
MediaType JSON
|
||||||
= MediaType.parse("application/json; charset=utf-8");
|
= MediaType.parse("application/json; charset=utf-8");
|
||||||
@@ -123,14 +139,17 @@ public class WebAPIs {
|
|||||||
appSignInRequest.setAndroidSignature(signature);
|
appSignInRequest.setAndroidSignature(signature);
|
||||||
String bodyJson = appSignInRequest.toJson();
|
String bodyJson = appSignInRequest.toJson();
|
||||||
|
|
||||||
|
Log.d(TAG, "Android APP example sign-in request data : " + bodyJson);
|
||||||
String response = postToServer(signInURL, bodyJson);
|
String response = postToServer(signInURL, bodyJson);
|
||||||
|
|
||||||
|
Log.d(TAG, "Android APP example sign-in response data : " + response);
|
||||||
LoginResponse loginResponse = new Gson().fromJson(response, LoginResponse.class);
|
LoginResponse loginResponse = new Gson().fromJson(response, LoginResponse.class);
|
||||||
if (loginResponse.getStatus().getCode() == Constants.ERROR_CODE_SUCCESS) {
|
if (loginResponse.getStatus().getCode() == Constants.ERROR_CODE_SUCCESS) {
|
||||||
UserApp admin = loginResponse.getEntity();
|
UserApp userApp = loginResponse.getEntity();
|
||||||
if (0 != admin.getId() && null != admin.getToken()) {
|
if (0 != userApp.getId() && null != userApp.getToken()) {
|
||||||
adminId = admin.getId();
|
id = userApp.getId();
|
||||||
token = admin.getToken();
|
token = userApp.getToken();
|
||||||
signInCallback.onSignInSuccess(admin);
|
signInCallback.onSignInSuccess(userApp);
|
||||||
} else {
|
} else {
|
||||||
signInCallback.onSignInFailed();
|
signInCallback.onSignInFailed();
|
||||||
}
|
}
|
||||||
@@ -145,7 +164,7 @@ public class WebAPIs {
|
|||||||
public void listCategories(int from, int count, ListCategoriesCallback listCategoriesCallback) {
|
public void listCategories(int from, int count, ListCategoriesCallback listCategoriesCallback) {
|
||||||
String listCategoriesURL = URL_PREFIX + SERVICE_LIST_CATEGORIES;
|
String listCategoriesURL = URL_PREFIX + SERVICE_LIST_CATEGORIES;
|
||||||
ListCategoriesRequest listCategoriesRequest = new ListCategoriesRequest();
|
ListCategoriesRequest listCategoriesRequest = new ListCategoriesRequest();
|
||||||
listCategoriesRequest.setAdminId(adminId);
|
listCategoriesRequest.setId(id);
|
||||||
listCategoriesRequest.setToken(token);
|
listCategoriesRequest.setToken(token);
|
||||||
listCategoriesRequest.setFrom(from);
|
listCategoriesRequest.setFrom(from);
|
||||||
listCategoriesRequest.setCount(count);
|
listCategoriesRequest.setCount(count);
|
||||||
@@ -171,7 +190,7 @@ public class WebAPIs {
|
|||||||
ListBrandsCallback listBrandsCallback) {
|
ListBrandsCallback listBrandsCallback) {
|
||||||
String listBrandsURL = URL_PREFIX + SERVICE_LIST_BRANDS;
|
String listBrandsURL = URL_PREFIX + SERVICE_LIST_BRANDS;
|
||||||
ListBrandsRequest listBrandsRequest = new ListBrandsRequest();
|
ListBrandsRequest listBrandsRequest = new ListBrandsRequest();
|
||||||
listBrandsRequest.setAdminId(adminId);
|
listBrandsRequest.setId(id);
|
||||||
listBrandsRequest.setToken(token);
|
listBrandsRequest.setToken(token);
|
||||||
listBrandsRequest.setCategoryId(categoryId);
|
listBrandsRequest.setCategoryId(categoryId);
|
||||||
listBrandsRequest.setFrom(from);
|
listBrandsRequest.setFrom(from);
|
||||||
@@ -197,7 +216,7 @@ public class WebAPIs {
|
|||||||
public void listProvinces(ListProvincesCallback listProvincesCallback) {
|
public void listProvinces(ListProvincesCallback listProvincesCallback) {
|
||||||
String listProvincesURL = URL_PREFIX + SERVICE_LIST_PROVINCES;
|
String listProvincesURL = URL_PREFIX + SERVICE_LIST_PROVINCES;
|
||||||
ListCitiesRequest listCitiesRequest = new ListCitiesRequest();
|
ListCitiesRequest listCitiesRequest = new ListCitiesRequest();
|
||||||
listCitiesRequest.setAdminId(adminId);
|
listCitiesRequest.setId(id);
|
||||||
listCitiesRequest.setToken(token);
|
listCitiesRequest.setToken(token);
|
||||||
String bodyJson = listCitiesRequest.toJson();
|
String bodyJson = listCitiesRequest.toJson();
|
||||||
|
|
||||||
@@ -220,7 +239,7 @@ public class WebAPIs {
|
|||||||
public void listCities(String prefix, ListCitiesCallback listCitiesCallback) {
|
public void listCities(String prefix, ListCitiesCallback listCitiesCallback) {
|
||||||
String listCitiesURL = URL_PREFIX + SERVICE_LIST_CITIES;
|
String listCitiesURL = URL_PREFIX + SERVICE_LIST_CITIES;
|
||||||
ListCitiesRequest listCitiesRequest = new ListCitiesRequest();
|
ListCitiesRequest listCitiesRequest = new ListCitiesRequest();
|
||||||
listCitiesRequest.setAdminId(adminId);
|
listCitiesRequest.setId(id);
|
||||||
listCitiesRequest.setToken(token);
|
listCitiesRequest.setToken(token);
|
||||||
listCitiesRequest.setProvincePrefix(prefix);
|
listCitiesRequest.setProvincePrefix(prefix);
|
||||||
String bodyJson = listCitiesRequest.toJson();
|
String bodyJson = listCitiesRequest.toJson();
|
||||||
@@ -245,7 +264,7 @@ public class WebAPIs {
|
|||||||
ListOperatersCallback listOperatersCallback) {
|
ListOperatersCallback listOperatersCallback) {
|
||||||
String listOperatorsURL = URL_PREFIX + SERVICE_LIST_OPERATORS;
|
String listOperatorsURL = URL_PREFIX + SERVICE_LIST_OPERATORS;
|
||||||
ListOperatorsRequest listOperatorsRequest = new ListOperatorsRequest();
|
ListOperatorsRequest listOperatorsRequest = new ListOperatorsRequest();
|
||||||
listOperatorsRequest.setAdminId(adminId);
|
listOperatorsRequest.setId(id);
|
||||||
listOperatorsRequest.setToken(token);
|
listOperatorsRequest.setToken(token);
|
||||||
listOperatorsRequest.setCityCode(cityCode);
|
listOperatorsRequest.setCityCode(cityCode);
|
||||||
listOperatorsRequest.setFrom(0);
|
listOperatorsRequest.setFrom(0);
|
||||||
@@ -275,7 +294,7 @@ public class WebAPIs {
|
|||||||
ListIndexesCallback onListIndexCallback) {
|
ListIndexesCallback onListIndexCallback) {
|
||||||
String listIndexesURL = URL_PREFIX + SERVICE_LIST_INDEXES;
|
String listIndexesURL = URL_PREFIX + SERVICE_LIST_INDEXES;
|
||||||
ListIndexesRequest listIndexesRequest = new ListIndexesRequest();
|
ListIndexesRequest listIndexesRequest = new ListIndexesRequest();
|
||||||
listIndexesRequest.setAdminId(adminId);
|
listIndexesRequest.setId(id);
|
||||||
listIndexesRequest.setToken(token);
|
listIndexesRequest.setToken(token);
|
||||||
listIndexesRequest.setCategoryId(categoryId);
|
listIndexesRequest.setCategoryId(categoryId);
|
||||||
listIndexesRequest.setBrandId(brandId);
|
listIndexesRequest.setBrandId(brandId);
|
||||||
@@ -304,9 +323,10 @@ public class WebAPIs {
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public void downloadBin(String remoteMap, int indexId,
|
public void downloadBin(String remoteMap, int indexId,
|
||||||
DownloadBinCallback downloadBinCallback) {
|
DownloadBinCallback downloadBinCallback) {
|
||||||
String downloadURL = URL_PREFIX + SERVICE_DOWNLOAD_BIN;
|
String fileName = IR_BIN_FILE_PREFIX + remoteMap + IR_BIN_FILE_SUFFIX;
|
||||||
|
String downloadURL = IR_BIN_DOWNLOAD_PREFIX + fileName;
|
||||||
DownloadBinaryRequest downloadBinaryRequest = new DownloadBinaryRequest();
|
DownloadBinaryRequest downloadBinaryRequest = new DownloadBinaryRequest();
|
||||||
downloadBinaryRequest.setAdminId(adminId);
|
downloadBinaryRequest.setId(id);
|
||||||
downloadBinaryRequest.setToken(token);
|
downloadBinaryRequest.setToken(token);
|
||||||
downloadBinaryRequest.setIndexId(indexId);
|
downloadBinaryRequest.setIndexId(indexId);
|
||||||
|
|
||||||
@@ -314,7 +334,7 @@ public class WebAPIs {
|
|||||||
|
|
||||||
if (null != bodyJson) {
|
if (null != bodyJson) {
|
||||||
try {
|
try {
|
||||||
InputStream binStream = postToServerForOctets(downloadURL, bodyJson);
|
InputStream binStream = getFileByteStreamByURL(downloadURL);
|
||||||
|
|
||||||
if (null != binStream) {
|
if (null != binStream) {
|
||||||
downloadBinCallback.onDownloadBinSuccess(binStream);
|
downloadBinCallback.onDownloadBinSuccess(binStream);
|
||||||
@@ -333,7 +353,7 @@ public class WebAPIs {
|
|||||||
public int[] decodeIR(int indexId) {
|
public int[] decodeIR(int indexId) {
|
||||||
String decodeURL = URL_PREFIX + SERVICE_ONLINE_DECODE;
|
String decodeURL = URL_PREFIX + SERVICE_ONLINE_DECODE;
|
||||||
DecodeRequest decodeRequest = new DecodeRequest();
|
DecodeRequest decodeRequest = new DecodeRequest();
|
||||||
decodeRequest.setAdminId(adminId);
|
decodeRequest.setId(id);
|
||||||
decodeRequest.setToken(token);
|
decodeRequest.setToken(token);
|
||||||
decodeRequest.setIndexId(indexId);
|
decodeRequest.setIndexId(indexId);
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ import com.google.gson.Gson;
|
|||||||
*/
|
*/
|
||||||
public class BaseRequest {
|
public class BaseRequest {
|
||||||
|
|
||||||
private int adminId;
|
private int id;
|
||||||
private String token;
|
private String token;
|
||||||
|
|
||||||
public BaseRequest(int adminId, String token) {
|
public BaseRequest(int id, String token) {
|
||||||
this.adminId = adminId;
|
this.id = id;
|
||||||
this.token = token;
|
this.token = token;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,12 +26,12 @@ public class BaseRequest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAdminId() {
|
public int getId() {
|
||||||
return adminId;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAdminId(int adminId) {
|
public void setId(int id) {
|
||||||
this.adminId = adminId;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getToken() {
|
public String getToken() {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package net.irext.webapi.response;
|
package net.irext.webapi.response;
|
||||||
|
|
||||||
import net.irext.webapi.model.UserApp;
|
import net.irext.webapi.model.UserApp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filename: LoginResponse.java
|
* Filename: LoginResponse.java
|
||||||
* Revised: Date: 2017-03-31
|
* Revised: Date: 2017-03-31
|
||||||
|
|||||||
1
web-sdk/.gitignore
vendored
1
web-sdk/.gitignore
vendored
@@ -1,5 +1,6 @@
|
|||||||
.idea/
|
.idea/
|
||||||
out/
|
out/
|
||||||
|
output/
|
||||||
|
|
||||||
*.class
|
*.class
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import java.util.List;
|
|||||||
public class WebAPICallbacks {
|
public class WebAPICallbacks {
|
||||||
|
|
||||||
public interface SignInCallback {
|
public interface SignInCallback {
|
||||||
void onSignInSuccess(UserApp admin);
|
void onSignInSuccess(UserApp userApp);
|
||||||
void onSignInFailed();
|
void onSignInFailed();
|
||||||
void onSignInError();
|
void onSignInError();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,11 @@ public class WebAPIs {
|
|||||||
private static final String DEFAULT_APP = "/irext-server";
|
private static final String DEFAULT_APP = "/irext-server";
|
||||||
private static String URL_PREFIX = DEFAULT_ADDRESS + DEFAULT_APP;
|
private static String URL_PREFIX = DEFAULT_ADDRESS + DEFAULT_APP;
|
||||||
|
|
||||||
|
// download bin from OSS
|
||||||
|
private static final String IR_BIN_FILE_PREFIX = "irda_";
|
||||||
|
private static final String IR_BIN_FILE_SUFFIX = ".bin";
|
||||||
|
private static final String IR_BIN_DOWNLOAD_PREFIX = "http://irext-debug.oss-cn-hangzhou.aliyuncs.com/";
|
||||||
|
|
||||||
private static final String SERVICE_SIGN_IN = "/app/app_login";
|
private static final String SERVICE_SIGN_IN = "/app/app_login";
|
||||||
private static final String SERVICE_LIST_CATEGORIES = "/indexing/list_categories";
|
private static final String SERVICE_LIST_CATEGORIES = "/indexing/list_categories";
|
||||||
private static final String SERVICE_LIST_BRANDS = "/indexing/list_brands";
|
private static final String SERVICE_LIST_BRANDS = "/indexing/list_brands";
|
||||||
@@ -42,7 +47,7 @@ public class WebAPIs {
|
|||||||
private static final String SERVICE_DOWNLOAD_BIN = "/operation/download_bin";
|
private static final String SERVICE_DOWNLOAD_BIN = "/operation/download_bin";
|
||||||
private static final String SERVICE_ONLINE_DECODE = "/operation/decode";
|
private static final String SERVICE_ONLINE_DECODE = "/operation/decode";
|
||||||
|
|
||||||
private int adminId;
|
private int id;
|
||||||
private String token;
|
private String token;
|
||||||
|
|
||||||
private OkHttpClient mHttpClient;
|
private OkHttpClient mHttpClient;
|
||||||
@@ -66,6 +71,16 @@ public class WebAPIs {
|
|||||||
return mInstance;
|
return mInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private InputStream getFileByteStreamByURL(String url) throws IOException {
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url(url)
|
||||||
|
.get()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Response response = new OkHttpClient().newCall(request).execute();
|
||||||
|
return response.body().byteStream();
|
||||||
|
}
|
||||||
|
|
||||||
private String postToServer(String url, String json) throws IOException {
|
private String postToServer(String url, String json) throws IOException {
|
||||||
MediaType JSON
|
MediaType JSON
|
||||||
= MediaType.parse("application/json; charset=utf-8");
|
= MediaType.parse("application/json; charset=utf-8");
|
||||||
@@ -105,12 +120,12 @@ public class WebAPIs {
|
|||||||
try {
|
try {
|
||||||
String response = postToServer(signInURL, bodyJson);
|
String response = postToServer(signInURL, bodyJson);
|
||||||
LoginResponse loginResponse = new Gson().fromJson(response, LoginResponse.class);
|
LoginResponse loginResponse = new Gson().fromJson(response, LoginResponse.class);
|
||||||
if(loginResponse.getStatus().getCode() == Constants.ERROR_CODE_SUCCESS) {
|
if (loginResponse.getStatus().getCode() == Constants.ERROR_CODE_SUCCESS) {
|
||||||
UserApp admin = loginResponse.getEntity();
|
UserApp userApp = loginResponse.getEntity();
|
||||||
if (0 != admin.getId() && null != admin.getToken()) {
|
if (0 != userApp.getId() && null != userApp.getToken()) {
|
||||||
adminId = admin.getId();
|
id = userApp.getId();
|
||||||
token = admin.getToken();
|
token = userApp.getToken();
|
||||||
signInCallback.onSignInSuccess(admin);
|
signInCallback.onSignInSuccess(userApp);
|
||||||
} else {
|
} else {
|
||||||
signInCallback.onSignInFailed();
|
signInCallback.onSignInFailed();
|
||||||
}
|
}
|
||||||
@@ -125,7 +140,7 @@ public class WebAPIs {
|
|||||||
public void listCategories(int from, int count, ListCategoriesCallback listCategoriesCallback) {
|
public void listCategories(int from, int count, ListCategoriesCallback listCategoriesCallback) {
|
||||||
String listCategoriesURL = URL_PREFIX + SERVICE_LIST_CATEGORIES;
|
String listCategoriesURL = URL_PREFIX + SERVICE_LIST_CATEGORIES;
|
||||||
ListCategoriesRequest listCategoriesRequest = new ListCategoriesRequest();
|
ListCategoriesRequest listCategoriesRequest = new ListCategoriesRequest();
|
||||||
listCategoriesRequest.setAdminId(adminId);
|
listCategoriesRequest.setId(id);
|
||||||
listCategoriesRequest.setToken(token);
|
listCategoriesRequest.setToken(token);
|
||||||
listCategoriesRequest.setFrom(from);
|
listCategoriesRequest.setFrom(from);
|
||||||
listCategoriesRequest.setCount(count);
|
listCategoriesRequest.setCount(count);
|
||||||
@@ -151,7 +166,7 @@ public class WebAPIs {
|
|||||||
ListBrandsCallback listBrandsCallback) {
|
ListBrandsCallback listBrandsCallback) {
|
||||||
String listBrandsURL = URL_PREFIX + SERVICE_LIST_BRANDS;
|
String listBrandsURL = URL_PREFIX + SERVICE_LIST_BRANDS;
|
||||||
ListBrandsRequest listBrandsRequest = new ListBrandsRequest();
|
ListBrandsRequest listBrandsRequest = new ListBrandsRequest();
|
||||||
listBrandsRequest.setAdminId(adminId);
|
listBrandsRequest.setId(id);
|
||||||
listBrandsRequest.setToken(token);
|
listBrandsRequest.setToken(token);
|
||||||
listBrandsRequest.setCategoryId(categoryId);
|
listBrandsRequest.setCategoryId(categoryId);
|
||||||
listBrandsRequest.setFrom(from);
|
listBrandsRequest.setFrom(from);
|
||||||
@@ -177,7 +192,7 @@ public class WebAPIs {
|
|||||||
public void listProvinces(ListProvincesCallback listProvincesCallback) {
|
public void listProvinces(ListProvincesCallback listProvincesCallback) {
|
||||||
String listProvincesURL = URL_PREFIX + SERVICE_LIST_PROVINCES;
|
String listProvincesURL = URL_PREFIX + SERVICE_LIST_PROVINCES;
|
||||||
ListCitiesRequest listCitiesRequest = new ListCitiesRequest();
|
ListCitiesRequest listCitiesRequest = new ListCitiesRequest();
|
||||||
listCitiesRequest.setAdminId(adminId);
|
listCitiesRequest.setId(id);
|
||||||
listCitiesRequest.setToken(token);
|
listCitiesRequest.setToken(token);
|
||||||
String bodyJson = listCitiesRequest.toJson();
|
String bodyJson = listCitiesRequest.toJson();
|
||||||
|
|
||||||
@@ -200,7 +215,7 @@ public class WebAPIs {
|
|||||||
public void listCities(String prefix, ListCitiesCallback listCitiesCallback) {
|
public void listCities(String prefix, ListCitiesCallback listCitiesCallback) {
|
||||||
String listCitiesURL = URL_PREFIX + SERVICE_LIST_CITIES;
|
String listCitiesURL = URL_PREFIX + SERVICE_LIST_CITIES;
|
||||||
ListCitiesRequest listCitiesRequest = new ListCitiesRequest();
|
ListCitiesRequest listCitiesRequest = new ListCitiesRequest();
|
||||||
listCitiesRequest.setAdminId(adminId);
|
listCitiesRequest.setId(id);
|
||||||
listCitiesRequest.setToken(token);
|
listCitiesRequest.setToken(token);
|
||||||
listCitiesRequest.setProvincePrefix(prefix);
|
listCitiesRequest.setProvincePrefix(prefix);
|
||||||
String bodyJson = listCitiesRequest.toJson();
|
String bodyJson = listCitiesRequest.toJson();
|
||||||
@@ -225,7 +240,7 @@ public class WebAPIs {
|
|||||||
ListOperatersCallback listOperatersCallback) {
|
ListOperatersCallback listOperatersCallback) {
|
||||||
String listOperatorsURL = URL_PREFIX + SERVICE_LIST_OPERATORS;
|
String listOperatorsURL = URL_PREFIX + SERVICE_LIST_OPERATORS;
|
||||||
ListOperatorsRequest listOperatorsRequest = new ListOperatorsRequest();
|
ListOperatorsRequest listOperatorsRequest = new ListOperatorsRequest();
|
||||||
listOperatorsRequest.setAdminId(adminId);
|
listOperatorsRequest.setId(id);
|
||||||
listOperatorsRequest.setToken(token);
|
listOperatorsRequest.setToken(token);
|
||||||
listOperatorsRequest.setCityCode(cityCode);
|
listOperatorsRequest.setCityCode(cityCode);
|
||||||
listOperatorsRequest.setFrom(0);
|
listOperatorsRequest.setFrom(0);
|
||||||
@@ -255,7 +270,7 @@ public class WebAPIs {
|
|||||||
ListIndexesCallback onListIndexCallback) {
|
ListIndexesCallback onListIndexCallback) {
|
||||||
String listIndexesURL = URL_PREFIX + SERVICE_LIST_INDEXES;
|
String listIndexesURL = URL_PREFIX + SERVICE_LIST_INDEXES;
|
||||||
ListIndexesRequest listIndexesRequest = new ListIndexesRequest();
|
ListIndexesRequest listIndexesRequest = new ListIndexesRequest();
|
||||||
listIndexesRequest.setAdminId(adminId);
|
listIndexesRequest.setId(id);
|
||||||
listIndexesRequest.setToken(token);
|
listIndexesRequest.setToken(token);
|
||||||
listIndexesRequest.setCategoryId(categoryId);
|
listIndexesRequest.setCategoryId(categoryId);
|
||||||
listIndexesRequest.setBrandId(brandId);
|
listIndexesRequest.setBrandId(brandId);
|
||||||
@@ -284,9 +299,10 @@ public class WebAPIs {
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public void downloadBin(String remoteMap, int indexId,
|
public void downloadBin(String remoteMap, int indexId,
|
||||||
DownloadBinCallback downloadBinCallback) {
|
DownloadBinCallback downloadBinCallback) {
|
||||||
String downloadURL = URL_PREFIX + SERVICE_DOWNLOAD_BIN;
|
String fileName = IR_BIN_FILE_PREFIX + remoteMap + IR_BIN_FILE_SUFFIX;
|
||||||
|
String downloadURL = IR_BIN_DOWNLOAD_PREFIX + fileName;
|
||||||
DownloadBinaryRequest downloadBinaryRequest = new DownloadBinaryRequest();
|
DownloadBinaryRequest downloadBinaryRequest = new DownloadBinaryRequest();
|
||||||
downloadBinaryRequest.setAdminId(adminId);
|
downloadBinaryRequest.setId(id);
|
||||||
downloadBinaryRequest.setToken(token);
|
downloadBinaryRequest.setToken(token);
|
||||||
downloadBinaryRequest.setIndexId(indexId);
|
downloadBinaryRequest.setIndexId(indexId);
|
||||||
|
|
||||||
@@ -294,7 +310,7 @@ public class WebAPIs {
|
|||||||
|
|
||||||
if (null != bodyJson) {
|
if (null != bodyJson) {
|
||||||
try {
|
try {
|
||||||
InputStream binStream = postToServerForOctets(downloadURL, bodyJson);
|
InputStream binStream = getFileByteStreamByURL(downloadURL);
|
||||||
|
|
||||||
if (null != binStream) {
|
if (null != binStream) {
|
||||||
downloadBinCallback.onDownloadBinSuccess(binStream);
|
downloadBinCallback.onDownloadBinSuccess(binStream);
|
||||||
@@ -313,7 +329,7 @@ public class WebAPIs {
|
|||||||
public int[] decodeIR(int indexId) {
|
public int[] decodeIR(int indexId) {
|
||||||
String decodeURL = URL_PREFIX + SERVICE_ONLINE_DECODE;
|
String decodeURL = URL_PREFIX + SERVICE_ONLINE_DECODE;
|
||||||
DecodeRequest decodeRequest = new DecodeRequest();
|
DecodeRequest decodeRequest = new DecodeRequest();
|
||||||
decodeRequest.setAdminId(adminId);
|
decodeRequest.setId(id);
|
||||||
decodeRequest.setToken(token);
|
decodeRequest.setToken(token);
|
||||||
decodeRequest.setIndexId(indexId);
|
decodeRequest.setIndexId(indexId);
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ import com.google.gson.Gson;
|
|||||||
*/
|
*/
|
||||||
public class BaseRequest {
|
public class BaseRequest {
|
||||||
|
|
||||||
private int adminId;
|
private int id;
|
||||||
private String token;
|
private String token;
|
||||||
|
|
||||||
public BaseRequest(int adminId, String token) {
|
public BaseRequest(int id, String token) {
|
||||||
this.adminId = adminId;
|
this.id = id;
|
||||||
this.token = token;
|
this.token = token;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,12 +26,12 @@ public class BaseRequest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAdminId() {
|
public int getId() {
|
||||||
return adminId;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAdminId(int adminId) {
|
public void setId(int id) {
|
||||||
this.adminId = adminId;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getToken() {
|
public String getToken() {
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ public class LoginResponse extends ServiceResponse {
|
|||||||
|
|
||||||
private UserApp entity;
|
private UserApp entity;
|
||||||
|
|
||||||
public LoginResponse(Status status, UserApp admin) {
|
public LoginResponse(Status status, UserApp userApp) {
|
||||||
super(status);
|
super(status);
|
||||||
this.entity = admin;
|
this.entity = userApp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoginResponse() {
|
public LoginResponse() {
|
||||||
|
|||||||
Reference in New Issue
Block a user