| | |
| | | JSONObject data = new JSONObject();
|
| | | boolean isNative = false;
|
| | | String pid = null;
|
| | | |
| | |
|
| | | String specialId = null;
|
| | | // 查询用户ID是否绑定了会员运营ID
|
| | | UserExtraTaoBaoInfo userInfo = userExtraTaoBaoInfoService.getByUid(uid);
|
| | | if (userInfo != null && !StringUtil.isNullOrEmpty(userInfo.getSpecialId()) && userInfo.getSpecialValid() != null
|
| | | && userInfo.getSpecialValid() == true) {
|
| | | specialId = userInfo.getSpecialId();
|
| | | // 已经绑定
|
| | | try {
|
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.getSimpleGoodsInfo(auctionId);
|
| | |
| | | } else {// 尚未绑定
|
| | | isNative = true;
|
| | | }
|
| | | |
| | | data.put("native", isNative);
|
| | | |
| | |
|
| | | try {
|
| | | int pidType = PidUser.TYPE_FANLI_ANDROID;
|
| | | if (acceptData.getPlatform().equalsIgnoreCase("ios"))
|
| | | pidType = PidUser.TYPE_FANLI_IOS;
|
| | | |
| | | TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForBuy(uid, auctionId, pidType);
|
| | |
|
| | | TaoBaoLink taoBaoLink = null;
|
| | | if (!StringUtil.isNullOrEmpty(specialId)) {
|
| | | taoBaoLink = shareGoodsService.getTaoBaoLinkForBuyWithSpecial(uid, specialId, auctionId);
|
| | | } else {
|
| | | taoBaoLink = shareGoodsService.getTaoBaoLinkForBuy(uid, auctionId, pidType);
|
| | | }
|
| | |
|
| | | JSONObject link = new JSONObject();
|
| | | link.put("clickUrl", taoBaoLink.getClickUrl());
|
| | | link.put("couponUrl", taoBaoLink.getCouponLink());
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | | isNative = false;
|
| | | try {
|
| | | monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, 0, 0, "购买淘宝商品转链出错"));
|
| | | } catch (Exception e1) {
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "请求失败"));
|
| | | }
|
| | | }
|
| | | data.put("native", isNative);
|
| | |
|
| | | }
|
| | |
|
| | |
| | |
|
| | | JSONObject shareActivity = new JSONObject();
|
| | | shareActivity.put("moneyDesc", "春节狂欢奖金:¥" + TaoBaoUtil.getGoodsHongBaoMoney(tb,
|
| | | new BigDecimal(configService.get("share_activity_proportion")).divide(new BigDecimal(100))));
|
| | | new BigDecimal(hongBaoManageService.get("share_activity_proportion"))));
|
| | | shareActivity.put("ruleDescPicture", "http://img.flqapp.com/resource/share_activity_img.png");
|
| | |
|
| | | data.put("shareActivity", shareActivity);
|
| | |
| | | UserExtraTaoBaoInfo extraInfo = userExtraTaoBaoInfoService.getByUid(uid);
|
| | | try {
|
| | | String relationId = null;
|
| | | if (extraInfo.getRelationId() != null && extraInfo.getRelationValid() != null
|
| | | if (extraInfo != null && extraInfo.getRelationId() != null && extraInfo.getRelationValid() != null
|
| | | && extraInfo.getRelationValid() == true)
|
| | | relationId = extraInfo.getRelationId();
|
| | | TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, auctionId, relationId);
|
| | |
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.util.AESUtil;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | /**
|
| | | * 获取淘宝授权信息
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | if (!"1".equalsIgnoreCase(configService.get("open_speical_and_relation_apply"))) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "暂不开放申请"));
|
| | | return;
|
| | | }
|
| | |
|
| | | //
|
| | | UserExtraTaoBaoInfo user = userExtraTaoBaoInfoService.getByUid(uid);
|
| | | if ("share".equalsIgnoreCase(source)) {
|
| | |
| | | }
|
| | |
|
| | | String link = TaoBaoUtil.getTaoBaoUnionAuthUrl(Constant.TAOBAO_AUTH_APPKEY,
|
| | | "http://192.168.1.122:8080/fanli/client/v1/auth/callback/tb", uid, source);
|
| | | "http://test.flqapp.com/fanli/client/v1/auth/callback/tb", uid, source);
|
| | |
|
| | | String orderJS = "var orderId= document.getElementById('tp-bought-root').getElementsByClassName('js-order-container')[0].getElementsByTagName('div')[0].getAttribute('data-id');";
|
| | | orderJS += "if(/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {window.location.href='yestv://taobaoorder#'+orderId;} else {window.handle.showOrder(orderId)}";
|
| | |
| | | canAdd = true;
|
| | | } else {
|
| | | // 是否和上次间隔时间足够
|
| | | if (System.currentTimeMillis() - goods.getCreateTime().getTime() >= 1000 * 60 * 60 * 8L) {
|
| | | if (System.currentTimeMillis() - goods.getCreateTime().getTime() >= 1000 * 60 * 60 * 4L) {
|
| | | canAdd = true;
|
| | | }
|
| | | }
|
| | |
| | | |
| | | <!-- 根据UID或者设备号获取浏览记录 --> |
| | | <select id="selectByDeviceOrUid" resultMap="BaseResultMap"> |
| | | SELECT s.*,MAX(s.`s_createtime`) AS orderid FROM yeshi_ec_scanhistory_v2 s |
| | | select * from (SELECT s.* FROM yeshi_ec_scanhistory_v2 s |
| | | WHERE |
| | | <trim prefix="(" suffix=")" suffixOverrides="or"> |
| | | <if test="uid != null"> s.`s_uid`=#{uid,jdbcType=BIGINT} or</if> |
| | | <if test="device != null">s.`s_device`=#{device,jdbcType=VARCHAR} or</if> |
| | | </trim> |
| | | GROUP BY s.`s_common_goods_id` ORDER BY orderid DESC limit |
| | | GROUP BY s.`s_common_goods_id` |
| | | ) s |
| | | order by s.s_createtime DESC |
| | | limit |
| | | #{start},#{count} |
| | | </select> |
| | | |
| | |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{device,jdbcType=VARCHAR},#{userInfo.id,jdbcType=BIGINT},#{commonGoods.id,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | |
| | | |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.goods.ScanHistoryV2" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_scanhistory_v2 |
| | |
| | | if (tbPid == null) {
|
| | | throw new ShareGoodsException(3, "获取推广位失败");
|
| | | }
|
| | | String appId = tbPid.getPid().split("_")[2];
|
| | | String adzoneId = tbPid.getPid().split("_")[3];
|
| | | return getTaoBaoLink(uid, auctionId, tbPid.getPid());
|
| | | }
|
| | |
|
| | | public TaoBaoLink getTaoBaoLink(Long uid, Long auctionId, String pid) throws ShareGoodsException {
|
| | |
|
| | | if (uid == null || uid <= 0) {
|
| | | throw new ShareGoodsException(1, "用户ID不能为空");
|
| | | }
|
| | |
|
| | | if (auctionId == null || auctionId <= 0) {
|
| | | throw new ShareGoodsException(2, "商品ID不能为空");
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(pid)) {
|
| | | throw new ShareGoodsException(3, "无推广位");
|
| | | }
|
| | |
|
| | | String appId = pid.split("_")[2];
|
| | | String adzoneId = pid.split("_")[3];
|
| | | TaoBaoUnionConfig taoBaoUnionConfig = taoBaoUnionConfigService.getConfigByAppIdCache(appId);
|
| | |
|
| | | TaoKeAppInfo info = new TaoKeAppInfo();
|
| | | info.setAdzoneId(adzoneId);
|
| | | info.setAppKey(taoBaoUnionConfig.getAppKey());
|
| | | info.setAppSecret(taoBaoUnionConfig.getAppSecret());
|
| | | info.setPid(tbPid.getPid());
|
| | | info.setPid(pid);
|
| | | TaoBaoGoodsBrief goods = null;
|
| | | try {
|
| | | goods = TaoKeApiUtil.searchGoodsDetailForConvert(auctionId, info);
|
| | |
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(goods.getCouponLink()) && !goods.getAuctionUrl().contains("s.click.taobao.com")) {
|
| | | TaoBaoLink taoBaoLink = TaoBaoUtil.getTbLinkForShare(auctionId, tbPid.getPid(), taoBaoUnionConfig);
|
| | | TaoBaoLink taoBaoLink = TaoBaoUtil.getTbLinkForShare(auctionId, pid, taoBaoUnionConfig);
|
| | | if (taoBaoLink == null) {
|
| | | throw new ShareGoodsException(201, "商品转链失败");
|
| | | }
|
| | |
| | | @Override
|
| | | public TaoBaoLink getTaoBaoLinkForBuyWithSpecial(Long uid, String specialId, Long auctionId)
|
| | | throws ShareGoodsException {
|
| | | return null;
|
| | | if (uid == null || uid <= 0) {
|
| | | throw new ShareGoodsException(1, "用户ID不能为空");
|
| | | }
|
| | |
|
| | | if (auctionId == null || auctionId <= 0) {
|
| | | throw new ShareGoodsException(2, "商品ID不能为空");
|
| | | }
|
| | |
|
| | | return getTaoBaoLink(uid, auctionId, Constant.TAOBAO_SPECIAL_PID_DEFAULT);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.goods;
|
| | |
|
| | | /**
|
| | | * 商品分享活动
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class GoodsShareActivityService {
|
| | |
|
| | | }
|