| | |
| | | package com.ks.daylucky.controller.api.client; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.ks.daylucky.pojo.DO.ActivityScanRecord; |
| | | import com.ks.daylucky.pojo.DO.AppConfig; |
| | | import com.ks.daylucky.pojo.DTO.SimpleShareInfo; |
| | | import com.ks.daylucky.pojo.VO.AlipayXCXShareInfoVO; |
| | | import com.ks.daylucky.pojo.DTO.ConfigKeyEnum; |
| | | import com.ks.daylucky.pojo.VO.AcceptData; |
| | |
| | | import org.yeshi.utils.JsonUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @Controller |
| | | @RequestMapping("api/client/activity") |
| | | public class ActivityController { |
| | | |
| | | @Reference(version = "1.0.0") |
| | | @Reference(version = "1.0.0", check = false) |
| | | private LuckyActivityService luckyActivityService; |
| | | |
| | | @Reference(version = "1.0.0") |
| | | @Reference(version = "1.0.0", check = false) |
| | | private LuckyActivityJoinAssistService luckyActivityJoinAssistService; |
| | | |
| | | @Resource |
| | |
| | | @ResponseBody |
| | | @RequestMapping("getActivityDetail") |
| | | public String getActivityDetail(AcceptData acceptData, Long activityId) { |
| | | ActivityDetailInfoDTO dto = activityService.getActivityDetail(activityId, acceptData.getApp().getId(), acceptData.getUid(), true, 20, false); |
| | | ActivityDetailInfoDTO dto = activityService.getActivityDetail(activityId, acceptData.getApp().getId(), acceptData.getUid(), true, 8, false); |
| | | if (dto == null) { |
| | | return JsonUtil.loadFalseResult("活动不存在"); |
| | | } |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | AppConfig appConfig = appConfigService.getConfigCache(acceptData.getApp().getId(), ConfigKeyEnum.activityShareInfo, acceptData.getVersion()); |
| | | SimpleShareInfo info = new Gson().fromJson(appConfig.getValue(), SimpleShareInfo.class); |
| | | |
| | | AlipayXCXShareInfoVO shareInfoDTO = new AlipayXCXShareInfoVO(); |
| | | shareInfoDTO.setPath(String.format("/pages/activity-detail/activity-detail?id=%s&joinInfo=%s", activityId, ActivityUtil.getShareJoinInfo(acceptData.getUid(), activityId))); |
| | | shareInfoDTO.setTitle("测试标题"); |
| | | shareInfoDTO.setDesc("测试简介"); |
| | | shareInfoDTO.setTitle(info.getTitle()); |
| | | shareInfoDTO.setDesc(info.getDesc()); |
| | | shareInfoDTO.setBgImgUrl(activityShareImage); |
| | | vo.setShareInfo(shareInfoDTO); |
| | | |
| | | //已经加入活动就需要返回助力分享图 |
| | | if (vo.isJoined()) { |
| | | |
| | | SimpleUser user = userInfoService.getSimpleUser(acceptData.getUid()); |
| | | if (user != null) { |
| | | String assistShareImage = null; |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | shareInfoDTO = new AlipayXCXShareInfoVO(); |
| | | shareInfoDTO.setPath(String.format("/pages/activity-detail/activity-detail?id=%s&joinInfo=%s", activityId, ActivityUtil.getShareJoinInfo(acceptData.getUid(), activityId))); |
| | | shareInfoDTO.setTitle("测试标题"); |
| | | shareInfoDTO.setDesc("测试简介"); |
| | | shareInfoDTO.setPath(String.format("/pages/activity-detail/activity-detail?id=%s&joinInfo=%s", activityId, URLEncoder.encode(ActivityUtil.getShareJoinInfo(acceptData.getUid(), activityId)))); |
| | | shareInfoDTO.setTitle(info.getTitle()); |
| | | shareInfoDTO.setDesc(info.getDesc()); |
| | | shareInfoDTO.setBgImgUrl(assistShareImage); |
| | | vo.setAssistShareInfo(shareInfoDTO); |
| | | } |
| | |
| | | } |
| | | List<ActivityDetailInfoDTO> dtoList = activityService.getActivityDetail(activityIds, acceptData.getApp().getId(), acceptData.getUid(), false); |
| | | |
| | | //TODO 测试 |
| | | for (int i = 0; i < 20; i++) { |
| | | dtoList.add(dtoList.get(0)); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("data", JsonUtil.getSimpleGson().toJson(ActivityListItemInfoVOFactory.create(dtoList))); |
| | | data.put("count", count); |
| | |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("getSponsorActivity") |
| | | public String getSponsorActivity(AcceptData acceptData, Long sponsorId, int page) { |
| | | public String getSponsorActivity(AcceptData acceptData, Long sponsorId, Long activityId, int page) { |
| | | |
| | | List<LuckyActivity> list = luckyActivityService.getActivityList(acceptData.getApp().getId(), sponsorId, getCanShowStateList(), null, page, Constant.CLIENT_ACTIVITY_LIST_PAGE_SIZE); |
| | | long count = luckyActivityService.countActivity(acceptData.getApp().getId(), sponsorId, getCanShowStateList(), null); |
| | | List<LuckyActivity> list = luckyActivityService.getActivityList(acceptData.getApp().getId(), sponsorId, getCanShowStateList(), Arrays.asList(new Long[]{activityId}), |
| | | null, page, Constant.CLIENT_ACTIVITY_LIST_PAGE_SIZE); |
| | | long count = luckyActivityService.countActivity(acceptData.getApp().getId(), sponsorId, getCanShowStateList(), null, Arrays.asList(new Long[]{activityId})); |
| | | |
| | | List<Long> activityIds = new ArrayList<>(); |
| | | if (list != null && list.size() > 0) { |