1:修改在帮助中,使用平台的客服功能,如果对方是客服,自己不用充值可以聊天
This commit is contained in:
@@ -34,6 +34,7 @@ import com.tencent.mm.opensdk.modelbiz.WXOpenCustomerServiceChat;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
|
||||
import com.tencent.qcloud.tuicore.TUIConstants;
|
||||
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIC2CChatActivity;
|
||||
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIGroupChatActivity;
|
||||
import com.xscm.modulemain.BaseMvpActivity;
|
||||
import com.xscm.modulemain.R;
|
||||
@@ -43,6 +44,7 @@ import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.base.WebUrlConstants;
|
||||
import com.xscm.moduleutil.bean.AppCustomerBean;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
|
||||
@@ -393,15 +395,25 @@ public class WebViewActivity extends BaseMvpActivity<IPresenter,ActivityWebViewB
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void customerService() {
|
||||
String appId = CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId(); // 填移动应用(App)的 AppId
|
||||
IWXAPI api = WXAPIFactory.createWXAPI(mContext, appId);
|
||||
|
||||
// 判断当前版本是否支持拉起客服会话
|
||||
WXOpenCustomerServiceChat.Req req = new WXOpenCustomerServiceChat.Req();
|
||||
req.corpId = "ww1de4300858c0b461"; // 企业ID
|
||||
req.url = "https://work.weixin.qq.com/kfid/kfcb3d23a59c188a0e7"; // 客服URL
|
||||
api.sendReq(req);
|
||||
public void customerService(String user_id, String nickname) {
|
||||
// TODO: 2026/1/14 客服,今天更改成使用下面的,使用本程序中的用户,让进行私聊
|
||||
// String appId = CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId(); // 填移动应用(App)的 AppId
|
||||
// IWXAPI api = WXAPIFactory.createWXAPI(mContext, appId);
|
||||
//
|
||||
//// 判断当前版本是否支持拉起客服会话
|
||||
// WXOpenCustomerServiceChat.Req req = new WXOpenCustomerServiceChat.Req();
|
||||
// req.corpId = "ww1de4300858c0b461"; // 企业ID
|
||||
// req.url = "https://work.weixin.qq.com/kfid/kfcb3d23a59c188a0e7"; // 客服URL
|
||||
// api.sendReq(req);
|
||||
AppCustomerBean appCustomerBean = new AppCustomerBean();
|
||||
appCustomerBean.setUser_id(user_id);
|
||||
appCustomerBean.setUser_name(nickname);
|
||||
SpUtil.setAppCustomerBean(appCustomerBean);
|
||||
Intent intent = new Intent(mContext, TUIC2CChatActivity.class);
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, "u"+user_id);
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_NAME, nickname);
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
|
||||
@@ -18,6 +18,7 @@ public class NewsContacts {
|
||||
void getOfficialNotice();
|
||||
void getMyInfo();
|
||||
|
||||
void appCustomerService();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.xscm.modulemain.activity.msg.fragment;
|
||||
|
||||
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.text.Html;
|
||||
import android.view.View;
|
||||
@@ -50,6 +52,7 @@ public class NewsFragment extends BaseMvpFragment<NewsPresenter, FragmentNewsBin
|
||||
super.onResume();
|
||||
MvpPre.getOfficialNotice();
|
||||
MvpPre.getMyInfo();
|
||||
MvpPre.appCustomerService();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,6 +61,7 @@ public class NewsFragment extends BaseMvpFragment<NewsPresenter, FragmentNewsBin
|
||||
if (!hidden){
|
||||
MvpPre.getOfficialNotice();
|
||||
MvpPre.getMyInfo();
|
||||
MvpPre.appCustomerService();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,11 +148,13 @@ public class NewsFragment extends BaseMvpFragment<NewsPresenter, FragmentNewsBin
|
||||
mBinding.tvXtNr.setText("");
|
||||
}
|
||||
if (newsDataBeans.getSystem_no_read_count()>0) {
|
||||
mBinding.tvXtCount.setVisibility(VISIBLE);
|
||||
mBinding.tvXtCount.setText(newsDataBeans.getSystem_no_read_count()+"");
|
||||
}else {
|
||||
mBinding.tvXtCount.setVisibility(View.GONE);
|
||||
}
|
||||
if (newsDataBeans.getAnnouncement_read_count()>0) {
|
||||
mBinding.tvOfficialCount.setVisibility(VISIBLE);
|
||||
mBinding.tvOfficialCount.setText(newsDataBeans.getAnnouncement_read_count()+"");
|
||||
}else {
|
||||
mBinding.tvOfficialCount.setVisibility(View.GONE);
|
||||
|
||||
@@ -3,16 +3,24 @@ package com.xscm.modulemain.activity.msg.presenter;
|
||||
import android.content.Context;
|
||||
|
||||
import com.xscm.modulemain.activity.msg.contacts.NewsContacts;
|
||||
import com.xscm.moduleutil.bean.AppCustomerBean;
|
||||
import com.xscm.moduleutil.bean.NewsDataBean;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class NewsPresenter extends BasePresenter<NewsContacts.View> implements NewsContacts.IHomePre {
|
||||
|
||||
private NewsContacts.View mView;
|
||||
|
||||
public NewsPresenter(NewsContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
mView = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -25,6 +33,9 @@ public class NewsPresenter extends BasePresenter<NewsContacts.View> implements N
|
||||
|
||||
@Override
|
||||
public void onNext(NewsDataBean newsDataBeans) {
|
||||
if (MvpRef == null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().getOfficialNoticeList(newsDataBeans);
|
||||
}
|
||||
});
|
||||
@@ -40,8 +51,27 @@ public class NewsPresenter extends BasePresenter<NewsContacts.View> implements N
|
||||
|
||||
@Override
|
||||
public void onNext(UserInfo userInfo) {
|
||||
if (MvpRef == null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().myInfoSuccess(userInfo);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appCustomerService() {
|
||||
api.appCustomerService(new BaseObserver<AppCustomerBean>(){
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(AppCustomerBean appCustomerBean) {
|
||||
SpUtil.setAppCustomerBean(appCustomerBean);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,65 +43,6 @@
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_official"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_62"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_gg"
|
||||
android:layout_width="@dimen/dp_50"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
android:src="@mipmap/gg" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_gfgg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_toEndOf="@+id/im_gg"
|
||||
android:text="官方公告"
|
||||
android:textColor="@color/color_FF333333"
|
||||
android:textSize="@dimen/sp_16" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_nr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/tv_gfgg"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_toEndOf="@+id/im_gg"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
tools:text="Chat with your friends"
|
||||
android:textColor="@color/color_FF666666"
|
||||
android:textSize="@dimen/sp_12" />
|
||||
|
||||
<com.tencent.qcloud.tuikit.timcommon.component.UnreadCountTextView
|
||||
android:id="@+id/tv_official_count"
|
||||
android:layout_width="@dimen/dp_15"
|
||||
android:layout_height="@dimen/dp_15"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
tools:text="1"
|
||||
android:textColor="@color/white" />
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/view_line"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/conversation_list_divide_line_height"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@color/conversation_divide_line_color"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_system"
|
||||
android:layout_width="match_parent"
|
||||
@@ -152,6 +93,67 @@
|
||||
android:textColor="@color/white" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
<View
|
||||
android:id="@+id/view_line"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/conversation_list_divide_line_height"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@color/conversation_divide_line_color"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_official"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_62"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_gg"
|
||||
android:layout_width="@dimen/dp_50"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
android:src="@mipmap/gg" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_gfgg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_toEndOf="@+id/im_gg"
|
||||
android:text="官方公告"
|
||||
android:textColor="@color/color_FF333333"
|
||||
android:textSize="@dimen/sp_16" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_nr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/tv_gfgg"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_toEndOf="@+id/im_gg"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
tools:text="Chat with your friends"
|
||||
android:textColor="@color/color_FF666666"
|
||||
android:textSize="@dimen/sp_12" />
|
||||
|
||||
<com.tencent.qcloud.tuikit.timcommon.component.UnreadCountTextView
|
||||
android:id="@+id/tv_official_count"
|
||||
android:layout_width="@dimen/dp_15"
|
||||
android:layout_height="@dimen/dp_15"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
tools:text="1"
|
||||
android:textColor="@color/white" />
|
||||
</RelativeLayout>
|
||||
|
||||
<com.xscm.moduleutil.widget.ScrollViewPager
|
||||
android:id="@+id/view_pager"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
Reference in New Issue
Block a user