ImRetrofitApi.kt 6.34 KB
Newer Older
konghaorui committed
1 2 3 4 5 6 7
package com.yidianling.im.http

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
import com.ydl.ydlnet.YDLHttpUtils
konghaorui committed
8
import com.yidianling.im.api.bean.IMExpertBuild
严久程 committed
9
import com.yidianling.im.bean.*
konghaorui committed
10
import io.reactivex.Observable
11
import okhttp3.RequestBody
konghaorui committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
import retrofit2.http.*

/**
 * im相关网络接口
 * Created by hrvie on 17-11-24.
 */
interface ImRetrofitApi {

    companion object {
        var instance: ImRetrofitApi? = null

        fun getImRetrofitApi(): ImRetrofitApi {
            if (instance == null) {
                instance = YDLHttpUtils.obtainApi(ImRetrofitApi::class.java)
            }
            return instance!!
        }

        fun getImJavaApi(): ImRetrofitApi {
            return YDLHttpUtils.obtainApi(ImRetrofitApi::class.java)
        }
    }

    //私聊 获取聊天者的订单关系数据
    @FormUrlEncoded
    @POST("consult/get-expert")
    fun getExpert(@FieldMap params: Map<String, String>): Observable<BaseResponse<IMExpertBuild>>

40 41 42 43 44
    //群聊 群聊Ait艾特符号已读
    @POST("message/chatRoom/readApnsMessage")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun teamChatALreadyRead(@Body params: Map<String, String>): Observable<BaseResponse<Any>>

konghaorui committed
45 46 47

    //获取用户的状态(用户、专家、助理)
    @GET("user/userType")
刘鹏 committed
48
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
严久程 committed
49
    fun getUserType(@Query("targetUid") uid: String): Observable<BaseResponse<UserTypeBean>>
konghaorui committed
50 51

    //根据专家uid获取私聊的目标uid(有可能是专家uid,有可能是助理uid)
徐健 committed
52
    @GET("consult/assistant/chat-user")
刘鹏 committed
53
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
konghaorui committed
54 55 56 57
    fun getChatUid(@Query("doctorUid") uid: String): Observable<BaseAPIResponse<DoctorAssistantRespDtoBean>>

    //私聊 获取聊天者的订单关系数据   -----进入聊天前调用的接口,采用新的java接口,直接php  getExpert 接口废弃
    @GET("doctor/personalChat")
刘鹏 committed
58
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
konghaorui committed
59 60 61 62 63 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
    fun getPersonalChat(@Query("doctorUid") doctorUid: String): Observable<BaseResponse<IMExpertBuild>>

    //获取举报理由
    @FormUrlEncoded
    @POST("ask/report-reason")
    fun getReportReason(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>

    //举报心事或者心事回复(动态)
    @FormUrlEncoded
    @POST("ask/report")
    fun reportWorry(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>

    //删除私聊记录
    @FormUrlEncoded
    @POST("consult/rm-history")
    fun rmHistory(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>

    //加入黑名单
    @FormUrlEncoded
    @POST("consult/set-black")
    fun setBlackCall(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>

    //从黑名单移除
    @FormUrlEncoded
    @POST("consult/rm-black")
    fun rmBlackCall(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>

    //红包详情
    @FormUrlEncoded
    @POST("uc/bonus-info")
    fun redPacketDetail(@FieldMap params: Map<String, String>): Observable<BaseResponse<RedPacketDetailBean>>

    //设置课程直播状态
    @POST("course/set-live-status")
    @FormUrlEncoded
    fun setCourseStatus(@FieldMap maps: Map<String, String>): Observable<BaseResponse<Any>>

    //获取课程直播状态
    @POST("course/get-live-status")
    @FormUrlEncoded
    fun getCourseStatus(@FieldMap maps: Map<String, String>): Observable<BaseResponse<CourseStatusBean>>

    /**
     * 私聊更多按钮 - 推荐倾诉 - by :洪平
     * @param uid
     * @param listenerUid
     * @return
     */
    @GET("chat/pushServeStatus")
刘鹏 committed
108 109 110 111 112
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun getPushConfideStatus(
        @Query("uid") uid: String,
        @Query("listenerUid") listenerUid: String
    ): Observable<BaseAPIResponse<PushConfideStatusBean>>
konghaorui committed
113

114
    @POST("lingxi/asistant/buryRedPoint")
刘鹏 committed
115
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
116
    fun imBuryRedPoints(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>
117

刘鹏 committed
118
    /**确认订单 */
119
    @POST("counselor/order/standardOrderServiceOperation")
刘鹏 committed
120 121
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun standardOrderServiceOperation(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>
122

刘鹏 committed
123
    /**已完成订单*/
刘鹏 committed
124
    @GET("consult/user/order/affirmComplete")
刘鹏 committed
125
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
126
    fun affirmComplete(@Query("id") orderId: String): Observable<BaseAPIResponse<Any>>
127 128 129 130 131

    //回答问题接口
    @POST("chat/sendCustomizeMessage")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun lingxiAnswerQuestion(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>
132

133 134 135 136 137
    //回答问题接口批量发送
    @POST("chat/batchSendCustomizeMessage")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun batchSendCustomizeMessage(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>

138 139 140 141
    //发送通知接口
    @POST("chat/sendNoticeMessage")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun lingxiSendNotice(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>
刘鹏 committed
142 143 144 145 146


    /**已完成订单*/
    @GET("systemconfig/getSystemConfigByKeyword")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
147
    fun getSystemConfigByKeyword(@Query("keyword") keyword: String): Observable<BaseAPIResponse<SystemConfigByKeywordBean>>
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163

    //获取咨询助理uid
    /*
    * location字段说明(sign1存储页面位置,1:首页导医入口进入2:M站入口进入3:问答列表页进入4:我的入口进入
    * 5:情绪疏导在线咨询入口进入6:咨询列表页导医入口进入7:实用心理课入口进入8:实用心理课课程列表页进入9:测评解读页进入
    * 10:搜索页面进入11:首页咨询列表进入12:厌学的真相在线咨询入口,0是小壹意向客户传0)
    *
    * ffrom_2   亲子教育添加字段
    *naviType = "1";导医配置开关,返100跳转咨询tab,如果返其他则维持原有逻辑。
    * */

    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json")
    @GET("consult/assistant/chat-distribute")
    fun getConsultAssistantUidRequest(
        @Query("location") location: Int,
        @Query("ffrom_2") ffrom: String?,
164 165 166
        @Query("naviType") naviType: String = "1",
        @Query("examId") examId: String = "",
        @Query("questionPaperId") questionPaperId: String = ""
167
    ): Observable<BaseAPIResponse<Long>>
konghaorui committed
168
}