Commit c2402504 by YKai

feat:登录注册老接口替换为新接口

parent 201d5f1f
......@@ -21,6 +21,7 @@ import okhttp3.RequestBody
class LoginApiRequestUtil {
companion object {
private var userApi: UserApi? = null
const val LOGIN_USER_PORT = "userPort:1"
private fun getUserApi(): UserApi {
if (userApi == null) {
......
......@@ -4,10 +4,12 @@ import com.google.gson.internal.LinkedTreeMap
import com.ydl.ydlcommon.base.config.YDLConstants
import com.ydl.ydlcommon.base.config.YDL_DOMAIN
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_LOGIN_BASE_URL
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.bean.CollectFocusItemBean
import com.yidianling.user.http.LoginApiRequestUtil.Companion.LOGIN_USER_PORT
import com.yidianling.user.http.response.*
import com.yidianling.user.mine.bean.RedPacketId
import io.reactivex.Observable
......@@ -61,10 +63,7 @@ interface UserApi {
@Headers( YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun setChannelId(@Body body: RequestBody): Observable<BaseResponse<LinkedTreeMap<String, String>>>
//第三方登录
@POST("user/user_q_w")
@Headers( YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun thirdPartyLogin(@Body body: RequestBody): Observable<BaseAPIResponse<UserResponseBean>>
//设置用户信息
@FormUrlEncoded
......@@ -116,67 +115,18 @@ interface UserApi {
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun privacyAgree(@Query("uid") uid: String): Observable<BaseResponse<Any>>
//检查手机号来源
@GET("user/phone_detection")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
// @Headers("Content-type:application/json;charset=UTF-8","userPort:1")
fun checkPhoneStatus(@Query("phone") phone: String, @Query("countryCode") countryCode: String): Observable<BaseResponse<ChcekPhoneResponeBean>>
//服务端校验阿里一键认证
@POST("phone/verification/init")
fun checkAliAuth(@Body body: RequestBody): Observable<BaseResponse<PhoneAuthResponseBean>>
//一键登录
@POST("user/login_direct")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun autoLogin(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>
//手机号密码登录
@POST("user/login_pwd")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun loginByPassword(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>
//重新设置密码
@POST("user/reset_pwd")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun resetPwd(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>
//验证重置密码的短信验证码
@GET("user/precheck_reset_sms")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun checkResetCode(@Query("phone") phone: String, @Query("countryCode") countryCode: String, @Query("code") code: String): Observable<BaseResponse<Any>>
//发送登录验证码
@GET("user/send_login_sms")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun sendLoginMsgCode(@Query("phone") phone: String, @Query("countryCode") countryCode: String): Observable<BaseResponse<Any>>
//发送忘记密码重置密码的验证码
@GET("user/send_reset_sms")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun sendResetCode(@Query("phone") phone: String, @Query("countryCode") countryCode: String): Observable<BaseResponse<Any>>
//绑定手机号
@POST("user/bind_phone")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun bindPhone(@Body body: RequestBody): Observable<BaseResponse<Any>>
//验证码登录
@POST("user/login_sms")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun loginByMsgCode(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>
//第三方登录获取用户信息
@POST("user/user_q_w")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
@POST("login/v2/login_wechat_qq")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_LOGIN_BASE_URL,LOGIN_USER_PORT)
fun thirdPartJavaLogin(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>
//第三方登录解绑
@POST("user/unbind_third")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun unBindThirdLogin(@Body body: RequestBody): Observable<BaseResponse<Any>>
//获取隐私政策数据
@GET("site/get-privacy-content")
fun getSecretData(): Observable<BaseResponse<SecretResponse>>
......@@ -202,4 +152,86 @@ interface UserApi {
@POST("user/getNewUserJumpUrl")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun getNewUserJumpUrl(@FieldMap params: Map<String, String>): Observable<BaseAPIResponse<String>>
/**
* 绑定手机号
*/
@POST("/login/v2/bind_phone")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_LOGIN_BASE_URL,LOGIN_USER_PORT)
fun bindPhone(@Body body: RequestBody): Observable<BaseResponse<Any>>
/**
* 一键登录和本机号码校验
*/
@POST("login/v2/login_direct")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_LOGIN_BASE_URL, LOGIN_USER_PORT)
fun autoLogin(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>
/**
* 密码登录
*/
@POST("login/v2/login_pwd")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_LOGIN_BASE_URL,LOGIN_USER_PORT)
fun loginByPassword(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>
/**
* 验证码登录
*/
@POST("login/v2/login_sms")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_LOGIN_BASE_URL,LOGIN_USER_PORT)
fun loginByMsgCode(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>
/**
* 第三方登录
*/
@POST("login/v2/login_wechat_qq")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_LOGIN_BASE_URL,LOGIN_USER_PORT)
fun thirdPartyLogin(@Body body: RequestBody): Observable<BaseAPIResponse<UserResponseBean>>
/**
* 检查手机号来源
*/
@GET("login/v2/phone_detection")
@Headers(YDL_DOMAIN+ YDL_DOMAIN_LOGIN_BASE_URL,LOGIN_USER_PORT)
fun checkPhoneStatus(@Query("phone") phone: String, @Query("countryCode") countryCode: String): Observable<BaseResponse<ChcekPhoneResponeBean>>
/**
* 验证重置密码的短信验证码
*/
@GET("login/v2/pre_check_reset_sms")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_LOGIN_BASE_URL,LOGIN_USER_PORT)
fun checkResetCode(@Query("phone") phone: String, @Query("countryCode") countryCode: String, @Query("code") code: String): Observable<BaseResponse<Any>>
/**
* 重置密码
*/
@POST("/login/v2/reset_pwd")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun resetPwd(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>
/**
* 发送登录验证码
*/
@GET("user/send_login_sms")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun sendLoginMsgCode(@Query("phone") phone: String, @Query("countryCode") countryCode: String): Observable<BaseResponse<Any>>
/**
* 发送忘记密码重置密码的验证码
*/
@GET("login/v2/send_reset_sms")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_LOGIN_BASE_URL,LOGIN_USER_PORT)
fun sendResetCode(@Query("phone") phone: String, @Query("countryCode") countryCode: String): Observable<BaseResponse<Any>>
/**
* 第三方登录解绑
*/
@POST("login/v2/unbind_wechat_qq")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_LOGIN_BASE_URL,LOGIN_USER_PORT)
fun unBindThirdLogin(@Body body: RequestBody): Observable<BaseResponse<Any>>
}
\ No newline at end of file
......@@ -372,12 +372,10 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
int id = v.getId();//切换环境逻辑按钮
if (id == R.id.text_userName || id == R.id.cv_duration) {
if (!UserHelper.INSTANCE.isLogin()) {
// RegisterAndLoginActivity.Companion.start(getActivity());
startLogin();
}
} else if (id == R.id.iv_edit_info) {//修改资料
if (!UserHelper.INSTANCE.isLogin()) {
// RegisterAndLoginActivity.Companion.start(getActivity());
startLogin();
return;
}
......@@ -390,7 +388,6 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
return;
}
if (!UserHelper.INSTANCE.isLogin()) {
// RegisterAndLoginActivity.Companion.start(getActivity());
startLogin();
return;
}
......@@ -400,14 +397,12 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
}
} else if (id == R.id.ll_account) {//账户余额
if (!UserHelper.INSTANCE.isLogin()) {
// RegisterAndLoginActivity.Companion.start(getActivity());
startLogin();
return;
}
startActivity(new Intent(getActivity(), AccountHistoryActivity.class));
} else if (id == R.id.ll_red_packet) {//我的红包
if (!UserHelper.INSTANCE.isLogin()) {
// RegisterAndLoginActivity.Companion.start(getActivity());
startLogin();
return;
}
......@@ -415,7 +410,6 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
ModularServiceManager.INSTANCE.provide(IAppService.class).myRedPockIntent(getActivity());
} else if (id == R.id.ll_fans) {//粉丝
if (!UserHelper.INSTANCE.isLogin()) {
// RegisterAndLoginActivity.Companion.start(getActivity());
startLogin();
return;
}
......@@ -424,7 +418,6 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
NewH5Activity.start(getActivity(), h5Params);
} else if (id == R.id.ll_guanzhu) {//我关注的
if (!UserHelper.INSTANCE.isLogin()) {
// RegisterAndLoginActivity.Companion.start(getActivity());
startLogin();
return;
}
......@@ -433,7 +426,6 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
NewH5Activity.start(getActivity(), h5Params1);
} else if (id == R.id.ll_my_trends) {
if (!UserHelper.INSTANCE.isLogin()) {
// RegisterAndLoginActivity.Companion.start(getActivity());
startLogin();
return;
}
......@@ -448,14 +440,12 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
} else if (id == R.id.jtv_account_setting) {//账号设置
//点击消息 未登录请先登录
if (!UserHelper.INSTANCE.isLogin()) {
// RegisterAndLoginActivity.Companion.start(getActivity());
startLogin();
return;
}
startActivity(new Intent(getActivity(), AccountSettingActivity.class));
} else if (id == R.id.jtv_account_privacy) {// 未登录请先登录
if (!UserHelper.INSTANCE.isLogin()) {
// RegisterAndLoginActivity.Companion.start(getActivity());
startLogin();
return;
}
......@@ -464,7 +454,6 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
startActivity(new Intent(getActivity(), PrivacyActivity.class));
} else if (id == R.id.ll_trade_order) {//预约
if (!UserHelper.INSTANCE.isLogin()) {
// RegisterAndLoginActivity.Companion.start(getActivity());
startLogin();
return;
}
......@@ -476,14 +465,12 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
NewH5Activity.start(getActivity(), h5Params3);
} else if (id == R.id.ll_my_courses) {//我的课程
if (!UserHelper.INSTANCE.isLogin()) {
// RegisterAndLoginActivity.Companion.start(getActivity());
startLogin();
return;
}
ModularServiceManager.INSTANCE.provide(ICourseService.class).startMyCourseActivity(getActivity());
} else if (id == R.id.ll_call_order) {//倾诉
if (!UserHelper.INSTANCE.isLogin()) {
// RegisterAndLoginActivity.Companion.start(getActivity());
startLogin();
return;
}
......@@ -508,7 +495,6 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
}
} else if (id == R.id.ll_my_test_log) {//测试记录
if (!UserHelper.INSTANCE.isLogin()) {
// RegisterAndLoginActivity.Companion.start(getActivity());
startLogin();
return;
}
......@@ -526,7 +512,6 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
NewH5Activity.start(getActivity(), params1);
} else if (id == R.id.ll_reward) {
if (!UserHelper.INSTANCE.isLogin()) {
// RegisterAndLoginActivity.Companion.start(getActivity());
startLogin();
return;
}
......
......@@ -13,7 +13,10 @@ import com.meituan.android.walle.WalleChannelReader
import com.mobile.auth.gatewayauth.*
import com.mobile.auth.gatewayauth.model.TokenRet
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_LOGIN_BASE_URL
import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlnet.builder.manage.HttpUrlManager
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxImageTool
......@@ -33,9 +36,9 @@ object OneKeyLoginHelp {
const val YDL_EXPERT_APP = 2
var mPhoneNumberAuthHelper: PhoneNumberAuthHelper? = null
private var mAppType: Int = YDL_USER_APP
private var mIsFromGuide = true // 是否来自启动页
var mIsGetTokenSuccess = true // 获取token是否成功,默认是成功
var mIsOpenOneKeyLogin = false // 是否开启一键登录
var mIsFromGuide = true
var mIsOpenOneKeyLogin = true // 是否开启一键登录
var mAuthType = PhoneNumberAuthHelper.SERVICE_TYPE_LOGIN // 1:本机号码校验 2: ⼀键登录
private var checkBoxHidden = true // 协议勾选框是否展示
private lateinit var mActivity: BaseActivity
......@@ -56,10 +59,11 @@ object OneKeyLoginHelp {
it.setAuthSDKInfo(YDL_EXPERT_APP_KEY)
}
}
// 配置动态网关
HttpUrlManager.Companion.getInstance()?.addUrl(YDL_DOMAIN_LOGIN_BASE_URL, HttpConfig.JAVA_LOGIN_BASE_URL)
// 获取渠道
val channel = WalleChannelReader.getChannel(activity)
checkBoxHidden = !(channel=="huawei"||channel=="vivo")
checkBoxHidden = !(channel == "huawei" || channel == "vivo")
}
/**
......@@ -113,7 +117,7 @@ object OneKeyLoginHelp {
* @param isOpenDialog 是否是弹窗
*/
fun getLoginToken(isOpenDialog: Boolean) {
mIsFromGuide = isOpenDialog
mIsFromGuide = !isOpenDialog
mAuthType = PhoneNumberAuthHelper.SERVICE_TYPE_LOGIN
mPhoneNumberAuthHelper?.let {
if (!mIsGetTokenSuccess) {
......@@ -318,7 +322,6 @@ object OneKeyLoginHelp {
}
}
override fun onTokenFailed(s: String) {
......
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