From 0a3b28bcff870dfb742d76d06fc74481965ea122 Mon Sep 17 00:00:00 2001 From: yujian <yujian> Date: 星期四, 17 一月 2019 14:48:54 +0800 Subject: [PATCH] 用户自定义界面设置+ 免打扰IOS推送修改 --- fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java | 73 +++++++++++++++++++++++++++++++++++- 1 files changed, 71 insertions(+), 2 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java index e6f56b8..bc89707 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java @@ -66,6 +66,7 @@ import com.yeshi.fanli.exception.goods.CollectionGoodsException; import com.yeshi.fanli.exception.taobao.TaoKeApiException; import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException; +import com.yeshi.fanli.exception.user.UserCustomSettingsException; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.AdminUserService; import com.yeshi.fanli.service.inter.config.ConfigService; @@ -90,6 +91,7 @@ import com.yeshi.fanli.service.inter.user.SpreadUserImgService; import com.yeshi.fanli.service.inter.user.UserAccountService; import com.yeshi.fanli.service.inter.user.UserActiveLogService; +import com.yeshi.fanli.service.inter.user.UserCustomSettingsService; import com.yeshi.fanli.service.inter.user.UserInfoService; import com.yeshi.fanli.service.inter.user.UserMoneyDetailService; import com.yeshi.fanli.service.inter.user.UserShareGoodsRecordService; @@ -111,6 +113,7 @@ import com.yeshi.fanli.util.taobao.TaoBaoUtil; import com.yeshi.fanli.util.taobao.TaoKeApiUtil; import com.yeshi.fanli.util.wx.WXLoginUtil; +import com.yeshi.fanli.vo.user.UserSettingsVO; import net.sf.json.JSONArray; import net.sf.json.JSONObject; @@ -202,6 +205,10 @@ @Resource private UserShareGoodsRecordService userShareGoodsRecordService; + + @Resource + private UserCustomSettingsService userCustomSettingsService; + private static final String PASSWORD_MAX_ERROR = "password_max_error"; private static final String EXTRACT_MIN_MONEY = "extract_min_money"; @@ -499,11 +506,17 @@ data.put("first", 0); int spreadImgCount = spreadUserImgService.countUserSpreadImg(user.getId()); long shareCount = userShareGoodsRecordService.countShareRecordByUid(user.getId()); + + int showTiCheng = 1; // 涓嶆樉绀� if ("ios".equalsIgnoreCase(acceptData.getPlatform()) && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()))) data.put("showTiCheng", false); - else + else { data.put("showTiCheng", spreadImgCount + shareCount > 0); + if (spreadImgCount + shareCount > 0) { + showTiCheng = 0; + } + } if ("ios".equalsIgnoreCase(acceptData.getPlatform()) && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()))) @@ -511,6 +524,34 @@ Constant.systemCommonConfig.getProjectHost(), Constant.systemCommonConfig.getProjectName())); else data.put("inviteList", configService.get("team_list")); + + // 鐣岄潰鐘舵�� + UserSettingsVO mySettings = null; + try { + mySettings = userCustomSettingsService.getMySettings(user.getId()); + } catch (UserCustomSettingsException e) { + mySettings = new UserSettingsVO(); + e.printStackTrace(); + } + + if (mySettings.getCancelNotice() == null) { + mySettings.setCancelNotice(0); + } + if (mySettings.getNoBonusCount() == null) { + mySettings.setNoBonusCount(showTiCheng); // 鏍规嵁showTiCheng鏉ュ垽鏂� + } + if (mySettings.getNoNewsRedDot() == null) { + mySettings.setNoNewsRedDot(0); + } + if (mySettings.getNoShareRecordAndStorage() == null) { + mySettings.setNoShareRecordAndStorage(showTiCheng); // 鏍规嵁showTiCheng鏉ュ垽鏂� + } + if (mySettings.getNoInvitationBonus() == null) { + mySettings.setNoInvitationBonus(0); + } + + data.put("moduleState", mySettings); + out.print(JsonUtil.loadTrueResult(data)); final UserInfo uuser = user; ThreadUtil.run(new Runnable() { @@ -1934,7 +1975,35 @@ out.print(JsonUtil.loadFalseResult("鍒犻櫎澶辫触")); e.printStackTrace(); } - } + + + /** + * 璁剧疆鐣岄潰寮�鍏崇姸鎬� + * @param acceptData + * @param uid + * @param type 1-閫氱煡鍏嶆墦鎵�(20:00-8:00) 2-涓嶇湅娑堟伅绾㈢偣鎻愰啋 3-涓嶇湅濂栭噾缁熻 涓嶇湅閭�璇锋嬁濂栭噾 4-涓嶇湅鍒嗕韩璁板綍鍜岄�夊搧搴� 涓嶇湅娑堟伅绾㈢偣鎻愰啋 + * @param state 0鍏抽棴 1寮�鍚� + * @param out + */ + @RequestMapping(value = "setModuleState", method = RequestMethod.POST) + public void setModuleState(AcceptData acceptData, Long uid, Integer type, Integer state, PrintWriter out) { + + if (uid == null) { + out.print(JsonUtil.loadFalseResult("鐢ㄦ埛鏈櫥褰�")); + return; + } + + try { + userCustomSettingsService.saveModuleState(uid, type, state); + out.print(JsonUtil.loadTrueResult("璁剧疆鎴愬姛")); + } catch (UserCustomSettingsException e) { + out.print(JsonUtil.loadFalseResult(e.getMsg())); + } catch (Exception e) { + out.print(JsonUtil.loadFalseResult("璁剧疆澶辫触")); + e.printStackTrace(); + } + } + } -- Gitblit v1.8.0