| | |
| | | import com.ks.daylucky.pojo.DTO.msg.LuckyMsgContent; |
| | | import com.ks.daylucky.pojo.VO.UserMsgContentVO; |
| | | import com.ks.daylucky.pojo.VO.UserMsgVO; |
| | | import com.ks.daylucky.pojo.VO.common.JumpDetailVO; |
| | | import net.sf.json.JSONObject; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | |
| | | public static UserMsgVO create(UserMsg msg) { |
| | | UserMsgVO vo = new UserMsgVO(); |
| | | vo.setIcon(""); |
| | | vo.setId(msg.getId()); |
| | | vo.setIcon(msg.getMsgType().getIcon()); |
| | | vo.setName(msg.getMsgType().getName()); |
| | | vo.setTime(msg.getCreateTime()); |
| | | if (msg.getMsgType() == UserMsg.UserMsgType.lucky) { |
| | |
| | | |
| | | private static String getDateNumber(String dateNumber) { |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.append(" <div style=\"display: flex;justify-content: space-between;\">"); |
| | | builder.append("<div style=\"display: flex;justify-content: space-between;\">"); |
| | | builder.append("<span>" + dateNumber + "</span>"); |
| | | builder.append("<a style='color:#theme'>查看详情</a>"); |
| | | builder.append("</div>"); |
| | |
| | | private static List<UserMsgContentVO> create(LuckyMsgContent luckyMsgContent) { |
| | | LuckyMsgContent.LuckyMsgType luckyMsgType = luckyMsgContent.getLuckyMsgType(); |
| | | List<UserMsgContentVO> voList = new ArrayList<>(); |
| | | voList.add(new UserMsgContentVO("活动期号", getDateNumber(luckyMsgContent.getDateNumber()))); |
| | | JSONObject params = new JSONObject(); |
| | | params.put("url", "/pages/activity-detail/activity-detail?id=" + luckyMsgContent.getActivityId()); |
| | | voList.add(new UserMsgContentVO("活动期号", getDateNumber(luckyMsgContent.getDateNumber()), new JumpDetailVO(JumpDetailVO.JumpType.page, null, params))); |
| | | |
| | | if (luckyMsgType == LuckyMsgContent.LuckyMsgType.joinSuccess) { |
| | | voList.add(new UserMsgContentVO("状态", "参与成功")); |
| | |
| | | voList.add(new UserMsgContentVO("领取状态", luckyMsgContent.getReceiveState())); |
| | | voList.add(new UserMsgContentVO("奖品权益", luckyMsgContent.getOutDateAwardState())); |
| | | } else if (luckyMsgType == LuckyMsgContent.LuckyMsgType.assistAndJoin) { |
| | | voList.add(new UserMsgContentVO("助力状态", "助力好友<img src='" + luckyMsgContent.getAssistUser().getPortrait() + "'>成功参与了抽奖")); |
| | | voList.add(new UserMsgContentVO("助力状态", "<div style='display:flex; align-items: center;'>助力好友<img style='width: 48rpx;height: 48rpx;border-radius: 50%;' src='" + luckyMsgContent.getAssistUser().getPortrait() + "' />成功参与了抽奖</div>")); |
| | | voList.add(new UserMsgContentVO("幸运券数", String.format("+%s张", luckyMsgContent.getWeight()))); |
| | | } else if (luckyMsgType == LuckyMsgContent.LuckyMsgType.assist) { |
| | | voList.add(new UserMsgContentVO("助力状态", "好友<img src='" + luckyMsgContent.getAssistUser().getPortrait() + "'>助力成功")); |
| | | voList.add(new UserMsgContentVO("助力状态", "<div style='display:flex; align-items: center;'>好友<img style='width: 48rpx;height: 48rpx;border-radius: 50%;' src='" + luckyMsgContent.getAssistUser().getPortrait() + "' />助力成功</div>")); |
| | | voList.add(new UserMsgContentVO("幸运券数", String.format("+%s张", luckyMsgContent.getWeight()))); |
| | | } else if (luckyMsgType == LuckyMsgContent.LuckyMsgType.openFail) { |
| | | voList.add(new UserMsgContentVO("开奖状态", luckyMsgContent.getOpenState())); |