Commit b943125c by zhengnw@sobot.com

common 1.7.6 不管accesstoken 和appLogin,只要queryAppAgentMenus 成功就可以登录成功

parent 64f2643e
......@@ -236,9 +236,10 @@ public class MainActivity extends SobotBaseActivity {
// }
// });
// SobotLoginTools.getInstance().loginWithAppkey(MainActivity.this, getSobotBaseContext(), true, "https://test-branche1.sobot.com/text", "https://test-branche1.sobot.com", "zhengnw@zhichi.com", "UaH4q8JHj708", "615abf5432134e4992d4da2ba6f460db", map1, new SobotResultBlock() {
// SobotLoginTools.getInstance().loginWithAppkey(MainActivity.this, getSobotBaseContext(), true, "https://api-c.sobot.com/text", "https://api-c.soboten.com/text", "zhengnw@zhichi.com", "b83B6E072W29", "4ce7ca987fcf43beb17ed1eca84dd760", map1, new SobotResultBlock() {
// @Override
// public void resultBolok(SobotResultCode code, String msg, Object obj) {
// SobotLogUtils.i(code.name() + "---------------------------------------");
// SobotLoginTools.getInstance().checkExpiresToken();
// SobotLogUtils.i(SobotLoginTools.getInstance().getAccessToken() + "");
// SobotLogUtils.i(SobotLoginTools.getInstance().getTempId());
......@@ -253,16 +254,16 @@ public class MainActivity extends SobotBaseActivity {
// SobotServiceInfoModel ccc=new SobotServiceInfoModel();
// SobotLoginTools.getInstance().setServiceInfo(ccc);
// SobotLoginTools.getInstance().doLogin(MainActivity.this, MainActivity.this, "https://api-c.sobot.com/text","https://api-c.soboten.com", "zhengnw@sobot.com", "znw123456","", new SobotResultBlock() {
// @Override
// public void resultBolok(SobotResultCode code, String msg, Object obj) {
// SobotLoginTools.getInstance().checkExpiresToken();
// SobotLogUtils.i(SobotLoginTools.getInstance().getAccessToken()+"");
// SobotLogUtils.i(SobotLoginTools.getInstance().getTempId());
// SobotLogUtils.i(SobotLoginTools.getInstance().getToken()+"");
// SobotLogUtils.i(SobotLoginTools.getInstance().getServiceInfo().getTimezone()+"----------------------------------"+SobotLoginTools.getInstance().getServiceInfo().getTimezoneId());
// }
// });
SobotLoginTools.getInstance().doLogin(MainActivity.this, MainActivity.this, true, "https://api-c.sobot.com/text", "https://api-c.sobot.com/tex", "zhengnw@zhichi.com", "znw123456", map1, new SobotResultBlock() {
@Override
public void resultBolok(SobotResultCode code, String msg, Object obj) {
SobotLogUtils.i(code.name() + "---------------------------------------");
SobotLoginTools.getInstance().checkExpiresToken();
SobotLogUtils.i(SobotLoginTools.getInstance().getAccessToken() + "");
SobotLogUtils.i(SobotLoginTools.getInstance().getTempId());
SobotLogUtils.i(SobotLoginTools.getInstance().getToken() + "");
}
});
// Intent intent = new Intent(MainActivity.this, SobotWebViewActivity.class);
// intent.putExtra("url", "https://www.sobot.com/ticketclient/index.html?sysNum=75574e5fa29a48458d1f57ab5489a4c5&deployId=442eb27d9c5c4ab9a3a21023f82207a9");
//// 是否隐藏头部导航栏 默认false显示, true 隐藏
......
......@@ -11,7 +11,7 @@ android {
//这里就是打jar包
task makeJar(type: Copy) {
//删除旧的jar包
delete 'build/libs/sobot_common_x_1.7.5.jar'
delete 'build/libs/sobot_common_x_1.7.6.jar'
//原地址
from('build/intermediates/packaged-classes/release/')
//导出jar包的地址
......@@ -19,7 +19,7 @@ android {
//包含的jar包
include('classes.jar')
//重命名jar包为mysdk
rename ('classes.jar', 'sobot_common_x_1.7.5.jar')
rename('classes.jar', 'sobot_common_x_1.7.6.jar')
}
makeJar.dependsOn(build)
}
......
......@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
ext {
PUBLISH_GROUP_ID = "com.sobot.library" //项目包名
PUBLISH_ARTIFACT_ID = 'sobotcommon_x' //项目名
PUBLISH_VERSION = '1.7.5' //版本号
PUBLISH_VERSION = '1.7.6' //版本号
}
......
......@@ -210,8 +210,8 @@ public class SobotLoginTools {
* @param resultBlock
*/
public void doLogin(final Object cancelTag, final Context mContext, final boolean isAppOrOnlineLogin, final String host, final String openApiHost, final String loginAcount, final String loginPwd, final Map<String, Object> paramsMap, final SobotResultBlock resultBlock) {
if (SobotStringUtils.isEmpty(host) || SobotStringUtils.isEmpty(openApiHost)) {
SobotLogUtils.i("host 或者 openApiHost域名不能为空");
if (SobotStringUtils.isEmpty(host)) {
SobotLogUtils.i("host 域名不能为空");
if (resultBlock != null) {
resultBlock.resultBolok(SobotResultCode.CODE_FAILED, "域名不能为空", getServiceInfo());
}
......@@ -246,7 +246,7 @@ public class SobotLoginTools {
serviceInfoModel.setToken(token);
serviceInfoModel.setLoginAccount(loginAcount);
serviceInfoModel.setLoginPwd(loginPwd);
if ((serviceInfoModel.getCallV6Flag() == 1 || SobotPermissionManager.isHasNewPermission(SobotPermissionManager.SCC)) && !SobotStringUtils.isEmpty(openApiHost)) {
if ((serviceInfoModel.getCallV6Flag() == 1 || SobotPermissionManager.isHasNewPermission(SobotPermissionManager.SCC))) {
//如果是v6呼叫
String tempHost = openApiHost;
if (tempHost.contains("/text")) {
......@@ -272,13 +272,15 @@ public class SobotLoginTools {
}
}
} else {
SobotLogUtils.i("accessToken获取失败");
if (resultBlock != null) {
resultBlock.resultBolok(SobotResultCode.CODE_FAILED, "登录失败 accessToken获取失败", null);
resultBlock.resultBolok(SobotResultCode.CODE_SUCCEEDED, "登录成功", tempServiceInfoModel);
}
}
} else {
SobotLogUtils.i("accessToken获取失败");
if (resultBlock != null) {
resultBlock.resultBolok(SobotResultCode.CODE_FAILED, "登录失败", null);
resultBlock.resultBolok(SobotResultCode.CODE_SUCCEEDED, "登录成功", tempServiceInfoModel);
}
}
}
......@@ -345,8 +347,8 @@ public class SobotLoginTools {
* @param resultBlock
*/
public void loginWithAppkey(final Object cancelTag, final Context mContext, final boolean isAppOrOnlineLogin, final String host, final String openApiHost, final String loginAcount, String appkey, String appId, final Map<String, Object> paramsMap, final SobotResultBlock resultBlock) {
if (SobotStringUtils.isEmpty(host) || SobotStringUtils.isEmpty(openApiHost)) {
SobotLogUtils.i("host 或者 openApiHost域名不能为空");
if (SobotStringUtils.isEmpty(host)) {
SobotLogUtils.i("host 域名不能为空");
if (resultBlock != null) {
resultBlock.resultBolok(SobotResultCode.CODE_FAILED, "域名不能为空", getServiceInfo());
}
......@@ -395,7 +397,7 @@ public class SobotLoginTools {
serviceInfoModel.setLogin_time(login_time);
serviceInfoModel.setToken(token);
serviceInfoModel.setLoginAccount(loginAcount);
if ((serviceInfoModel.getCallV6Flag() == 1 || SobotPermissionManager.isHasNewPermission(SobotPermissionManager.SCC)) && !SobotStringUtils.isEmpty(openApiHost)) {
if ((serviceInfoModel.getCallV6Flag() == 1 || SobotPermissionManager.isHasNewPermission(SobotPermissionManager.SCC))) {
//如果是v6呼叫
String tempHost = openApiHost;
if (tempHost.contains("/text")) {
......@@ -421,13 +423,15 @@ public class SobotLoginTools {
}
}
} else {
SobotLogUtils.i("accessToken获取失败");
if (resultBlock != null) {
resultBlock.resultBolok(SobotResultCode.CODE_FAILED, "登录失败 accessToken获取失败", null);
resultBlock.resultBolok(SobotResultCode.CODE_SUCCEEDED, "登录成功", tempServiceInfoModel);
}
}
} else {
SobotLogUtils.i("accessToken获取失败");
if (resultBlock != null) {
resultBlock.resultBolok(SobotResultCode.CODE_FAILED, "登录失败", null);
resultBlock.resultBolok(SobotResultCode.CODE_SUCCEEDED, "登录成功", tempServiceInfoModel);
}
}
}
......@@ -512,8 +516,8 @@ public class SobotLoginTools {
* @param resultBlock
*/
public void loginWithCompanyToken(final Object cancelTag, final Context mContext, final boolean isAppOrOnlineLogin, final String host, final String openApiHost, final String loginAcount, String token, final Map<String, Object> paramsMap, final SobotResultBlock resultBlock) {
if (SobotStringUtils.isEmpty(host) || SobotStringUtils.isEmpty(openApiHost)) {
SobotLogUtils.i("host 或者 openApiHost域名不能为空");
if (SobotStringUtils.isEmpty(host)) {
SobotLogUtils.i("host域名不能为空");
if (resultBlock != null) {
resultBlock.resultBolok(SobotResultCode.CODE_FAILED, "域名不能为空", getServiceInfo());
}
......@@ -548,7 +552,7 @@ public class SobotLoginTools {
serviceInfoModel.setLogin_time(login_time);
serviceInfoModel.setToken(token);
serviceInfoModel.setLoginAccount(loginAcount);
if ((serviceInfoModel.getCallV6Flag() == 1 || SobotPermissionManager.isHasNewPermission(SobotPermissionManager.SCC)) && !SobotStringUtils.isEmpty(openApiHost)) {
if ((serviceInfoModel.getCallV6Flag() == 1 || SobotPermissionManager.isHasNewPermission(SobotPermissionManager.SCC))) {
//如果是v6呼叫
String tempHost = openApiHost;
if (tempHost.contains("/text")) {
......@@ -574,13 +578,15 @@ public class SobotLoginTools {
}
}
} else {
SobotLogUtils.i("accessToken获取失败");
if (resultBlock != null) {
resultBlock.resultBolok(SobotResultCode.CODE_FAILED, "登录失败 accessToken获取失败", null);
resultBlock.resultBolok(SobotResultCode.CODE_SUCCEEDED, "登录成功", tempServiceInfoModel);
}
}
} else {
SobotLogUtils.i("accessToken获取失败");
if (resultBlock != null) {
resultBlock.resultBolok(SobotResultCode.CODE_FAILED, "登录失败", null);
resultBlock.resultBolok(SobotResultCode.CODE_SUCCEEDED, "登录成功", tempServiceInfoModel);
}
}
}
......@@ -803,6 +809,10 @@ public class SobotLoginTools {
if (!SobotStringUtils.isEmpty(token)) {
headerMap.put("temp-id", token);
}
if (SobotStringUtils.isEmpty(host)) {
//获取accessToken 默认用腾讯云域名
host = "https://api-c.soboten.com";
}
headerMap.put("from", "2");
SobotHttpUtils.doPost(cancelTag, host + "/tokens/getToken", null, headerMap, new HttpBaseUtils.StringCallBack() {
@Override
......@@ -879,13 +889,15 @@ public class SobotLoginTools {
resultBlock.resultBolok(SobotResultCode.CODE_SUCCEEDED, "登录成功", tempServiceInfoModel);
}
} else {
SobotLogUtils.i("appLogin 接口返回code不等于1:" + result);
if (resultBlock != null) {
resultBlock.resultBolok(SobotResultCode.CODE_FAILED, baseModel.getMsg(), baseModel.getCode());
resultBlock.resultBolok(SobotResultCode.CODE_SUCCEEDED, "登录成功", infoModel);
}
}
} else {
SobotLogUtils.i("appLogin 接口请求结果为空");
if (resultBlock != null) {
resultBlock.resultBolok(SobotResultCode.CODE_FAILED, "appLogin 接口请求结果为空,登录失败", null);
resultBlock.resultBolok(SobotResultCode.CODE_SUCCEEDED, "登录成功", infoModel);
}
}
}
......@@ -893,8 +905,9 @@ public class SobotLoginTools {
@Override
public void onError(Exception e, String msg, int responseCode) {
SobotLogUtils.i(SobotStringUtils.checkStringIsNull(msg));
if (resultBlock != null) {
resultBlock.resultBolok(SobotResultCode.CODE_FAILED, msg, null);
resultBlock.resultBolok(SobotResultCode.CODE_SUCCEEDED, "登录成功", infoModel);
}
}
......@@ -904,7 +917,9 @@ public class SobotLoginTools {
}
});
} else {
if (resultBlock != null) {
resultBlock.resultBolok(SobotResultCode.CODE_SUCCEEDED, "登录成功", infoModel);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment