1:修改在帮助中,使用平台的客服功能,如果对方是客服,自己不用充值可以聊天

This commit is contained in:
2026-01-14 19:14:30 +08:00
parent d7a27baf5c
commit f82e5c8348
11 changed files with 191 additions and 69 deletions

View File

@@ -36,6 +36,7 @@ import com.tencent.qcloud.tuicore.TUICore;
import com.tencent.qcloud.tuicore.interfaces.TUIExtensionEventListener;
import com.tencent.qcloud.tuicore.interfaces.TUIExtensionInfo;
import com.tencent.qcloud.tuicore.interfaces.TUIValueCallback;
import com.tencent.qcloud.tuicore.util.SPUtils;
import com.tencent.qcloud.tuicore.util.ToastUtil;
import com.tencent.qcloud.tuikit.timcommon.bean.ChatFace;
import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
@@ -71,6 +72,10 @@ import com.tencent.qcloud.tuikit.tuichat.util.ChatMessageBuilder;
import com.tencent.qcloud.tuikit.tuichat.util.ChatMessageParser;
import com.tencent.qcloud.tuikit.tuichat.util.TUIChatLog;
import com.tencent.qcloud.tuikit.tuichat.util.TUIChatUtils;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -253,6 +258,7 @@ public class InputView extends LinearLayout implements View.OnClickListener, Tex
this.can_chat_money = can_chat_money;
}
}
private userInd getUserInfo(){
SharedPreferences sp = getContext().getSharedPreferences("Vespa", Context.MODE_PRIVATE);
String s= sp.getString("userInfo","");
@@ -268,7 +274,20 @@ public class InputView extends LinearLayout implements View.OnClickListener, Tex
private boolean isChock(){
userInd userInfo = getUserInfo();
if (userInfo != null && mChatInfo.getType()==1) {
String userId="";
SharedPreferences sp = getContext().getSharedPreferences("Vespa", Context.MODE_PRIVATE);
try {
String s = sp.getString("appCustomerBean", "");
if (!s.isEmpty()) {
JSONObject jsonObject = new JSONObject(s);
userId = jsonObject.optString("user_id", ""); // 如果user_id不存在返回空字符串
// 使用userId...
}
} catch (JSONException e) {
e.printStackTrace();
}
if (userInfo != null && mChatInfo.getType()==1 && !mChatInfo.getId().equals("u"+userId) ) {
if (userInfo.getIs_can_chat() == 0 && userInfo.getCan_chat_money() > 0) {
Toast.makeText(getContext(), "充值不足"+userInfo.getCan_chat_money()+"元,您无法发送消息", Toast.LENGTH_LONG).show();
ARouter.getInstance().build("/modulevocal/RechargeActivity").navigation();