diff --git a/common/src/main/java/com/yunbao/common/bean/NoviceInstructorModel.java b/common/src/main/java/com/yunbao/common/bean/NoviceInstructorModel.java index 26f4c60bb..549b59f61 100644 --- a/common/src/main/java/com/yunbao/common/bean/NoviceInstructorModel.java +++ b/common/src/main/java/com/yunbao/common/bean/NoviceInstructorModel.java @@ -8,6 +8,39 @@ import com.google.gson.annotations.SerializedName; public class NoviceInstructorModel extends BaseModel { @SerializedName("sendFirstMessage") private String sendFirstMessage = ""; + @SerializedName("msg_zdy_send") + private String msgZdySend = ""; + @SerializedName("msg_zdy_send_text") + private String msgZdySendText = ""; + @SerializedName("home_zdy_pop") + private String homeZdyPop = ""; + + public String getMsgZdySend() { + return msgZdySend; + } + + public NoviceInstructorModel setMsgZdySend(String msgZdySend) { + this.msgZdySend = msgZdySend; + return this; + } + + public String getMsgZdySendText() { + return msgZdySendText; + } + + public NoviceInstructorModel setMsgZdySendText(String msgZdySendText) { + this.msgZdySendText = msgZdySendText; + return this; + } + + public String getHomeZdyPop() { + return homeZdyPop; + } + + public NoviceInstructorModel setHomeZdyPop(String homeZdyPop) { + this.homeZdyPop = homeZdyPop; + return this; + } public String getSendFirstMessage() { return sendFirstMessage; diff --git a/common/src/main/java/com/yunbao/common/manager/NoviceInstructorManager.java b/common/src/main/java/com/yunbao/common/manager/NoviceInstructorManager.java index eb8b2a60f..2681961b2 100644 --- a/common/src/main/java/com/yunbao/common/manager/NoviceInstructorManager.java +++ b/common/src/main/java/com/yunbao/common/manager/NoviceInstructorManager.java @@ -6,8 +6,11 @@ import android.os.Handler; import androidx.annotation.NonNull; import com.google.gson.Gson; +import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.NoviceInstructorModel; import com.yunbao.common.event.NoviceInstructorEvent; +import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.HttpClient; import com.yunbao.common.manager.base.BaseCacheManager; import org.greenrobot.eventbus.EventBus; @@ -48,8 +51,8 @@ public class NoviceInstructorManager extends BaseCacheManager { */ public NoviceInstructorModel getNoviceInstructor() { if (null == model) { - model = new Gson().fromJson( - getString(KEY_NOVICE_INSTRUCTOR), NoviceInstructorModel.class); + model = new Gson().fromJson(getString(KEY_NOVICE_INSTRUCTOR), NoviceInstructorModel.class); + netHandler.post(instructorOperationRunnable); } return model; } @@ -68,16 +71,27 @@ public class NoviceInstructorManager extends BaseCacheManager { * 清除相关信息 */ public void removeNoviceInstructor() { + IMLoginModel userInfo = IMLoginManager.get(context).getUserInfo(); + HttpClient.getInstance().get("Message.setZdyMsg", "setZdyMsg") + .params("uid", userInfo.getId()) + .execute(new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + + } + }); model = null; deleteByKey(KEY_NOVICE_INSTRUCTOR); + EventBus.getDefault().post(new NoviceInstructorEvent().setShowHomeIcon(false)); } /** * 请求接口获取是否展示 */ - public void getNetNoviceInstructor() { - if (model != null) - netHandler.post(instructorOperationRunnable); + public void getNetNoviceInstructor(String info) { + model = new Gson().fromJson(info, NoviceInstructorModel.class); + setNoviceInstructor(model); + } /** @@ -87,7 +101,6 @@ public class NoviceInstructorManager extends BaseCacheManager { @Override public void run() { - //展示指引弹窗 EventBus.getDefault().post(new NoviceInstructorEvent().setShowHomeIcon(true)); } diff --git a/config.gradle b/config.gradle index 53e2161f5..eddca7244 100644 --- a/config.gradle +++ b/config.gradle @@ -9,9 +9,9 @@ ext { ] manifestPlaceholders = [ //正式 -// serverHost : "https://napi.yaoulive.com", + serverHost : "https://napi.yaoulive.com", //測試 - serverHost : "https://ceshi.yaoulive.com", +// serverHost : "https://ceshi.yaoulive.com", //腾讯地图 txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index fc60865b1..a5975f2e5 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -19,7 +19,6 @@ import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.ImageView; -import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; @@ -543,9 +542,11 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene MainHttpUtil.requestNewBonus(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { - if (code == 0 && info.length > 0) { + + if (info.length > 0) { + Log.e("MainActivity", info[0]); + JSONObject obj = JSON.parseObject(info[0]); if (code == 0) { - JSONObject obj = JSON.parseObject(info[0]); Bundle bundle = new Bundle(); bundle.putString("send_gold", obj.getString("send_gold")); bundle.putString("send_exp", obj.getString("send_exp")); @@ -553,6 +554,9 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene fragment.setArguments(bundle); fragment.show(getSupportFragmentManager(), "SigninDialog"); } + if (obj.containsKey("msg_zdy_send") && obj.containsKey("msg_zdy_send_text")) { + NoviceInstructorManager.get(mContext).getNetNoviceInstructor(info[0]); + } } } }); @@ -564,6 +568,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene private void loginIM() { String uid = CommonAppConfig.getInstance().getUid(); // ImMessageUtil.getInstance().loginImClient(uid); + } @Override @@ -581,8 +586,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene mTabButtonGroup.setCurPosition(Constants.isShowPage); } Constants.isShowPage = -1; - //获取用户面向指导员的操作 - NoviceInstructorManager.get(this).getNetNoviceInstructor(); + NoviceInstructorManager.get(mContext).getNoviceInstructor(); } /** @@ -1038,7 +1042,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene ConversationIMListManager.get(mContext).jumpConversationList(bundle); } }); - }else { + } else { waitingTip.setVisibility(View.GONE); } }