| | |
| | | import com.yeshi.buwan.domain.jump.JumpDetail; |
| | | import com.yeshi.buwan.domain.jump.JumpTypeEnum; |
| | | import com.yeshi.buwan.dto.goldcorn.SignInGoldCornDateData; |
| | | import com.yeshi.buwan.exception.goldcorn.SignInException; |
| | | import com.yeshi.buwan.exception.user.LoginUserException; |
| | | import com.yeshi.buwan.service.inter.goldcorn.GoldCornTaskActionDetailService; |
| | | import com.yeshi.buwan.service.inter.goldcorn.SignInService; |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | | import com.yeshi.buwan.service.manager.GoldCornManager; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.util.JsonUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import com.yeshi.buwan.util.*; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import com.yeshi.buwan.vo.goldcorn.GoldCornCouponVideoVO; |
| | | import com.yeshi.buwan.vo.goldcorn.GoldCornRecordVO; |
| | |
| | | @RequestMapping("makeGoldCorn") |
| | | @ResponseBody |
| | | public String makeGoldCorn(AcceptData acceptData, String code, String loginUid, String param1, String param2) { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("goldCorn", 1); |
| | | return JsonUtil.loadTrueJson(jsonObject.toString()); |
| | | } |
| | | |
| | | @RequestMapping("signIn") |
| | | @ResponseBody |
| | | public String signIn(AcceptData acceptData, String loginUid) { |
| | | try { |
| | | GoldCornGetSource source = goldCornManager.getGoldCornGetSource(CodeCornGetSourceType.signIn); |
| | | goldCornManager.addGoldCorn(loginUid, CodeCornGetSourceType.signIn, null, "签到", null); |
| | | GoldCornGetSource source = goldCornManager.getGoldCornGetSource(CodeCornGetSourceType.valueOf(code)); |
| | | goldCornManager.addGoldCorn(loginUid, CodeCornGetSourceType.valueOf(code), null, source.getSourceName(), ""); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("goldCorn", source.getGoldCorn()); |
| | | return JsonUtil.loadTrueJson(jsonObject.toString()); |
| | |
| | | } catch (GoldTradeException e) { |
| | | return JsonUtil.loadFalseJson(e.getMessage()); |
| | | } catch (Exception e) { |
| | | return JsonUtil.loadFalseJson("签到失败"); |
| | | e.printStackTrace(); |
| | | logger.error("添加影视豆出错", e); |
| | | return JsonUtil.loadFalseJson("影视豆添加失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | @RequestMapping("canDoTask") |
| | | @ResponseBody |
| | | public String canDoTask(AcceptData acceptData, String loginUid, String code, String param2) { |
| | | |
| | | long time = goldCornManager.getNextDoTaskTime(CodeCornGetSourceType.valueOf(code), loginUid); |
| | | if (time <= 0) { |
| | | return JsonUtil.loadTrueJson(""); |
| | | } else { |
| | | long span = time - System.currentTimeMillis(); |
| | | int ss = (int) (span / 1000); |
| | | int h = ss / 3600; |
| | | int m = ss % 3600 / 60; |
| | | int s = ss % 60; |
| | | String st = ""; |
| | | if (h > 0) { |
| | | st += h + "小时"; |
| | | } |
| | | if (m != 0 || h > 0) |
| | | st += m + "分"; |
| | | if (s > 0) |
| | | st += s + "秒"; |
| | | return JsonUtil.loadFalseJson(String.format("请等待 %s 后再做任务", st)); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | @RequestMapping("signIn") |
| | | @ResponseBody |
| | | public String signIn(AcceptData acceptData, String loginUid) { |
| | | try { |
| | | int goldCorn = signInService.signIn(loginUid); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("goldCorn", goldCorn); |
| | | return JsonUtil.loadTrueJson(jsonObject.toString()); |
| | | } catch (LoginUserException e) { |
| | | return JsonUtil.loadFalseJson("签到出错"); |
| | | } catch (SignInException e) { |
| | | e.printStackTrace(); |
| | | return JsonUtil.loadFalseJson(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | @RequestMapping("getSignInData") |
| | |
| | | List<GoldCornRecord> list = goldCornManager.getRecordList(recordQuery, loginUid); |
| | | List<GoldCornRecordVO> voList = new ArrayList<>(); |
| | | for (GoldCornRecord record : list) { |
| | | voList.add(new GoldCornRecordVO(record.getTitle(), TimeUtil.getGernalTime(record.getCreateTime().getTime(), "yyyy.MM.dd HH:mm"), record.getType() == GoldCornRecord.TYPE_CONSUME ? 0 - record.getGoldCorn() : record.getGoldCorn())); |
| | | voList.add(new GoldCornRecordVO(record.getTitle(), record.getDesc(), TimeUtil.getGernalTime(record.getCreateTime().getTime(), "yyyy.MM.dd HH:mm"), record.getType() == GoldCornRecord.TYPE_CONSUME ? 0 - record.getGoldCorn() : record.getGoldCorn())); |
| | | } |
| | | long count = goldCornManager.getRecordCount(recordQuery, loginUid); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("list", new Gson().toJson(voList)); |
| | | data.put("count", count); |
| | | return JsonUtil.loadTrueJson(data.toString()); |
| | | return JsonUtilV2.loadTrueJson(data.toString()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | voList.add(new GoldCornCouponVideoVO("https://r1.ykimg.com/058400005FA60E6A14187C0791817503?x-oss-process=image/resize,w_290/interlace,1/quality,Q_80", jumpDetail, params.toString().replace("\"", "\\" + "\""))); |
| | | voList.add(new GoldCornCouponVideoVO("https://r1.ykimg.com/058400005F2BA59B6AEB660E907A2B99?x-oss-process=image/resize,w_290/interlace,1/quality,Q_80", jumpDetail, params.toString().replace("\"", "\\" + "\""))); |
| | | voList.add(new GoldCornCouponVideoVO("https://r1.ykimg.com/052700005DC9247B1B769182B50A8C21?x-oss-process=image/resize,w_290/interlace,1/quality,Q_80", jumpDetail, params.toString().replace("\"", "\\" + "\""))); |
| | | // if (voList.size() < 3) |
| | | voList.clear(); |
| | | if (voList.size() < 3) |
| | | voList.clear(); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("list", new Gson().toJson(voList)); |
| | | data.put("count", voList.size()); |
| | |
| | | |
| | | if (!hiddenList.contains(source.getSourceCode())) { |
| | | if (map.get(source.getSourceCode()) == null) { |
| | | source.setSourceDesc(String.format("今日已完成%s/%s", 0, source.getMaxDayCount())); |
| | | vo.setDesc(source.getSourceDesc() + "," + String.format("今日已完成%s/%s", 0, source.getMaxDayCount())); |
| | | } else { |
| | | vo.setEnable(map.get(source.getSourceCode()).getCount() < source.getMaxDayCount()); |
| | | source.setSourceDesc(String.format("今日已完成%s/%s", map.get(source.getSourceCode()).getCount(), source.getMaxDayCount())); |
| | | vo.setDesc(source.getSourceDesc() + "," + String.format("今日已完成%s/%s", map.get(source.getSourceCode()).getCount(), source.getMaxDayCount())); |
| | | } |
| | | } else { |
| | | vo.setGoldCorn("实付款*" + source.getGoldCorn()); |