|
@@ -13,8 +13,11 @@ import android.view.MotionEvent; |
|
@@ -13,8 +13,11 @@ import android.view.MotionEvent; |
|
13
|
import android.view.View;
|
13
|
import android.view.View;
|
|
14
|
import android.widget.EditText;
|
14
|
import android.widget.EditText;
|
|
15
|
import android.widget.TextView;
|
15
|
import android.widget.TextView;
|
|
|
|
16
|
+import android.widget.Toast;
|
|
16
|
|
17
|
|
|
17
|
import com.vhall.business.VhallSDK;
|
18
|
import com.vhall.business.VhallSDK;
|
|
|
|
19
|
+import com.vhall.business.data.UserInfo;
|
|
|
|
20
|
+import com.vhall.business.data.source.UserInfoDataSource;
|
|
18
|
import com.vhall.uilibs.Param;
|
21
|
import com.vhall.uilibs.Param;
|
|
19
|
import com.vhall.uilibs.util.VhallUtil;
|
22
|
import com.vhall.uilibs.util.VhallUtil;
|
|
20
|
import com.vhall.uilibs.watch.EncrypedThirdUserIdInfo;
|
23
|
import com.vhall.uilibs.watch.EncrypedThirdUserIdInfo;
|
|
@@ -57,47 +60,6 @@ public class LoginActivity extends Activity { |
|
@@ -57,47 +60,6 @@ public class LoginActivity extends Activity { |
|
57
|
mVerTextView = this.findViewById(R.id.label_ver);
|
60
|
mVerTextView = this.findViewById(R.id.label_ver);
|
|
58
|
|
61
|
|
|
59
|
mVerTextView.setText(VhallSDK.getVersion());
|
62
|
mVerTextView.setText(VhallSDK.getVersion());
|
|
60
|
- //查询直播状态
|
|
|
|
61
|
- OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
|
62
|
-
|
|
|
|
63
|
- Request build = new Request.Builder()
|
|
|
|
64
|
- .url("http://192.168.0.142:8081/api/checkback?thirdId=538670945")
|
|
|
|
65
|
- .build();
|
|
|
|
66
|
- Call call = okHttpClient.newCall(build);
|
|
|
|
67
|
- call.enqueue(new Callback() {
|
|
|
|
68
|
- @Override
|
|
|
|
69
|
- public void onFailure(Call call, IOException e) {
|
|
|
|
70
|
- Log.d("OWN", "onFailure2: " + e.getMessage());
|
|
|
|
71
|
- }
|
|
|
|
72
|
-
|
|
|
|
73
|
- @Override
|
|
|
|
74
|
- public void onResponse(Call call, final Response response) throws IOException {
|
|
|
|
75
|
- final String respStr = response.body().string();
|
|
|
|
76
|
- runOnUiThread(new Runnable() {
|
|
|
|
77
|
- @Override
|
|
|
|
78
|
- public void run() {
|
|
|
|
79
|
-
|
|
|
|
80
|
- if (!respStr.isEmpty()) {
|
|
|
|
81
|
- //对请求到的直播信息进行json解析
|
|
|
|
82
|
- JSONObject jsonObject = null;
|
|
|
|
83
|
- try {
|
|
|
|
84
|
- jsonObject = new JSONObject(respStr);
|
|
|
|
85
|
- String body = jsonObject.getString("Body");
|
|
|
|
86
|
- JSONObject jsonObject1 = new JSONObject(body);
|
|
|
|
87
|
- //直播频道logo
|
|
|
|
88
|
- String liveLogo = jsonObject1.getString("homePageImg");
|
|
|
|
89
|
- Log.d("图片路径", "run: "+liveLogo);
|
|
|
|
90
|
- } catch (JSONException e) {
|
|
|
|
91
|
- e.printStackTrace();
|
|
|
|
92
|
- }
|
|
|
|
93
|
-
|
|
|
|
94
|
- }
|
|
|
|
95
|
- }
|
|
|
|
96
|
- });
|
|
|
|
97
|
-
|
|
|
|
98
|
- }
|
|
|
|
99
|
- });
|
|
|
|
100
|
-
|
|
|
|
101
|
|
63
|
|
|
102
|
}
|
64
|
}
|
|
103
|
|
65
|
|
|
@@ -146,6 +108,10 @@ public class LoginActivity extends Activity { |
|
@@ -146,6 +108,10 @@ public class LoginActivity extends Activity { |
|
146
|
json.put("key", encrypedThirdUserIdInfo.getKey());
|
108
|
json.put("key", encrypedThirdUserIdInfo.getKey());
|
|
147
|
json.put("cipher", encrypedThirdUserIdInfo.getCipher());
|
109
|
json.put("cipher", encrypedThirdUserIdInfo.getCipher());
|
|
148
|
json.put("name", username);
|
110
|
json.put("name", username);
|
|
|
|
111
|
+ /*json.put("iv", "30818a02210086be9b0de4546ddd5faa4774cf8eafdc11f5108858497f018b86921301a14f6d022100eaf14deb353a5e3267f63893cda96676070a62dd461799525e36f0494e8fc8c9042003b8129a43cb1c00a63f708bef9dda2da828df6e4e9f604aa4e4c2b9707e796804208460474f52833b3022cd16dc579ed40396493b3888c53721b543cc470ea5f60e");
|
|
|
|
112
|
+ json.put("key", "308188022019056faae3f9f257c2a1df778900d230d73590a6a1387528fb51a06efbeef34002201098a27cbf4362806c4f3d809a865c08a046bd206882f7ba61c866ee469afae2042005202d8ed208e48c43ef831917cf9f92d57e3d67e6cfb00c25ab2a53fa2e188d04207d7c263c168f477e045d467c7990376cf13151b901ceacebbdb19a8761af0fd9");
|
|
|
|
113
|
+ json.put("cipher", "7753277346061b7e84ecfb8fec3fb122b5cd210e43a431cc4c1e45e0c5e2e6b8162f1540525b616f85fde4792ef3f10094c4f368e68816ca0b136786604f1928945900b030a4f35fbd2dffc0948d848d4dad1ed210b78cfe49844a2c06b91d11ebc2d96a0a9bba1ec30ee5fa60560b7e59ba87f1f41cf253bfa80bbbb3155e7c34ddd5503d2bb92a697269fb66ca67b2150fc60ab2d92dc82d6ac454e583875eca92eb45b99c41e8c2a6959c5855b17e");
|
|
|
|
114
|
+ json.put("name", "username");*/
|
|
149
|
} catch (JSONException e) {
|
115
|
} catch (JSONException e) {
|
|
150
|
e.printStackTrace();
|
116
|
e.printStackTrace();
|
|
151
|
}
|
117
|
}
|
|
@@ -155,7 +121,7 @@ public class LoginActivity extends Activity { |
|
@@ -155,7 +121,7 @@ public class LoginActivity extends Activity { |
|
155
|
RequestBody requestBody = RequestBody.create(JSON, String.valueOf(json));
|
121
|
RequestBody requestBody = RequestBody.create(JSON, String.valueOf(json));
|
|
156
|
//3 . 构建Request,将FormBody作为Post方法的参数传入
|
122
|
//3 . 构建Request,将FormBody作为Post方法的参数传入
|
|
157
|
Request request = new Request.Builder()
|
123
|
Request request = new Request.Builder()
|
|
158
|
- .url("http://192.168.0.142:8081/api/user/login")
|
124
|
+ .url("https://guangfaapi.vhall.com/api/user/login")
|
|
159
|
.post(requestBody)
|
125
|
.post(requestBody)
|
|
160
|
.build();
|
126
|
.build();
|
|
161
|
|
127
|
|
|
@@ -170,18 +136,19 @@ public class LoginActivity extends Activity { |
|
@@ -170,18 +136,19 @@ public class LoginActivity extends Activity { |
|
170
|
public void onResponse(Call call, Response response) throws IOException {
|
136
|
public void onResponse(Call call, Response response) throws IOException {
|
|
171
|
String respStr = response.body().string();
|
137
|
String respStr = response.body().string();
|
|
172
|
//解析json//body
|
138
|
//解析json//body
|
|
173
|
- JSONObject jsonObject = null;
|
|
|
|
174
|
try {
|
139
|
try {
|
|
175
|
- jsonObject = new JSONObject(respStr);
|
|
|
|
176
|
- if(jsonObject.getInt("code") != 0){
|
140
|
+ JSONObject jsonObject = new JSONObject(respStr);
|
|
|
|
141
|
+ if(Integer.parseInt(jsonObject.getString("code")) == 500){
|
|
177
|
listener.onError(""+jsonObject.getInt("code"),jsonObject.getString("message"));
|
142
|
listener.onError(""+jsonObject.getInt("code"),jsonObject.getString("message"));
|
|
178
|
}else {
|
143
|
}else {
|
|
179
|
String body = jsonObject.getString("data");
|
144
|
String body = jsonObject.getString("data");
|
|
|
|
145
|
+ Log.d(TAG, "打印" + body);
|
|
180
|
JSONObject jsonObject1 = new JSONObject(body);
|
146
|
JSONObject jsonObject1 = new JSONObject(body);
|
|
181
|
String json = jsonObject1.getString("thirdUserId");
|
147
|
String json = jsonObject1.getString("thirdUserId");
|
|
|
|
148
|
+ VhallSdkLogin(json, jsonObject1.getString("pass"));
|
|
182
|
listener.onSuccess();
|
149
|
listener.onSuccess();
|
|
183
|
}
|
150
|
}
|
|
184
|
- //VhallSdkLogin(json, jsonObject1.getString("pass"));
|
151
|
+
|
|
185
|
} catch (Exception e) {
|
152
|
} catch (Exception e) {
|
|
186
|
e.printStackTrace();
|
153
|
e.printStackTrace();
|
|
187
|
|
154
|
|
|
@@ -192,7 +159,6 @@ public class LoginActivity extends Activity { |
|
@@ -192,7 +159,6 @@ public class LoginActivity extends Activity { |
|
192
|
|
159
|
|
|
193
|
}
|
160
|
}
|
|
194
|
|
161
|
|
|
195
|
-/*
|
|
|
|
196
|
private void VhallSdkLogin(String username, String userpass) {
|
162
|
private void VhallSdkLogin(String username, String userpass) {
|
|
197
|
VhallSDK.login(username, userpass, new UserInfoDataSource.UserInfoCallback() {
|
163
|
VhallSDK.login(username, userpass, new UserInfoDataSource.UserInfoCallback() {
|
|
198
|
@Override
|
164
|
@Override
|
|
@@ -213,7 +179,6 @@ public class LoginActivity extends Activity { |
|
@@ -213,7 +179,6 @@ public class LoginActivity extends Activity { |
|
213
|
}
|
179
|
}
|
|
214
|
});
|
180
|
});
|
|
215
|
}
|
181
|
}
|
|
216
|
-*/
|
|
|
|
217
|
|
182
|
|
|
218
|
|
183
|
|
|
219
|
public void loginClick(View view) {
|
184
|
public void loginClick(View view) {
|
|
@@ -262,7 +227,7 @@ public class LoginActivity extends Activity { |
|
@@ -262,7 +227,7 @@ public class LoginActivity extends Activity { |
|
262
|
String userId = mUserId.getText().toString();
|
227
|
String userId = mUserId.getText().toString();
|
|
263
|
if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(password) && !TextUtils.isEmpty(userId)) {
|
228
|
if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(password) && !TextUtils.isEmpty(userId)) {
|
|
264
|
// createUser();//点击登录先调用注册接口
|
229
|
// createUser();//点击登录先调用注册接口
|
|
265
|
- // VhallLogin(mUserId.getText().toString(), mTextInputUsername.getText().toString(),);
|
230
|
+ // VhallLogin(null,"",null);
|
|
266
|
|
231
|
|
|
267
|
}
|
232
|
}
|
|
268
|
}
|
233
|
}
|