| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | import org.jsoup.Jsoup;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.NumberUtil;
|
| | | import org.yeshi.utils.entity.FileUploadResult;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | |
| | | import com.yeshi.fanli.exception.share.UserShareGoodsRecordException;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | /**
|
| | | * 动态
|
| | |
| | | if (page <= 0)
|
| | | page = 1;
|
| | | List<RecommendActivity> list = activityService.getRecommendActivityListCache(page, Constant.PAGE_SIZE);
|
| | | // 过滤一遍
|
| | | if (list != null)
|
| | | for (RecommendActivity activity : list) {
|
| | | if (!StringUtil.isNullOrEmpty(activity.getTitle())) {
|
| | | activity.setTitle(Jsoup.parse(activity.getTitle()).text());
|
| | | if (activity.getShareCount() >= 10000)
|
| | | activity.setShareCountShow(
|
| | | NumberUtil.get1PointNumber(activity.getShareCount() / 10000.0) + "万");
|
| | | else
|
| | | activity.setShareCountShow(activity.getShareCount() + "");
|
| | | }
|
| | | }
|
| | | long count = activityService.getRecommendActivityCountCache();
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("data", getGson().toJson(list));
|
| | |
| | | imgList.add(uploadResult.getUrl());
|
| | | data.put("shareImgs", imgList);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | |
| | | activityService.addShareCount(activityId, 1);
|
| | | } catch (UserShareGoodsRecordException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMessage()));
|
| | | } catch (ActivityException e) {
|
| | |
| | | try {
|
| | | JSONObject data = activityService.shareGoodsV2(uid, activityId);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | activityService.addShareCount(activityId, 1);
|
| | | } catch (UserShareGoodsRecordException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMessage()));
|
| | | } catch (ActivityException e) {
|
| | |
| | | data.put("shareTitle", result.getTitle());
|
| | | data.put("shareImgs", imgList);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | activityService.addShareCount(activityId, 1);
|
| | | } catch (ActivityException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMessage()));
|
| | | }
|