| | |
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.BigDecimalUtil;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
| | | String text = configService.get("goods_share_text_coupon");
|
| | | shareText = text.replace("[标题]", taoBaoLink.getGoods().getTitle())
|
| | | .replace("[在售价]", "¥" + taoBaoLink.getGoods().getZkPrice())
|
| | | .replace("[优惠券金额]",
|
| | | "¥"+BigDecimalUtil.getWithNoZera(taoBaoLink.getGoods().getCouponAmount()).toString())
|
| | | .replace("[券后价]", "¥" + TaoBaoUtil.getAfterUseCouplePrice(taoBaoLink.getGoods()));
|
| | | }
|
| | | shareText = shareText.replace("[价格类型]", shopType);
|
| | |
| | | data.put("notifyDesc", configService.get("goods_share_notify"));
|
| | |
|
| | | // 添加分享记录
|
| | | BigDecimal rate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal rate = hongBaoManageService.getShareRate();
|
| | | UserShareGoodsHistory history = new UserShareGoodsHistory();
|
| | | history.setTkCode(taoBaoLink.getTaoToken());
|
| | | history.setLink(taoBaoLink.getClickUrl());
|
| | |
| | | history.setUser(new UserInfo(uid));
|
| | | history.setPostPicture(taoBaoLink.getGoods().getPictUrl());
|
| | |
|
| | | data.put("shareMoney","¥"+ history.getHongbao().toString());
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | | // 异步操作
|
| | |
| | | public void run() {
|
| | | shareGoodsService.addShareGoodsHistory(history);
|
| | | try {
|
| | | userShareGoodsRecordService.save(uid, ShareSourceTypeEnum.goodsDetail, taoBaoLink.getGoods());
|
| | | userShareGoodsRecordService.save(uid, ShareSourceTypeEnum.goodsDetail, null,taoBaoLink.getGoods());
|
| | | } catch (UserShareGoodsRecordException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 分享记录统计列表
|
| | | *
|
| | |
| | |
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | }
|
| | |
|
| | | if ("all".equals(source)) {
|
| | | source = null;// 查询全部
|
| | | }
|
| | |
|
| | | try {
|
| | |
| | | }
|
| | |
|
| | | try {
|
| | | JSONObject data = userShareGoodsGroupService.getGoodsGroup(recordId);
|
| | | JSONObject data = userShareGoodsRecordService.getGoodsGroup(recordId);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("加载失败"));
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 商品详情分享
|
| | | * @param acceptData
|
| | | * @param uid 用户id
|
| | | * @param auctionId 商品id
|
| | | * @param type 图片分享类型 单图single 多图many |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "sharedetail", method = RequestMethod.POST)
|
| | | public void shareDetail(AcceptData acceptData, Long uid, Long auctionId, String type, PrintWriter out) {
|
| | | try {
|
| | | userShareGoodsRecordService.saveDetail(uid, auctionId, type);
|
| | | out.print(JsonUtil.loadTrueResult("分享成功"));
|
| | | } catch (UserShareGoodsRecordException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | e.printStackTrace();
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("加载失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 更新分享记录
|
| | | * @param acceptData
|
| | | * @param shareId
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "updaterecord", method = RequestMethod.POST)
|
| | | public void updateRecord(AcceptData acceptData, Long shareId, PrintWriter out) {
|
| | | if (shareId == null) {
|
| | | out.print(JsonUtil.loadFalseResult("参数不正确"));
|
| | | }
|
| | | |
| | | try {
|
| | | userShareGoodsRecordService.updateShareRecord(shareId);
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | } catch (UserShareGoodsRecordException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | e.printStackTrace();
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("加载失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | }
|