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

import com.google.gson.internal.LinkedTreeMap
4 5 6 7 8
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.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse
9
import com.yidianling.user.api.bean.UserResponseBean
10
import com.yidianling.user.http.response.*
konghaorui committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24
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")
25
    fun login(@FieldMap params: Map<String, String>): Observable<BaseResponse<UserResponseBean>>
konghaorui committed
26 27 28 29

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

    //判断手机号是否存在
    @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")
45
    fun bindPhone(@FieldMap params: Map<String, String>): Observable<BaseResponse<UserResponseBean>>
konghaorui committed
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63

    //忘记密码
    @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
    @FormUrlEncoded
    @POST("user/set-channel-id")
    fun setChannelId(@FieldMap params: Map<String, String>): Observable<BaseResponse<LinkedTreeMap<String, String>>>

    //第三方登录
    @POST("user/user_q_w")
64
    @Headers( YDL_DOMAIN + YDL_DOMAIN_JAVA)
65
    fun thirdPartyLogin(@Body body: RequestBody): Observable<BaseAPIResponse<UserResponseBean>>
konghaorui committed
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 112 113

    //设置用户信息
    @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")
114
    @Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
konghaorui committed
115 116 117 118
    fun privacyAgree(@Query("uid") uid: String): Observable<BaseResponse<Any>>

    //检查手机号来源
    @GET("user/phone_detection")
119
    @Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
konghaorui committed
120 121 122 123 124 125 126 127
    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")
128
    @Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
129
    fun autoLogin(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>
konghaorui committed
130 131 132

    //手机号密码登录
    @POST("user/login_pwd")
133
    @Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
134
    fun loginByPassword(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>
konghaorui committed
135 136 137

    //重新设置密码
    @POST("user/reset_pwd")
138
    @Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
139
    fun resetPwd(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>
konghaorui committed
140 141 142

    //验证重置密码的短信验证码
    @GET("user/precheck_reset_sms")
143
    @Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
konghaorui committed
144 145 146 147
    fun checkResetCode(@Query("phone") phone: String, @Query("countryCode") countryCode: String, @Query("code") code: String): Observable<BaseResponse<Any>>

    //发送登录验证码
    @GET("user/send_login_sms")
148
    @Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
konghaorui committed
149 150 151 152
    fun sendLoginMsgCode(@Query("phone") phone: String, @Query("countryCode") countryCode: String): Observable<BaseResponse<Any>>

    //发送忘记密码重置密码的验证码
    @GET("user/send_reset_sms")
153
    @Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
konghaorui committed
154 155 156 157
    fun sendResetCode(@Query("phone") phone: String, @Query("countryCode") countryCode: String): Observable<BaseResponse<Any>>

    //绑定手机号
    @POST("user/bind_phone")
158
    @Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
konghaorui committed
159 160 161 162
    fun bindPhone(@Body body: RequestBody): Observable<BaseResponse<Any>>

    //验证码登录
    @POST("user/login_sms")
163
    @Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
164
    fun loginByMsgCode(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>
konghaorui committed
165 166 167

    //第三方登录获取用户信息
    @POST("user/user_q_w")
168
    @Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
169
    fun thirdPartJavaLogin(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>
konghaorui committed
170 171 172 173


    //第三方登录解绑
    @POST("user/unbind_third")
174
    @Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
konghaorui committed
175 176
    fun unBindThirdLogin(@Body body: RequestBody): Observable<BaseResponse<Any>>
}