Commit 02da5027 by 刘鹏

feat: 修复Im问题

parent 502bef1f
......@@ -10,7 +10,7 @@ ext {
"m-fm" : "0.0.30.03",
"m-user" : "0.0.61.31",
"m-home" : "0.0.22.61",
"m-im" : "0.0.18.54",
"m-im" : "0.0.18.55",
"m-dynamic" : "0.0.7.22",
"m-article" : "0.0.0.8",
......@@ -93,7 +93,7 @@ ext {
"m-fm" : "0.0.30.01",
"m-user" : "0.0.61.31",
"m-home" : "0.0.22.61",
"m-im" : "0.0.18.54",
"m-im" : "0.0.18.55",
"m-dynamic" : "0.0.7.22",
"m-article" : "0.0.0.6",
......
package com.yidianling.im.bean;
/**
* 加入黑名单
* Created by hgw on 2018/3/13.
*/
public class OrderBean {
public String id;
public OrderBean(String id) {
this.id = id;
}
}
\ No newline at end of file
package com.yidianling.im.bean;
/**
* 加入黑名单
* Created by hgw on 2018/3/13.
*/
public class OrderStatusBean {
public String id;
public String status;
public OrderStatusBean(String id, String status) {
this.id = id;
this.status = status;
}
}
\ No newline at end of file
......@@ -40,17 +40,17 @@ interface ImRetrofitApi {
//获取用户的状态(用户、专家、助理)
@GET("user/userType")
@Headers(YDL_DOMAIN+ YDL_DOMAIN_JAVA)
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getUserType(@Query("targetUid") uid: String): Observable<BaseResponse<UserTypeBean>>
//根据专家uid获取私聊的目标uid(有可能是专家uid,有可能是助理uid)
@GET("consult/assistant/chat-user")
@Headers(YDL_DOMAIN+ YDL_DOMAIN_JAVA)
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getChatUid(@Query("doctorUid") uid: String): Observable<BaseAPIResponse<DoctorAssistantRespDtoBean>>
//私聊 获取聊天者的订单关系数据 -----进入聊天前调用的接口,采用新的java接口,直接php getExpert 接口废弃
@GET("doctor/personalChat")
@Headers(YDL_DOMAIN+ YDL_DOMAIN_JAVA)
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getPersonalChat(@Query("doctorUid") doctorUid: String): Observable<BaseResponse<IMExpertBuild>>
//获取举报理由
......@@ -100,19 +100,23 @@ interface ImRetrofitApi {
* @return
*/
@GET("chat/pushServeStatus")
@Headers(YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun getPushConfideStatus(@Query("uid") uid: String, @Query("listenerUid") listenerUid: String): Observable<BaseAPIResponse<PushConfideStatusBean>>
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getPushConfideStatus(
@Query("uid") uid: String,
@Query("listenerUid") listenerUid: String
): Observable<BaseAPIResponse<PushConfideStatusBean>>
@POST("lingxi/asistant/buryRedPoint")
@Headers(YDL_DOMAIN+ YDL_DOMAIN_JAVA)
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun imBuryRedPoints(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>
/**确认订单 */
@POST("/counselor/order/standardOrderServiceOperation")
@Headers(YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun standardOrderServiceOperation(@Query("id")id: String, @Query("status")status: Int): Observable<BaseResponse<Any>>
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun standardOrderServiceOperation(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>
/**已完成订单*/
@POST("/consult/user/order/affirmComplete")
@Headers(YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun affirmComplete(@Query("id")id: String): Observable<BaseResponse<Any>>
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun affirmComplete(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>
}
\ No newline at end of file
......@@ -80,7 +80,7 @@ object ImIn {
* 获取专家主页url
*/
fun getExpertHost(): String {
return HttpConfig.H5_URL + "experts/"
return HttpConfig.MH5_URL + "jy/experts/"
}
fun getShareExpertHost(): String {
......
......@@ -18,6 +18,9 @@ public class CustomAttachConsultSubScript extends CustomAttachment {
private String FLAG = "flag";
private String URL = "url";
private String IS_PACKAGE = "isPackage";
private static final String NEWSORDERID = "newsOrderId";//用于跳转新版订单详情
private static final String STATUS = "status";//状态,1代表已确认,0代表待确认
public String title; //自定义消息标题
public String productName;//商品名称
......@@ -27,22 +30,14 @@ public class CustomAttachConsultSubScript extends CustomAttachment {
public String url;//跳转url
public int flag;//0 未确认 1已确认
public byte isPackage = 0; //是否套餐 1单次 2套餐
/***新订单*/
public String newsOrderId;
public int status;
public CustomAttachConsultSubScript() {
super(CustomAttachmentType.TYPE_CONSULT_SUBSCRIBE_SURE);
}
public CustomAttachConsultSubScript(String title, String productName, String consultDate, String consultTime, String consultType, String url, int flag) {
super(CustomAttachmentType.TYPE_CONSULT_SUBSCRIBE_SURE);
this.title = title;
this.productName = productName;
this.consultDate = consultDate;
this.consultTime = consultTime;
this.consultType = consultType;
this.url = url;
this.flag = flag;
}
@Override
protected void parseData(JSONObject data) {
title = data.getString(TITLE);
......@@ -53,6 +48,9 @@ public class CustomAttachConsultSubScript extends CustomAttachment {
url = data.getString(URL);
flag = data.getInteger(FLAG);
isPackage = data.getByte(IS_PACKAGE);
this.newsOrderId = data.getString(NEWSORDERID);
this.status = data.getInteger(STATUS);
}
@Override
......@@ -66,7 +64,8 @@ public class CustomAttachConsultSubScript extends CustomAttachment {
data.put(URL,url);
data.put(FLAG,flag);
data.put(IS_PACKAGE,isPackage);
data.put(NEWSORDERID, newsOrderId);
data.put(STATUS, status);
return data;
}
}
......@@ -11,6 +11,7 @@ public class CustomAttachmentConfirmOrder extends CustomAttachment {
private static final String NEWSORDERID = "newsOrderId";//用于跳转新版订单详情
private static final String URL = "url";//跳转链接
public String servicetype;
public String consultDuration;
public String bookingTime;
......@@ -36,6 +37,7 @@ public class CustomAttachmentConfirmOrder extends CustomAttachment {
this.orderId = data.getString(ORDERID);
this.newsOrderId = data.getString(NEWSORDERID);
this.url = data.getString(URL);
}
@Override
......
......@@ -9,16 +9,22 @@ public class CustomAttachmentOrderAlreadyDone extends CustomAttachment{
private String CONSULTDURATION="consultDuration";//购买时长
private String SERVICETYPE="serviceType"; //服务方式
private String ORDERID="orderId";//订单号
private static final String BOOKINGTIME = "bookingTime";///咨询时间
private static final String URL = "url";//跳转链接
private static final String NEWSORDERID = "newsOrderId";//用于跳转新版订单详情
public String newsOrderId;
public String title;
public String status;
public int status;
public String consultDuration;
public String serviceType;
public String orderId;
public String bookingTime;
public String url;
CustomAttachmentOrderAlreadyDone() {
super(CustomAttachmentType.TYPE_ORDER_ALREADY_DONE);
......@@ -27,10 +33,13 @@ public class CustomAttachmentOrderAlreadyDone extends CustomAttachment{
@Override
protected void parseData(JSONObject data) {
title = data.getString(TITLE);
status = data.getString(STATUS);
status = data.getInteger(STATUS);
consultDuration = data.getString(CONSULTDURATION);
serviceType = data.getString(SERVICETYPE);
orderId = data.getString(ORDERID);
this.bookingTime = data.getString(BOOKINGTIME);
this.url = data.getString(URL);
this.newsOrderId = data.getString(NEWSORDERID);
}
@Override
......@@ -41,6 +50,9 @@ public class CustomAttachmentOrderAlreadyDone extends CustomAttachment{
data.put(CONSULTDURATION, consultDuration);
data.put(SERVICETYPE, serviceType);
data.put(ORDERID, orderId);
data.put(BOOKINGTIME, bookingTime);
data.put(URL, url);
data.put(NEWSORDERID, newsOrderId);
return data;
}
}
......@@ -8,6 +8,7 @@ import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.google.gson.Gson;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.RequestCallback;
import com.netease.nimlib.sdk.msg.MsgService;
......@@ -17,9 +18,10 @@ import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;
import com.ydl.ydlcommon.data.http.RxUtils;
import com.ydl.ydlcommon.utils.remind.HttpErrorUtils;
import com.yidianling.common.tools.LogUtil;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R;
import com.yidianling.im.bean.OrderStatusBean;
import com.yidianling.im.config.constants.ImConstants;
import com.yidianling.im.http.ImRetrofitApi;
import com.yidianling.im.session.extension.CustomAttachmentConfirmOrder;
......@@ -31,8 +33,14 @@ import java.util.List;
import java.util.Map;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType;
import okhttp3.RequestBody;
/**
* 确认订单
*/
public class MsgViewHolderConfirmOrder extends MsgViewHolderBase {
private TextView tv_title, tv_date, tv_type, tv_submit;
......@@ -87,8 +95,8 @@ public class MsgViewHolderConfirmOrder extends MsgViewHolderBase {
if (attachment instanceof CustomAttachmentConfirmOrder) {
CustomAttachmentConfirmOrder customAttachment = (CustomAttachmentConfirmOrder) attachment;
tv_title.setText(customAttachment.title);
tv_date.setText("咨询时间:" + customAttachment.bookingTime);
tv_type.setText("服务方式:" + customAttachment.servicetype);
tv_date.setText(customAttachment.bookingTime == null ? "" : customAttachment.bookingTime);
tv_type.setText(customAttachment.servicetype == null ? "" : customAttachment.servicetype);
url = customAttachment.url;
newsOrderId = customAttachment.newsOrderId;
orderId = customAttachment.orderId;
......@@ -114,14 +122,19 @@ public class MsgViewHolderConfirmOrder extends MsgViewHolderBase {
//确认接口
ToastUtil.toastShort(context, "发送中...");
ImRetrofitApi.Companion.getImRetrofitApi().standardOrderServiceOperation(orderId, flag)
String str = new Gson().toJson(new OrderStatusBean(orderId, String.valueOf(flag)));
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str);
Disposable subscribe = ImRetrofitApi.Companion.getImRetrofitApi().standardOrderServiceOperation(body)
.compose(RxUtils.INSTANCE.resultJavaData())
.subscribeOn(Schedulers.io())
.compose(RxUtils.INSTANCE.resultData())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(it -> {
//确认完成,按钮置灰,更新本地消息
updateLocalMsg();
}, throwable -> HttpErrorUtils.Companion.handleError(context, throwable));
//确认完成,按钮置灰,更新本地消息
updateLocalMsg();
}, throwable ->
LogUtil.e(throwable.getMessage())
);
});
......@@ -132,7 +145,7 @@ public class MsgViewHolderConfirmOrder extends MsgViewHolderBase {
@Override
protected void onItemClick() {
if (TextUtils.isEmpty(url)) {
if (TextUtils.isEmpty(url) && newsOrderId == null) {
return;
}
......
......@@ -10,6 +10,7 @@ import com.netease.nimlib.sdk.msg.attachment.MsgAttachment;
import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;
import com.yidianling.im.R;
import com.yidianling.im.config.constants.ImConstants;
import com.yidianling.im.session.extension.CustomAttachConsultSubScript;
import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase;
......@@ -33,7 +34,8 @@ public class MsgViewHolderConsultSubScribe extends MsgViewHolderBase {
public String url;//跳转url
public int flag;//0 未确认 1已确认
public byte isPackage;
/***新订单id*/
public String newsOrderId;
public MsgViewHolderConsultSubScribe(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
......@@ -111,9 +113,17 @@ public class MsgViewHolderConsultSubScribe extends MsgViewHolderBase {
@Override
protected void onItemClick() {
if (TextUtils.isEmpty(url)){
if (TextUtils.isEmpty(url)&& newsOrderId == null){
return;
}
NewH5Activity.start(context,new H5Params(url,null));
if (newsOrderId == null || newsOrderId.isEmpty()) {
NewH5Activity.start(context, new H5Params(url, null));
} else {
//跳转新订单详情页
H5Params orderParams = new H5Params(
ImConstants.Companion.getORDER_DETAIL() + (newsOrderId.isEmpty() ? "" : newsOrderId), null);
NewH5Activity.start(context, orderParams);
}
}
}
......@@ -8,6 +8,7 @@ import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.google.gson.Gson;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.RequestCallback;
import com.netease.nimlib.sdk.msg.MsgService;
......@@ -17,12 +18,14 @@ import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;
import com.ydl.ydlcommon.data.http.RxUtils;
import com.ydl.ydlcommon.utils.remind.HttpErrorUtils;
import com.yidianling.common.tools.LogUtil;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R;
import com.yidianling.im.bean.OrderBean;
import com.yidianling.im.config.constants.ImConstants;
import com.yidianling.im.http.ImRetrofitApi;
import com.yidianling.im.session.extension.CustomAttachmentConfirmOrder;
import com.yidianling.im.session.extension.CustomAttachmentOrderAlreadyDone;
import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase;
......@@ -31,8 +34,14 @@ import java.util.List;
import java.util.Map;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType;
import okhttp3.RequestBody;
/**
* 已完成订单
*/
public class MsgViewHolderOrderAlreadyDone extends MsgViewHolderBase {
private TextView tv_title, tv_date, tv_type, tv_submit;
......@@ -85,11 +94,11 @@ public class MsgViewHolderOrderAlreadyDone extends MsgViewHolderBase {
}
MsgAttachment attachment = message.getAttachment();
if (attachment instanceof CustomAttachmentConfirmOrder) {
CustomAttachmentConfirmOrder customAttachment = (CustomAttachmentConfirmOrder) attachment;
if (attachment instanceof CustomAttachmentOrderAlreadyDone) {
CustomAttachmentOrderAlreadyDone customAttachment = (CustomAttachmentOrderAlreadyDone) attachment;
tv_title.setText(customAttachment.title);
tv_date.setText("咨询时间:" + (customAttachment.bookingTime));
tv_type.setText("服务方式:" + (customAttachment.servicetype));
tv_date.setText(customAttachment.consultDuration == null ? "" : customAttachment.consultDuration);
tv_type.setText(customAttachment.serviceType == null ? "" : customAttachment.serviceType);
url = customAttachment.url;
newsOrderId = customAttachment.newsOrderId;
orderId = customAttachment.orderId;
......@@ -116,14 +125,20 @@ public class MsgViewHolderOrderAlreadyDone extends MsgViewHolderBase {
//确认接口
ToastUtil.toastShort(context, "发送中...");
ImRetrofitApi.Companion.getImRetrofitApi().affirmComplete(orderId)
String str = new Gson().toJson(new OrderBean(orderId));
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str);
Disposable subscribe = ImRetrofitApi.Companion.getImRetrofitApi().affirmComplete(body)
.compose(RxUtils.INSTANCE.resultJavaData())
.subscribeOn(Schedulers.io())
.compose(RxUtils.INSTANCE.resultData())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(it -> {
//确认完成,按钮置灰,更新本地消息
updateLocalMsg();
}, throwable -> HttpErrorUtils.Companion.handleError(context, throwable));
}, throwable ->
LogUtil.e(throwable.getMessage())
);
});
}
......@@ -132,7 +147,7 @@ public class MsgViewHolderOrderAlreadyDone extends MsgViewHolderBase {
@Override
protected void onItemClick() {
if (TextUtils.isEmpty(url)) {
if (TextUtils.isEmpty(url) && newsOrderId == null) {
return;
}
if (newsOrderId == null || newsOrderId.isEmpty()) {
......
......@@ -276,6 +276,12 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
handler.setUserType(expertInfo.shareData.user_type);
initView();
});
if (!UserPreferences.isEarPhoneModeEnable()) {
titleBar.setTitleLeftDraw(null);
} else {
titleBar.setTitleRightDraw(getResources().getDrawable(R.drawable.im_erduoxiaolv));
}
titleBar.setTitle(ActionHandlerStorage.getL(sessionId).getInfo().name);
} else {
initView();
}
......
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