/** * 添加 * * @param inv * @param actPintuConf * @param startTime * @param endTime * @param userPluginId * @return * @throws Exception */ @Post("add_do") public String add_do( final Invocation inv, ActPintuConf actPintuConf, @Param("activityTime") final String activityTime, @Param("userPluginId") final Integer userPluginId) throws Exception { if (activityTime == null || activityTime.length() == 0 || actPintuConf.getAwards() == null || actPintuConf.getAwards().toString().length() == 0) { inv.addModel("tip", "非法操作,请重试"); inv.addModel( "backUrl", ReadProperties.getPara("httpPath") + "/pluginadmin/pintu/add/" + userPluginId); return "../pc/tip.jsp"; } if (activityTime.length() != 0) { String[] time = activityTime.split(" - "); actPintuConf.setStartTime(DateUtils.converDate(time[0])); actPintuConf.setEndTime(DateUtils.converDate(time[1])); } actPintuConf.setCreateTime(new Date()); actPintuConfService.save(actPintuConf, userPluginId); actPintuConfService.savePrize( actPintuConf.getActivityId(), actPintuConf.getAwards().toString()); inv.getResponse().sendRedirect(WebApplicationUtils.getBasePath() + "/pc/my/actList"); return null; }
/** * 修改 * * @param inv * @param actGuessGameConf * @param startTime * @param endTime * @return * @throws Exception */ @Post("edit_do") public String edit_do( final Invocation inv, ActGuessGameConf actGuessGameConf, @Param("createTime") final Date createTime, @Param("activityTime") final String activityTime) throws Exception { if (activityTime == null || activityTime.length() == 0) { inv.addModel("tip", "非法操作,请重试"); inv.addModel( "backUrl", ReadProperties.getPara("httpPath") + "/pluginadmin/guessgame/edit/" + actGuessGameConf.getActivityId()); return "../pc/tip.jsp"; } if (activityTime.length() != 0) { String[] time = activityTime.split(" - "); actGuessGameConf.setStartTime(DateUtils.converDate(time[0])); actGuessGameConf.setEndTime(DateUtils.converDate(time[1])); } actGuessGameConf.setCreateTime(createTime); actGuessGameConfService.update(actGuessGameConf); inv.getResponse().sendRedirect(WebApplicationUtils.getBasePath() + "/pc/my/actList"); return null; }
@Post("addGame/{activityId:[0-9]+}") public String addGame( final Invocation inv, ActGuessGameAdmin actGuessGameAdmin, @Param("activityTime") final String activityTime) throws Exception { if (activityTime.length() != 0) { String[] time = activityTime.split(" - "); actGuessGameAdmin.setStartTime(DateUtils.converDate(time[0])); actGuessGameAdmin.setEndTime(DateUtils.converDate(time[1])); } actGuessGameAdmin.setUpdateTime(new Date()); int ret = actGuessGameConfService.addGame(actGuessGameAdmin); if (ret == 0) { return "@<script>alert('新增失败');window.history.go(-1);</script>"; } else { inv.getResponse() .sendRedirect( WebApplicationUtils.getContextPath() + "/pluginadmin/guessgame/gameadmin/" + actGuessGameAdmin.getActivityId()); return null; } }