[M] all functional

This commit is contained in:
2024-08-16 00:56:24 +08:00
parent c355784122
commit 1a0af9d725
14 changed files with 1278 additions and 171 deletions

View File

@@ -65,7 +65,6 @@ public class SDKManager {
public static void parseLoginInfo(int i, String s) {
Log.e(TAG,"parseLoginInfo!!" );
try {
JSONObject result = new JSONObject();
result.put("code", i);
@@ -74,19 +73,15 @@ public class SDKManager {
JSONObject userInfo = serverResponse.getJSONObject("result");
JSONObject userInfoReorganization = new JSONObject();
userInfoReorganization.put("userId", userInfo.optString("userId"));
userInfoReorganization.put("authorCode", userInfo.optString("authorCode"));
userInfoReorganization.put("token", userInfo.optString("token"));
userInfoReorganization.put("jwttoken", userInfo.optString("jwttoken"));
userInfoReorganization.put("loginChannelTypeC", userInfo.optString("loginChannelTypeC"));
JSONObject userInfoResult = new JSONObject();
userInfoResult.put("result", userInfoReorganization);
result.put("respObj", userInfoResult);
Log.e(TAG,"userId:::::" + userInfo.optString("userId"));
Log.e(TAG,"token:::::" + userInfo.optString("token"));
} else {
Log.e(TAG,"errStr:::::" +s);
result.put("errStr", s);
Log.e(TAG,"errStrInfo:::::" +result.toString());
}
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.LOGIN_CALLBACK_FUNCTION_NAME, result.toString());
@@ -163,13 +158,59 @@ public class SDKManager {
});
}
public static void UnityLogOutByChannel(string type) {
public static void UnityLogOutByChannel(String type) {
// Log.e(TAG,"UnityLoginOut!!!");
SDKLog.i("UnityLoginOut : ");
handler.post(() -> SDKAPI.getIns().logout(type));
}
public static void UnityKnow(String userId, String productId, String productPrice, String productName, String productCount, String prodorderId, String appInfo) {
public static void LinkAccount(String type, String userId)
{
SDKAPI.getIns().getSnsInfo(type, (code, snsInfo, msg) -> {
if(code == SDKCallBack.CODE_SUCCESS && snsInfo != null){
SDKAPI.getIns().bindBySnsId(snsInfo, userId, mLogin);
}else {
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.LOGIN_CALLBACK_FUNCTION_NAME, "{\"code\":1}}");
}
});
}
public static void LinkCheck(String type)
{
SDKAPI.getIns().getSnsInfo(type, (code, snsInfo, msg) -> {
if(code == SDKCallBack.CODE_SUCCESS && snsInfo != null){
SDKAPI.getIns().checkSnsInfo(snsInfo, (code1, msg1) -> {
if(code1 == SDKCallBack.CODE_SUCCESS && !TextUtils.isEmpty(msg1)){
try {
JSONObject jsonObject = new JSONObject(msg1).optJSONObject("result");
//返回信息中code为0时表示服务端查询成功exit为1表示此渠道用户信息已产生过途游账号可直接进行登录exit为0表示此渠道用户信息未产生过途游账号可以进行绑定
if(jsonObject.optString("code").equals("0")
&& jsonObject.optString("exist").equals("0")){
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "0");
}
else
{
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "1");
}
} catch (JSONException e) {
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "-1");
e.printStackTrace();
}
}
else
{
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "-1");
}
});
}
else
{
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "-1");
}
});
}
public static void UnityKnow(String productId, String productName, String productCount, String prodorderId, String appInfo) {
SDKLog.i("UnityKnow : " + productId);
HashMap<String, String> extraInfo = new HashMap<String, String>();
extraInfo.put("appInfo", appInfo);