| | |
| | |
|
| | | String token = "";
|
| | | if (!StringUtil.isNullOrEmpty(tb.getCouponLink())) {
|
| | | token = redisManager.getCommonTaoToken(tb.getAuctionId());
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | token = TaoKeApiUtil.getTKToken(tb.getPictUrl(), tb.getTitle(), tb.getCouponLink());
|
| | | tb.setCouponLinkTaoToken(token);
|
| | | redisManager.saveCommonTaoToken(tb.getAuctionId(), token);
|
| | | }
|
| | | }
|
| | | tb.setCouponLinkTaoToken(token);
|
| | |
|
| | | // 服务端转链
|
| | | if (convertInServer && !StringUtil.isNullOrEmpty(tb.getCouponLink())) {
|
| | |
| | | }
|
| | |
|
| | | if (page == 1) {
|
| | | if (uid != null)
|
| | | recommendUserGoodsService.syncDeviceAndUid(uid, acceptData.getDevice());
|
| | |
|
| | | boolean canAdd = false;
|
| | | int hour = Calendar.getInstance().get(Calendar.HOUR);
|
| | | RecommendUserGoods goods = recommendUserGoodsService.getLatestRecommendUserGoodsByDevice(device);
|
| | |
| | |
|
| | | List<UserHomeMsgVO> volist = new ArrayList<>();
|
| | |
|
| | | List<RecommendUserGoods> list = recommendUserGoodsService.listRecommendGoodsByDevice(device, page, Constant.PAGE_SIZE);
|
| | | List<RecommendUserGoods> list = recommendUserGoodsService.listRecommendGoodsByDevice(device, page,
|
| | | Constant.PAGE_SIZE);
|
| | | long count = recommendUserGoodsService.countRecommendGoodsByDevice(device);
|
| | |
|
| | | Date now = new Date();
|
| | |
| | | import com.yeshi.fanli.exception.goods.RecommendUserGoodsException;
|
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendUserGoodsService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | | public class RecommendUserGoodsServiceImpl implements RecommendUserGoodsService {
|
| | |
| | | return recommendUserGoodsMapper.countRecommendGoodsByDevice(device);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void syncDeviceAndUid(Long uid, String targetDevice) {
|
| | |
|
| | | List<RecommendUserGoods> list = recommendUserGoodsMapper.listRecommendGoods(uid, 0, 20);
|
| | | for (RecommendUserGoods ru : list) {
|
| | | if (StringUtil.isNullOrEmpty(ru.getDevice())) {
|
| | | RecommendUserGoods update = new RecommendUserGoods();
|
| | | update.setId(ru.getId());
|
| | | update.setDevice(targetDevice);
|
| | | recommendUserGoodsMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public Long countByUidAndCommonGoodsId(Long uid,Long commonGoodsId);
|
| | |
|
| | |
|
| | | /**
|
| | | * 获取推荐列表
|
| | | *
|
| | |
| | |
|
| | | /**
|
| | | * 根据设备获取最近的推荐
|
| | | * |
| | | * @param device
|
| | | * @return
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 根据设备号查询
|
| | | * |
| | | * @param device
|
| | | * @param page
|
| | | * @param pageSize
|
| | |
| | |
|
| | | /**
|
| | | * 根据设备号统计
|
| | | * |
| | | * @param device
|
| | | * @return
|
| | | */
|
| | | public long countRecommendGoodsByDevice(String device);
|
| | |
|
| | | /**
|
| | | * 将用户ID的推荐记录同步到设备
|
| | | * |
| | | * @param uid
|
| | | * @param targetDevice
|
| | | */
|
| | | public void syncDeviceAndUid(Long uid, String targetDevice);
|
| | |
|
| | | }
|
| | |
| | | return !StringUtil.isNullOrEmpty(getString(key));
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 缓存短连接1分钟
|
| | | * |
| | | * @param uid
|
| | | * @param shortlink
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 获取用户短连接
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | |
| | | return value;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 保存淘口令
|
| | | * |
| | | * @param auctionId
|
| | | * @param token
|
| | | */
|
| | | public void saveCommonTaoToken(Long auctionId, String token) {
|
| | | String key = "taobao-common-token-" + auctionId;
|
| | | if (Constant.IS_OUTNET) {
|
| | | if (!StringUtil.isNullOrEmpty(token)) {
|
| | | // 口令缓存24小时
|
| | | cacheCommonString(key, token, 60 * 60 * 24);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取用户短连接
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public String getCommonTaoToken(Long auctionId) {
|
| | | String key = "taobao-common-token-" + auctionId;
|
| | |
|
| | | if (Constant.IS_OUTNET) {
|
| | | return getCommonString(key);
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | }
|