Commit 9310f3ebdaab885fcfd6a012ae812c77026f1bae
1 parent
ce2026d3
Exists in
yxb_dev
and in
1 other branch
no message
Showing
9 changed files
with
86 additions
and
43 deletions
Show diff stats
app/src/main/java/com/shunzhi/parent/AppConfig.java
... | ... | @@ -24,8 +24,8 @@ public class AppConfig { |
24 | 24 | public static String PARENT_ID = "parent_id"; |
25 | 25 | public static String NIM_CONFIG_VIBRATE = "nim_config_vibrate";//收到通知震动 |
26 | 26 | public static String NIM_CONFIG_SOUND = "nim_config_sound";//收到通知响铃 |
27 | - public static String ISBINDING="isbinding"; | |
28 | - public static String CURRCHILDJSONSTR=""; | |
27 | + public static String ISBINDING = "isbinding"; | |
28 | + public static String CURRCHILDJSONSTR = ""; | |
29 | 29 | |
30 | 30 | |
31 | 31 | public static boolean ISLOGIN = false; |
... | ... | @@ -39,16 +39,18 @@ public class AppConfig { |
39 | 39 | public static String APP_IS_START = "app_is_start"; |
40 | 40 | |
41 | 41 | //测试 |
42 | -// public static String BASE_URL="http://60.190.202.57:1000/"; | |
43 | -// public static String BASE_URL_ORDER="http://60.190.202.57:8101/"; | |
44 | -// public static String BASE_URL_FILE="http://60.190.202.57:8196"; | |
42 | + public static String BASE_URL="http://60.190.202.57:1000/"; | |
43 | + public static String BASE_URL_ORDER="http://60.190.202.57:8101/"; | |
44 | + public static String BASE_URL_FILE="http://60.190.202.57:8196"; | |
45 | + public static String BASE_URL_VOTE = "http://60.190.202.57:8812/"; | |
45 | 46 | |
46 | 47 | |
47 | 48 | //正式 |
48 | - public static String BASE_URL="http://campus.myjxt.com/"; | |
49 | - public static String BASE_URL_ORDER="http://parent.myjxt.com/"; | |
50 | - public static String BASE_URL_FILE="http://manage.myjxt.com"; | |
51 | - public static final String url_version = BASE_URL + "api/Common/AppVersion?appType=3"; | |
49 | +// public static String BASE_URL = "http://campus.myjxt.com/"; | |
50 | +// public static String BASE_URL_ORDER = "http://parent.myjxt.com/"; | |
51 | +// public static String BASE_URL_FILE = "http://manage.myjxt.com"; | |
52 | +// public static String BASE_URL_VOTE = "www.sxspy.net/"; | |
53 | +// public static final String url_version = BASE_URL + "api/Common/AppVersion?appType=3"; | |
52 | 54 | |
53 | 55 | |
54 | 56 | //默认日志保存的路径 |
... | ... | @@ -63,7 +65,7 @@ public class AppConfig { |
63 | 65 | |
64 | 66 | private static AppConfig appConfig = null; |
65 | 67 | private static Context mContext = null; |
66 | - public static String url_apk="http://update.myjxt.com/zh_parent.apk"; | |
68 | + public static String url_apk = "http://update.myjxt.com/zh_parent.apk"; | |
67 | 69 | |
68 | 70 | public static AppConfig getAppConfig(Context context) { |
69 | 71 | if (appConfig == null) { | ... | ... |
app/src/main/java/com/shunzhi/parent/AppContext.java
app/src/main/java/com/shunzhi/parent/api/Consult.java
... | ... | @@ -32,4 +32,9 @@ public interface Consult { |
32 | 32 | Observable<JsonObject> getInformationTopic(@Field("keyword") String keyword,@Field("areaName") String areaName, @Field("channel") String channel |
33 | 33 | , @Field("toFirstPage") String toFirstPage, @Field("pageIndex") int pageIndex); |
34 | 34 | |
35 | + | |
36 | + @FormUrlEncoded | |
37 | + @POST("RoleLogin/GetToken") | |
38 | + Observable<JsonObject> loginVote(@Field("username") String username, @Field("password") String password); | |
39 | + | |
35 | 40 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/contract/consult/ConsultContract.java
... | ... | @@ -28,6 +28,8 @@ public interface ConsultContract { |
28 | 28 | public abstract void getContextChannel(String areaName, int channel, int toFirstPage, int pageIndex); |
29 | 29 | |
30 | 30 | public abstract void getInformationTopic(String keyword,String areaName,String channel,String toFirstPage,int pageIndex); |
31 | + | |
32 | + public abstract void loginVote(String phoneNum,String password,int position); | |
31 | 33 | } |
32 | 34 | |
33 | 35 | |
... | ... | @@ -39,10 +41,12 @@ public interface ConsultContract { |
39 | 41 | Observable<JsonObject> getContextChannel(String areaName, int channel, int toFirstPage, int pageIndex); |
40 | 42 | |
41 | 43 | Observable<JsonObject> getInformationTopic(String keyword,String areaName,String channel,String toFirstPage,int pageIndex); |
44 | + | |
45 | + Observable<JsonObject> loginVote(String phoneNum,String password); | |
42 | 46 | } |
43 | 47 | |
44 | 48 | interface IConsultView extends IBaseFragment { |
45 | - void showTools(); | |
49 | + void showVote(int position); | |
46 | 50 | |
47 | 51 | void showBanners(List<GuangGaoBean> guangGaoBeanList); |
48 | 52 | ... | ... |
app/src/main/java/com/shunzhi/parent/manager/MessageManager.java
... | ... | @@ -61,12 +61,14 @@ public class MessageManager { |
61 | 61 | private Observer<List<IMMessage>> messageObserver = new Observer<List<IMMessage>>() { |
62 | 62 | @Override |
63 | 63 | public void onEvent(List<IMMessage> imMessages) { |
64 | + Log.e("aaaaa", "999999"); | |
64 | 65 | onMessageReceive(imMessages); |
65 | 66 | } |
66 | 67 | }; |
67 | 68 | private Observer<CustomNotification> customNotificationObserver = new Observer<CustomNotification>() { |
68 | 69 | @Override |
69 | 70 | public void onEvent(CustomNotification customNotification) { |
71 | + Log.e("aaaaa", "888888"); | |
70 | 72 | onCustomNotificationReceive(customNotification); |
71 | 73 | } |
72 | 74 | }; |
... | ... | @@ -97,11 +99,13 @@ public class MessageManager { |
97 | 99 | } |
98 | 100 | |
99 | 101 | private void onCustomNotificationReceive(CustomNotification customNotification) { |
102 | + Timber.d("sss-==" + customNotification.getSessionId()); | |
100 | 103 | try { |
101 | 104 | JSONObject json = new JSONObject(customNotification.getContent()); |
105 | + Timber.d("sss-==" + json.toString()); | |
102 | 106 | String type = json.optString("type"); |
103 | 107 | String uuid = json.optString("msgId"); |
104 | - Timber.d("onCustomNotificationReceive%s","json="+json.toString()); | |
108 | + Timber.d("onCustomNotificationReceive%s", "json=" + json.toString()); | |
105 | 109 | if ("homework".equals(type)) { |
106 | 110 | PHMessageSession session = PHMessageSession.findAndCreateSession(PHMessageSession.sessionType_homework, true); |
107 | 111 | session.setSessionName("作业通知"); |
... | ... | @@ -118,6 +122,23 @@ public class MessageManager { |
118 | 122 | message.setSessionType(session.getSessionType()); |
119 | 123 | Long id = messageDao.insert(message); |
120 | 124 | notifyNotification(uuid, id, "收到一条作业通知"); |
125 | + } else if ("attend".equals(type)) { | |
126 | + //考勤 | |
127 | + PHMessageSession session = PHMessageSession.findAndCreateSession(PHMessageSession.sessionType_homework, true); | |
128 | + session.setSessionName("考勤通知"); | |
129 | + session.setDate(new Date(customNotification.getTime())); | |
130 | + session.setSessionText(json.optString("title")); | |
131 | +// ToastUtils.showToast(json.optString("title")+"uuid="+uuid); | |
132 | + | |
133 | + PHMessage message = new PHMessage(); | |
134 | + PHMessageDao messageDao = AppContext.getInstance().getDaoSession().getPHMessageDao(); | |
135 | + message.setDate(new Date(customNotification.getTime())); | |
136 | + message.setMessageId(uuid); | |
137 | + message.setSessionId(session.getSessionId()); | |
138 | + message.setExValue(customNotification.getContent()); | |
139 | + message.setSessionType(session.getSessionType()); | |
140 | + Long id = messageDao.insert(message); | |
141 | + notifyNotification(uuid, id, "收到一条考勤通知"); | |
121 | 142 | } |
122 | 143 | } catch (JSONException e) { |
123 | 144 | e.printStackTrace(); |
... | ... | @@ -184,12 +205,12 @@ public class MessageManager { |
184 | 205 | NIMLoginResultBean bean = new NIMLoginResultBean(true, 200, null); |
185 | 206 | subject.onNext(bean); |
186 | 207 | // Timber.i("----===onSuccess : %s", o); |
187 | - Log.d("66666","云信服务器登录失败:" + o.toString()); | |
208 | + Log.d("66666", "云信服务器登录失败:" + o.toString()); | |
188 | 209 | } |
189 | 210 | |
190 | 211 | @Override |
191 | 212 | public void onFailed(int i) { |
192 | - Log.d("66666","云信服务器登录失败:" + i); | |
213 | + Log.d("66666", "云信服务器登录失败:" + i); | |
193 | 214 | // Timber.i("----===nim login failed : %s", i); |
194 | 215 | NIMLoginResultBean bean = new NIMLoginResultBean(false, i, null); |
195 | 216 | subject.onNext(bean); |
... | ... | @@ -197,7 +218,7 @@ public class MessageManager { |
197 | 218 | |
198 | 219 | @Override |
199 | 220 | public void onException(Throwable throwable) { |
200 | - Log.d("66666","onException:" + throwable.toString()); | |
221 | + Log.d("66666", "onException:" + throwable.toString()); | |
201 | 222 | // Timber.i("----===onException"); |
202 | 223 | if (throwable != null) throwable.printStackTrace(); |
203 | 224 | NIMLoginResultBean bean = new NIMLoginResultBean(false, 0, throwable); | ... | ... |
app/src/main/java/com/shunzhi/parent/model/consult/ConsultModel.java
... | ... | @@ -47,6 +47,13 @@ public class ConsultModel extends BaseModel implements ConsultContract.IConsultM |
47 | 47 | .getInformationTopic(keyword,areaName,channel,toFirstPage,pageIndex).compose(RxHelper.<JsonObject>rxSchedulerHelper()); |
48 | 48 | } |
49 | 49 | |
50 | + @Override | |
51 | + public Observable<JsonObject> loginVote(String phoneNum, String password) { | |
52 | + return RetrofitCreateHelper.getInstance().createApi(Consult.class, AppConfig.BASE_URL_VOTE) | |
53 | + .loginVote(phoneNum,password).compose(RxHelper.<JsonObject>rxSchedulerHelper()); | |
54 | +// return null; | |
55 | + } | |
56 | + | |
50 | 57 | public static ConsultContract.IConsultModel newInstance() { |
51 | 58 | return new ConsultModel(); |
52 | 59 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/consult/ConsultPresenter.java
1 | 1 | package com.shunzhi.parent.presenter.consult; |
2 | 2 | |
3 | -import android.util.Log; | |
4 | 3 | import android.view.View; |
5 | 4 | import android.widget.LinearLayout; |
6 | 5 | |
... | ... | @@ -8,6 +7,7 @@ import com.google.gson.Gson; |
8 | 7 | import com.google.gson.JsonArray; |
9 | 8 | import com.google.gson.JsonObject; |
10 | 9 | import com.share.mvpsdk.utils.OkHttpExceptionUtil; |
10 | +import com.share.mvpsdk.utils.ToastUtils; | |
11 | 11 | import com.shunzhi.parent.R; |
12 | 12 | import com.shunzhi.parent.bean.GuangGaoBean; |
13 | 13 | import com.shunzhi.parent.bean.ToolBean; |
... | ... | @@ -53,7 +53,7 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter { |
53 | 53 | }); |
54 | 54 | layout_control.addView(textAndImgShowView); |
55 | 55 | } |
56 | - mIView.showTools(); | |
56 | +// mIView.showVote(); | |
57 | 57 | } |
58 | 58 | |
59 | 59 | @Override |
... | ... | @@ -88,9 +88,9 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter { |
88 | 88 | @Override |
89 | 89 | public void accept(JsonObject jsonObject) throws Exception { |
90 | 90 | // ToastUtils.showToast(jsonObject.toString()); |
91 | - JsonObject json=jsonObject.getAsJsonObject("data"); | |
92 | - Gson g=new Gson(); | |
93 | - ChannelInfo channelInfo = g.fromJson(json.toString(),ChannelInfo.class); | |
91 | + JsonObject json = jsonObject.getAsJsonObject("data"); | |
92 | + Gson g = new Gson(); | |
93 | + ChannelInfo channelInfo = g.fromJson(json.toString(), ChannelInfo.class); | |
94 | 94 | List<ChannelContextBean> contextList = channelInfo.getChannelContent(); |
95 | 95 | List<ChannelBean> channelList = channelInfo.getSubchannel(); |
96 | 96 | mIView.showChannel(channelList); |
... | ... | @@ -105,20 +105,19 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter { |
105 | 105 | })); |
106 | 106 | |
107 | 107 | |
108 | - | |
109 | 108 | } |
110 | 109 | |
111 | 110 | @Override |
112 | 111 | public void getInformationTopic(String keyword, String areaName, String channel, String toFirstPage, int pageIndex) { |
113 | - mRxManager.register(mIModel.getInformationTopic(keyword,areaName,channel,toFirstPage,pageIndex).subscribe(new Consumer<JsonObject>() { | |
112 | + mRxManager.register(mIModel.getInformationTopic(keyword, areaName, channel, toFirstPage, pageIndex).subscribe(new Consumer<JsonObject>() { | |
114 | 113 | @Override |
115 | 114 | public void accept(JsonObject jsonObject) throws Exception { |
116 | - JsonObject json=jsonObject.getAsJsonObject("data"); | |
117 | - Gson g=new Gson(); | |
115 | + JsonObject json = jsonObject.getAsJsonObject("data"); | |
116 | + Gson g = new Gson(); | |
118 | 117 | List<ChannelContextBean> channelList = new ArrayList<>(); |
119 | - JsonArray jsonArray=json.getAsJsonArray("channelList"); | |
118 | + JsonArray jsonArray = json.getAsJsonArray("channelList"); | |
120 | 119 | for (int i = 0; i < jsonArray.size(); i++) { |
121 | - ChannelContextBean channelBean=g.fromJson(jsonArray.get(i),ChannelContextBean.class); | |
120 | + ChannelContextBean channelBean = g.fromJson(jsonArray.get(i), ChannelContextBean.class); | |
122 | 121 | channelList.add(channelBean); |
123 | 122 | } |
124 | 123 | mIView.showContext(channelList); |
... | ... | @@ -133,6 +132,22 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter { |
133 | 132 | } |
134 | 133 | |
135 | 134 | @Override |
135 | + public void loginVote(String phoneNum, String password, final int position) { | |
136 | + mRxManager.register(mIModel.loginVote(phoneNum, password).subscribe(new Consumer<JsonObject>() { | |
137 | + @Override | |
138 | + public void accept(JsonObject jsonObject) throws Exception { | |
139 | + ToastUtils.showToast(jsonObject.toString()); | |
140 | + mIView.showVote(position); | |
141 | + } | |
142 | + }, new Consumer<Throwable>() { | |
143 | + @Override | |
144 | + public void accept(Throwable throwable) throws Exception { | |
145 | + mIView.showVote(position); | |
146 | + } | |
147 | + })); | |
148 | + } | |
149 | + | |
150 | + @Override | |
136 | 151 | public ConsultContract.IConsultModel getModel() { |
137 | 152 | return ConsultModel.newInstance(); |
138 | 153 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
1 | 1 | package com.shunzhi.parent.ui.fragment; |
2 | 2 | |
3 | -import android.annotation.TargetApi; | |
4 | -import android.app.DatePickerDialog; | |
5 | 3 | import android.content.BroadcastReceiver; |
6 | 4 | import android.content.Context; |
7 | 5 | import android.content.Intent; |
... | ... | @@ -13,18 +11,12 @@ import android.support.annotation.Nullable; |
13 | 11 | import android.support.annotation.RequiresApi; |
14 | 12 | import android.support.v4.widget.NestedScrollView; |
15 | 13 | import android.text.TextUtils; |
16 | -import android.util.Log; | |
17 | 14 | import android.view.View; |
18 | 15 | import android.widget.EditText; |
19 | 16 | import android.widget.ImageView; |
20 | 17 | import android.widget.LinearLayout; |
21 | 18 | import android.widget.TextView; |
22 | -import android.widget.Toast; | |
23 | 19 | |
24 | -import com.bigkoo.pickerview.builder.TimePickerBuilder; | |
25 | -import com.bigkoo.pickerview.listener.CustomListener; | |
26 | -import com.bigkoo.pickerview.listener.OnTimeSelectListener; | |
27 | -import com.bigkoo.pickerview.view.TimePickerView; | |
28 | 20 | import com.bumptech.glide.Glide; |
29 | 21 | import com.jcodecraeer.xrecyclerview.XRecyclerView; |
30 | 22 | import com.share.mvpsdk.base.BasePresenter; |
... | ... | @@ -41,20 +33,15 @@ import com.shunzhi.parent.presenter.consult.ConsultPresenter; |
41 | 33 | import com.shunzhi.parent.ui.activity.consult.ConsultOneLevelActivity; |
42 | 34 | import com.shunzhi.parent.ui.activity.mywebview.WebViewActivity; |
43 | 35 | import com.shunzhi.parent.util.AttrsUtils; |
44 | -import com.shunzhi.parent.util.GlideUtils; | |
45 | 36 | import com.shunzhi.parent.views.TextAndImgShowView; |
46 | 37 | import com.stx.xhb.xbanner.XBanner; |
47 | 38 | |
48 | -import java.text.SimpleDateFormat; | |
49 | 39 | import java.util.ArrayList; |
50 | -import java.util.Calendar; | |
51 | -import java.util.Date; | |
52 | 40 | import java.util.List; |
53 | 41 | |
54 | 42 | import cn.jzvd.JZVideoPlayerStandard; |
55 | 43 | import me.leefeng.citypicker.CityPicker; |
56 | 44 | import me.leefeng.citypicker.CityPickerListener; |
57 | -import timber.log.Timber; | |
58 | 45 | |
59 | 46 | public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.ConsultPresenter, ConsultContract.IConsultModel> implements View.OnClickListener |
60 | 47 | , ConsultContract.IConsultView, CityPickerListener { |
... | ... | @@ -164,7 +151,9 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
164 | 151 | xBanner.setOnItemClickListener(new XBanner.OnItemClickListener() { |
165 | 152 | @Override |
166 | 153 | public void onItemClick(XBanner banner, int position) { |
167 | - WebViewActivity.getInstance(getContext(), imgWebUrl.get(position), -1); | |
154 | + mPresenter.loginVote(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME) | |
155 | + , AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_PWD),position); | |
156 | +// WebViewActivity.getInstance(getContext(), imgWebUrl.get(position), -1); | |
168 | 157 | } |
169 | 158 | }); |
170 | 159 | } |
... | ... | @@ -240,8 +229,8 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
240 | 229 | } |
241 | 230 | |
242 | 231 | @Override |
243 | - public void showTools() { | |
244 | - | |
232 | + public void showVote(int position) { | |
233 | + WebViewActivity.getInstance(getContext(), imgWebUrl.get(position), -1); | |
245 | 234 | } |
246 | 235 | |
247 | 236 | @Override | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/MineFragment.java
... | ... | @@ -21,7 +21,6 @@ import com.shunzhi.parent.AppContext; |
21 | 21 | import com.shunzhi.parent.BuildConfig; |
22 | 22 | import com.shunzhi.parent.R; |
23 | 23 | import com.shunzhi.parent.bean.message.PHMessage; |
24 | -import com.shunzhi.parent.bean.message.PHMessageSession; | |
25 | 24 | import com.shunzhi.parent.contract.loginandregister.LoginAndRegisterContract; |
26 | 25 | import com.shunzhi.parent.contract.mine.MineContract; |
27 | 26 | import com.shunzhi.parent.manager.MessageManager; | ... | ... |