Authored by 龙鑫凡

own

... ... @@ -13,8 +13,11 @@ import android.view.MotionEvent;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.vhall.business.VhallSDK;
import com.vhall.business.data.UserInfo;
import com.vhall.business.data.source.UserInfoDataSource;
import com.vhall.uilibs.Param;
import com.vhall.uilibs.util.VhallUtil;
import com.vhall.uilibs.watch.EncrypedThirdUserIdInfo;
... ... @@ -57,47 +60,6 @@ public class LoginActivity extends Activity {
mVerTextView = this.findViewById(R.id.label_ver);
mVerTextView.setText(VhallSDK.getVersion());
//查询直播状态
OkHttpClient okHttpClient = new OkHttpClient();
Request build = new Request.Builder()
.url("http://192.168.0.142:8081/api/checkback?thirdId=538670945")
.build();
Call call = okHttpClient.newCall(build);
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
Log.d("OWN", "onFailure2: " + e.getMessage());
}
@Override
public void onResponse(Call call, final Response response) throws IOException {
final String respStr = response.body().string();
runOnUiThread(new Runnable() {
@Override
public void run() {
if (!respStr.isEmpty()) {
//对请求到的直播信息进行json解析
JSONObject jsonObject = null;
try {
jsonObject = new JSONObject(respStr);
String body = jsonObject.getString("Body");
JSONObject jsonObject1 = new JSONObject(body);
//直播频道logo
String liveLogo = jsonObject1.getString("homePageImg");
Log.d("图片路径", "run: "+liveLogo);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
});
}
});
}
... ... @@ -146,6 +108,10 @@ public class LoginActivity extends Activity {
json.put("key", encrypedThirdUserIdInfo.getKey());
json.put("cipher", encrypedThirdUserIdInfo.getCipher());
json.put("name", username);
/*json.put("iv", "30818a02210086be9b0de4546ddd5faa4774cf8eafdc11f5108858497f018b86921301a14f6d022100eaf14deb353a5e3267f63893cda96676070a62dd461799525e36f0494e8fc8c9042003b8129a43cb1c00a63f708bef9dda2da828df6e4e9f604aa4e4c2b9707e796804208460474f52833b3022cd16dc579ed40396493b3888c53721b543cc470ea5f60e");
json.put("key", "308188022019056faae3f9f257c2a1df778900d230d73590a6a1387528fb51a06efbeef34002201098a27cbf4362806c4f3d809a865c08a046bd206882f7ba61c866ee469afae2042005202d8ed208e48c43ef831917cf9f92d57e3d67e6cfb00c25ab2a53fa2e188d04207d7c263c168f477e045d467c7990376cf13151b901ceacebbdb19a8761af0fd9");
json.put("cipher", "7753277346061b7e84ecfb8fec3fb122b5cd210e43a431cc4c1e45e0c5e2e6b8162f1540525b616f85fde4792ef3f10094c4f368e68816ca0b136786604f1928945900b030a4f35fbd2dffc0948d848d4dad1ed210b78cfe49844a2c06b91d11ebc2d96a0a9bba1ec30ee5fa60560b7e59ba87f1f41cf253bfa80bbbb3155e7c34ddd5503d2bb92a697269fb66ca67b2150fc60ab2d92dc82d6ac454e583875eca92eb45b99c41e8c2a6959c5855b17e");
json.put("name", "username");*/
} catch (JSONException e) {
e.printStackTrace();
}
... ... @@ -155,7 +121,7 @@ public class LoginActivity extends Activity {
RequestBody requestBody = RequestBody.create(JSON, String.valueOf(json));
//3 . 构建Request,将FormBody作为Post方法的参数传入
Request request = new Request.Builder()
.url("http://192.168.0.142:8081/api/user/login")
.url("https://guangfaapi.vhall.com/api/user/login")
.post(requestBody)
.build();
... ... @@ -170,18 +136,19 @@ public class LoginActivity extends Activity {
public void onResponse(Call call, Response response) throws IOException {
String respStr = response.body().string();
//解析json//body
JSONObject jsonObject = null;
try {
jsonObject = new JSONObject(respStr);
if(jsonObject.getInt("code") != 0){
JSONObject jsonObject = new JSONObject(respStr);
if(Integer.parseInt(jsonObject.getString("code")) == 500){
listener.onError(""+jsonObject.getInt("code"),jsonObject.getString("message"));
}else {
String body = jsonObject.getString("data");
Log.d(TAG, "打印" + body);
JSONObject jsonObject1 = new JSONObject(body);
String json = jsonObject1.getString("thirdUserId");
VhallSdkLogin(json, jsonObject1.getString("pass"));
listener.onSuccess();
}
//VhallSdkLogin(json, jsonObject1.getString("pass"));
} catch (Exception e) {
e.printStackTrace();
... ... @@ -192,7 +159,6 @@ public class LoginActivity extends Activity {
}
/*
private void VhallSdkLogin(String username, String userpass) {
VhallSDK.login(username, userpass, new UserInfoDataSource.UserInfoCallback() {
@Override
... ... @@ -213,7 +179,6 @@ public class LoginActivity extends Activity {
}
});
}
*/
public void loginClick(View view) {
... ... @@ -262,7 +227,7 @@ public class LoginActivity extends Activity {
String userId = mUserId.getText().toString();
if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(password) && !TextUtils.isEmpty(userId)) {
// createUser();//点击登录先调用注册接口
// VhallLogin(mUserId.getText().toString(), mTextInputUsername.getText().toString(),);
// VhallLogin(null,"",null);
}
}
... ...
... ... @@ -18,6 +18,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="用户ID"
android:text="908702700048483"
android:id="@+id/userId"/>
<EditText
... ... @@ -27,8 +28,7 @@
android:drawableLeft="@drawable/abc_icon_login_name"
android:drawablePadding="@dimen/common_drawable_padding_8dp"
android:gravity="center_vertical"
android:hint="请输入用户名"
android:text=""
android:text="975024000479"
android:textColorHint="@color/gray_text_hint"
android:textSize="@dimen/string_size_16" />
... ... @@ -39,15 +39,14 @@
android:drawableLeft="@drawable/abc_icon_login_pass"
android:drawablePadding="@dimen/common_drawable_padding_8dp"
android:gravity="center_vertical"
android:hint="请输入密码"
android:inputType="textPassword"
android:text=""
android:text="3456744898765"
android:textColorHint="@color/gray_text_hint"
android:textSize="@dimen/string_size_16" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入房间号"
android:text="538670945"
android:id="@+id/watchId"/>
<Button
... ...
... ... @@ -507,7 +507,7 @@ public class VWatchActivity extends FragmentActivity implements WatchContract.Wa
OkHttpClient okHttpClient = new OkHttpClient();
Request build = new Request.Builder()
.url("http://192.168.0.142:8081/api/checkback?thirdId=" + liveBack)
.url("https://guangfaapi.vhall.com/api/checkback?thirdId=" + liveBack)
.build();
Call call = okHttpClient.newCall(build);
call.enqueue(new Callback() {
... ...