| | |
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.exception.tlj.TaoLiJinCreateException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.log.TaoKeLogHelper;
|
| | | import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.recommend.RecommendGoodsDeleteHistoryService;
|
| | | import com.yeshi.fanli.service.inter.integral.IntegralGetService;
|
| | | import com.yeshi.fanli.service.inter.monitor.BusinessEmergent110Service;
|
| | | import com.yeshi.fanli.service.inter.monitor.MonitorService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJFreeBuyGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoBuyRelationMapService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.TBPidService;
|
| | | import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralGetService;
|
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.factory.MonitorFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
| | |
|
| | | @Resource
|
| | | private IntegralGetService integralGetService;
|
| | |
|
| | | @Resource
|
| | | private TLJFreeBuyGoodsService tljFreeBuyGoodsService;
|
| | |
|
| | | private void doTaoLiJinBuy(AcceptData acceptData, Long uid, Long auctionId, PrintWriter out) {
|
| | | JSONObject data = new JSONObject();
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | // 日志记录
|
| | | String info = String.format("type=buy&uid=%s&goodsId=%s&source=%s&goodsType=%s", uid, auctionId, source,
|
| | | Constant.SOURCE_TYPE_TAOBAO);
|
| | | LogHelper.orderInfo(info);
|
| | | } catch (Exception e) {
|
| | | }
|
| | |
|
| | | TaoBaoGoodsBrief goods = null;
|
| | |
|
| | | try {
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | ClientTBPid clientTBPid = null;
|
| | |
|
| | | String dpid = null;
|
| | | if (TaoBaoUtil.isSpecialGoods(goods.getMaterialLibType())) {
|
| | | dpid = TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT;
|
| | | } else {
|
| | | dpid = TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID;
|
| | | }
|
| | | String psiteId = dpid.split("_")[2];
|
| | | String padzoneId = dpid.split("_")[3];
|
| | | TaoBaoUnionConfig config1 = taoBaoUnionConfigService.getConfigByAppIdCache(psiteId);
|
| | | clientTBPid = new ClientTBPid(config1.getAppKey(), dpid, psiteId, padzoneId);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | boolean isNative = false;
|
| | | String pid = null;
|
| | |
|
| | | boolean specialConvert = false;
|
| | |
|
| | | if (goods.getMaterialLibType() != null && goods.getMaterialLibType() == 1) {
|
| | | if (TaoBaoUtil.isSpecialGoods(goods.getMaterialLibType())) {
|
| | | specialConvert = true;
|
| | | } else
|
| | | specialConvert = false;
|
| | |
| | | // 是返利商品库的商品
|
| | | if (specialConvert) {
|
| | | if (!StringUtil.isNullOrEmpty(specialId)) {
|
| | | if (source != null && "taolijin".equals(source)) {
|
| | | boolean isNewUser = userInfoExtraService.isNewUser(uid);
|
| | | if (isNewUser) {
|
| | | // 判定为老用户:
|
| | | // 新人只要使用了新人红包,也就是那1块钱,那么,他看到的分享爆款中的商品-就只能分享。
|
| | | long countRecord = userTaoLiJinRecordService.countRecordByUid(uid);
|
| | | if (countRecord == 0) {
|
| | | taoBaoLink = shareGoodsService.getTaoLiJinLinkForBuy(uid, specialId, auctionId, null);
|
| | | }
|
| | | }
|
| | | if (source != null && "taolijin_free_buy".equals(source)) {
|
| | | taoBaoLink = shareGoodsService.getTaoLiJinLinkForBuy(uid, specialId, auctionId, null);
|
| | | }
|
| | |
|
| | | if (taoBaoLink == null) {
|
| | | taoBaoLink = shareGoodsService.getTaoBaoLinkForBuyWithSpecial(uid, specialId, auctionId);
|
| | | if(taoBaoLink!=null)
|
| | | clientTBPid=null;
|
| | | }
|
| | |
|
| | | data.put("native", true);
|
| | |
| | | LogHelper.errorDetailInfo(e, "uid:" + uid, null);
|
| | | }
|
| | | if (!StringUtil.isNullOrEmpty(relationId)) {//
|
| | | if (source != null && "taolijin".equals(source)) {
|
| | | boolean isNewUser = userInfoExtraService.isNewUser(uid);
|
| | | if (isNewUser) {
|
| | | // 判定为老用户:
|
| | | // 新人只要使用了新人红包,也就是那1块钱,那么,他看到的分享爆款中的商品-就只能分享。
|
| | | long countRecord = userTaoLiJinRecordService.countRecordByUid(uid);
|
| | | if (countRecord == 0) {
|
| | | taoBaoLink = shareGoodsService.getTaoLiJinLinkForBuy(uid, specialId, auctionId,
|
| | | TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID);
|
| | | }
|
| | | }
|
| | | if (source != null && "taolijin_free_buy".equals(source)) {
|
| | | taoBaoLink = shareGoodsService.getTaoLiJinLinkForBuy(uid, specialId, auctionId,
|
| | | TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID);
|
| | | } else {
|
| | | taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, auctionId, relationId,
|
| | | TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID);
|
| | |
| | | link.put("couponUrl", taoBaoLink.getCouponLink());
|
| | | data.put("type", 1);
|
| | | data.put("link", link);
|
| | | if (clientTBPid != null)
|
| | | data.put("tbPidInfo", clientTBPid);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | | TaoKeLogHelper.convertLinkInfo(
|
| | | String.format("uid:%s auctionId:%s 输出结果:", uid, auctionId + "") + data.toString());
|
| | |
|
| | | // 获得金币
|
| | | integralGetService.addCouponRebate(uid);
|
| | |
|
| | | } catch (ShareGoodsException e) {
|
| | | if (e.getCode() == 1001 || e.getCode() == 1002) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | } else {
|
| | | out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
|
| | | }
|
| | | } catch (Exception e) {
|
| | |
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | | String siteId = tbPid.getPid().split("_")[2];
|
| | | String adzoneId = tbPid.getPid().split("_")[3];
|
| | | TaoBaoUnionConfig config = taoBaoUnionConfigService.getConfigByAppIdCache(siteId);
|
| | | ClientTBPid clientTBPid = new ClientTBPid(config.getAppKey(), tbPid.getPid(), siteId, adzoneId);
|
| | | ClientTBPid clientTBPid1 = new ClientTBPid(config.getAppKey(), tbPid.getPid(), siteId, adzoneId);
|
| | | data.put("type", 2);
|
| | | data.put("tbPidInfo", clientTBPid);
|
| | | data.put("tbPidInfo", clientTBPid1);
|
| | | data.put("native", true);
|
| | | }
|
| | |
|