|
@@ -1,8 +1,13 @@
|
|
|
package cn.yyxx.eyuangame.core.impl.center
|
|
|
|
|
|
import android.app.Activity
|
|
|
+import cn.yyxx.eyuangame.core.entity.ResultInfo
|
|
|
+import cn.yyxx.eyuangame.core.entity.SdkBackLoginInfo
|
|
|
import cn.yyxx.eyuangame.core.internal.IImplCallback
|
|
|
+import cn.yyxx.eyuangame.core.internal.IRequestCallback
|
|
|
+import cn.yyxx.eyuangame.core.network.SdkRequest
|
|
|
import org.json.JSONException
|
|
|
+import org.json.JSONObject
|
|
|
|
|
|
/**
|
|
|
* @author #Suyghur.
|
|
@@ -12,8 +17,86 @@ class MemberCenterImpl(val implCallback: IImplCallback) {
|
|
|
|
|
|
fun bindAccount(activity: Activity, userName: String, pwd: String) {
|
|
|
try {
|
|
|
+ with(JSONObject()) {
|
|
|
+ put("uid", SdkBackLoginInfo.instance.userId)
|
|
|
+ put("login_type", SdkBackLoginInfo.instance.loginType)
|
|
|
+ put("uname", userName)
|
|
|
+ put("pwd", pwd)
|
|
|
+ SdkRequest.instance.bindAccount(activity, this, object : IRequestCallback {
|
|
|
+ override fun onResponse(resultInfo: ResultInfo) {
|
|
|
+ if (resultInfo.code == 1) {
|
|
|
+ implCallback.onResult(0, resultInfo.data)
|
|
|
+ } else {
|
|
|
+ implCallback.onResult(-1, resultInfo.data)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ fun getCaptcha(activity: Activity, phoneNum: String) {
|
|
|
+ try {
|
|
|
+ with(JSONObject()) {
|
|
|
+ put("phone_num", phoneNum)
|
|
|
+ SdkRequest.instance.getCaptcha(activity, this, object : IRequestCallback {
|
|
|
+ override fun onResponse(resultInfo: ResultInfo) {
|
|
|
+ if (resultInfo.code == 1) {
|
|
|
+ implCallback.onResult(0, resultInfo.data)
|
|
|
+ } else {
|
|
|
+ implCallback.onResult(-1, resultInfo.data)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ fun bnindPhone(activity: Activity, phoneNum: String, captcha: String) {
|
|
|
+ try {
|
|
|
+ with(JSONObject()) {
|
|
|
+ put("phone_num", phoneNum)
|
|
|
+ put("captcha", captcha)
|
|
|
+ put("uid", SdkBackLoginInfo.instance.userId)
|
|
|
+
|
|
|
+ SdkRequest.instance.bindPhone(activity, this, object : IRequestCallback {
|
|
|
+ override fun onResponse(resultInfo: ResultInfo) {
|
|
|
+ if (resultInfo.code == 1) {
|
|
|
+ implCallback.onResult(0, resultInfo.data)
|
|
|
+ } else {
|
|
|
+ implCallback.onResult(-1, resultInfo.data)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ fun modifyPwd(activity: Activity, oldPwd: String, newPwd: String) {
|
|
|
+ try {
|
|
|
+ with(JSONObject()) {
|
|
|
+ put("uid", SdkBackLoginInfo.instance.userId)
|
|
|
+ put("old_pwd", oldPwd)
|
|
|
+ put("new_pwd", newPwd)
|
|
|
|
|
|
- } catch (e: JSONException) {
|
|
|
+ SdkRequest.instance.modifyUserPwd(activity, this, object : IRequestCallback {
|
|
|
+ override fun onResponse(resultInfo: ResultInfo) {
|
|
|
+ if (resultInfo.code == 1) {
|
|
|
+ implCallback.onResult(0, resultInfo.data)
|
|
|
+ } else {
|
|
|
+ implCallback.onResult(-1, resultInfo.data)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } catch (e: Exception) {
|
|
|
e.printStackTrace()
|
|
|
}
|
|
|
}
|