UserApi.kt 8.61 KB
Newer Older
1
package com.yidianling.user.http
konghaorui committed
2 3

import com.google.gson.internal.LinkedTreeMap
YKai committed
4
import com.ydl.ydlcommon.base.config.*
5 6
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse
7
import com.yidianling.user.api.bean.UserResponseBean
徐健 committed
8
import com.yidianling.user.bean.CollectFocusItemBean
9
import com.yidianling.user.http.LoginApiRequestUtil.Companion.LOGIN_USER_PORT
10
import com.yidianling.user.http.response.*
konghaorui committed
11
import com.yidianling.user.mine.bean.RedPacketId
konghaorui committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25
import io.reactivex.Observable
import okhttp3.RequestBody
import retrofit2.http.*

/**
 * author : Zhangwenchao
 * e-mail : zhangwch@yidianling.com
 * time   : 2018/02/02
 */
interface UserApi {

    //登录
    @FormUrlEncoded
    @POST("user/user")
26
    fun login(@FieldMap params: Map<String, String>): Observable<BaseResponse<UserResponseBean>>
konghaorui committed
27 28 29 30

    //国家列表
    @FormUrlEncoded
    @POST("user/country-list")
31
    fun countryList(@Field(YDLConstants.HOLDER_PARAM ) params: String): Observable<BaseResponse<CountryResponse>>
konghaorui committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45

    //判断手机号是否存在
    @FormUrlEncoded
    @POST("user/phone-exist")
    fun phoneExists(@FieldMap params: Map<String, String>): Observable<BaseResponse<ExistResponse>>

    //获取验证码
    @FormUrlEncoded
    @POST("user/chk-code")
    fun getCode(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>

    //绑定手机号
    @FormUrlEncoded
    @POST("user/bind-phone")
46
    fun bindPhone(@FieldMap params: Map<String, String>): Observable<BaseResponse<UserResponseBean>>
konghaorui committed
47 48 49 50 51 52 53 54 55 56 57 58

    //忘记密码
    @FormUrlEncoded
    @POST("user/forget")
    fun forget(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>

    //注册
    @FormUrlEncoded
    @POST("user/reg")
    fun register(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>

    //设置推送的channelId
严久程 committed
59 60 61
    @POST("user/device/modify")
    @Headers( YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun setChannelId(@Body body: RequestBody): Observable<BaseResponse<LinkedTreeMap<String, String>>>
konghaorui committed
62

63

konghaorui committed
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111

    //设置用户信息
    @FormUrlEncoded
    @POST("user/set-info")
    fun setUserInfo(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>

    //上传头像
    @Multipart
    @POST("user/set-info")
    fun uploadHeadImg(@PartMap params: MutableMap<String, RequestBody>): Observable<BaseResponse<Any>>

    //上传头像
    @Multipart
    @POST("user/set-info")
    fun uploadHeadImg(@Part("type") param: RequestBody): Observable<BaseResponse<Any>>

    //验证账号密码
    @FormUrlEncoded
    @POST("user/chkin-pass")
    fun checkPhonePass(@FieldMap params: Map<String, String>): Observable<BaseResponse<CheckPassword>>

    //绑定QQ
    @FormUrlEncoded
    @POST("user/bind-qq")
    fun bindQQ(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>

    //绑定微信
    @FormUrlEncoded
    @POST("user/bind-wx")
    fun bindWx(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>

    //登出
    @FormUrlEncoded
    @POST("user/logout")
    fun logout(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>

    //更换手机时密码验证
    @FormUrlEncoded
    @POST("user/confirm-pwd")
    fun checkPwd(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>

    //更换手机时最后校验验证码和手机
    @FormUrlEncoded
    @POST("user/replace-mob")
    fun changePhone(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>

    //同意隐私政策接口
    @GET("user/agreePrivacyAgreement")
112
    @Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
konghaorui committed
113 114
    fun privacyAgree(@Query("uid") uid: String): Observable<BaseResponse<Any>>

115

konghaorui committed
116 117 118 119
    //服务端校验阿里一键认证
    @POST("phone/verification/init")
    fun checkAliAuth(@Body body: RequestBody): Observable<BaseResponse<PhoneAuthResponseBean>>

konghaorui committed
120

徐健 committed
121
    //获取隐私政策数据
霍志良 committed
122
    @GET("config/queryConfigVaule?configKey=user_privacy_content")
霍志良 committed
123
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
霍志良 committed
124
    fun getSecretJavaData(): Observable<BaseResponse<String>>
konghaorui committed
125 126 127 128 129

    //获取红包单号
    @FormUrlEncoded
    @POST("uc/ready-bonus")
    fun getRedPacketId(@FieldMap params: Map<String, String>): Observable<BaseResponse<RedPacketId>>
130

徐健 committed
131 132 133

    //上传用户信息数据接口
    @POST("user/collect/submit")
霍志良 committed
134
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
徐健 committed
135 136 137 138 139 140 141 142
    fun uploadUserInfo(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>

    //获取关注问题数据接口
    @GET("cate/list-parentId")
    @Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
    fun getFocusData(@Query("parentId") parentId: String = "0"): Observable<BaseAPIResponse<List<CollectFocusItemBean>>>

    //获取新用户引导页面url
徐健 committed
143
    @FormUrlEncoded
徐健 committed
144 145
    @POST("user/getNewUserJumpUrl")
    @Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
146
    fun getNewUserJumpUrl(@FieldMap params: Map<String, String>): Observable<BaseAPIResponse<String>> //获取新用户引导页面url
147

YKai committed
148 149 150 151
    //第三方登录获取用户信息
    @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>>
152 153 154 155

    /**
     * 绑定手机号
     */
YKai committed
156
    @POST("login/v2/bind_phone")
YKai committed
157
    @Headers(YDL_DOMAIN+ YDL_DOMAIN_LOGIN_BASE_URL, LOGIN_USER_PORT)
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
    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)
194
    fun checkPhoneStatus(@Query("phone") phone: String, @Query("countryCode") countryCode: String): Observable<BaseResponse<ChcekPhoneResponeBean>>
195 196 197 198 199 200 201 202 203 204 205

    /**
     * 验证重置密码的短信验证码
     */
    @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>>

    /**
     * 重置密码
     */
YKai committed
206
    @POST("login/v2/reset_pwd")
YKai committed
207
    @Headers( YDL_DOMAIN+ YDL_DOMAIN_LOGIN_BASE_URL, LOGIN_USER_PORT)
208 209 210 211 212
    fun resetPwd(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>

    /**
     * 发送登录验证码
     */
YKai committed
213
    @GET("login/v2/send_login_sms")
YKai committed
214
    @Headers( YDL_DOMAIN+ YDL_DOMAIN_LOGIN_BASE_URL, LOGIN_USER_PORT)
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
    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>>
230 231

    /**
刘鹏 committed
232
     * 用户注销账号(原有禁止登录逻辑)
233
     */
234 235 236 237
    @FormUrlEncoded
    @POST("user/forbid_login")
    @Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
    fun userForbidLogin(@FieldMap params: Map<String, String>): Observable<BaseAPIResponse<Boolean>>
238

刘鹏 committed
239 240 241 242 243 244 245 246 247

 /**
     * 用户注销账号
     */
    @FormUrlEncoded
    @POST("login/v2/accountLogOff")
    @Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
    fun accountLogOff(@FieldMap params: Map<String, String>): Observable<BaseAPIResponse<Boolean>>

248 249 250 251 252 253
    /**
     * 是否需要强绑定手机号
     */
    @POST("login/v2/is_need_strong_bind")
    @Headers( YDL_DOMAIN+ YDL_DOMAIN_LOGIN_BASE_URL, LOGIN_USER_PORT)
    fun isNeedForceBindPhone(@Body map: Map<String,String>): Observable<BaseAPIResponse<Boolean>>
konghaorui committed
254
}