| | |
| | |
|
| | | String token = "";
|
| | | if (!StringUtil.isNullOrEmpty(tb.getCouponLink())) {
|
| | | token = TaoKeApiUtil.getTKToken(tb.getPictUrl(), tb.getTitle(), tb.getCouponLink());
|
| | | tb.setCouponLinkTaoToken(token);
|
| | | token = redisManager.getCommonTaoToken(tb.getAuctionId());
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | token = TaoKeApiUtil.getTKToken(tb.getPictUrl(), tb.getTitle(), tb.getCouponLink());
|
| | | redisManager.saveCommonTaoToken(tb.getAuctionId(), token);
|
| | | }
|
| | | }
|
| | | tb.setCouponLinkTaoToken(token);
|
| | |
|
| | | // 服务端转链
|
| | | if (convertInServer && !StringUtil.isNullOrEmpty(tb.getCouponLink())) {
|
| | |
| | | */
|
| | | @RequestMapping(value = "getHomeMsgList", method = RequestMethod.POST)
|
| | | public void getHomeMsgList(AcceptData acceptData, Long uid, int page, HttpSession session, PrintWriter out) {
|
| | | |
| | |
|
| | | String device = acceptData.getDevice();
|
| | | if (device == null || device.trim().length() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("设备号不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | 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);
|
| | | |
| | |
|
| | | if (goods == null) {
|
| | | canAdd = true;
|
| | | } else {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | //String key = "recommend-goods-user-" + uid;
|
| | | // String key = "recommend-goods-user-" + uid;
|
| | | String key = "recommend-goods-user-" + device;
|
| | | if (Constant.IS_OUTNET) {
|
| | | if (canAdd && StringUtil.isNullOrEmpty(redisManager.getCommonString(key))) {
|
| | |
| | | }
|
| | |
|
| | | 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();
|
| | |
| | | volist.add(vo);
|
| | | }
|
| | |
|
| | | Long time = System.currentTimeMillis();//userInfoService.selectByPKey(uid).getCreatetime();
|
| | | Long time = System.currentTimeMillis();// userInfoService.selectByPKey(uid).getCreatetime();
|
| | | if (time > TimeUtil.convertToTimeTemp("2019-01-28", "yyyy-MM-dd"))
|
| | | count++;// 计算欢迎语的数量
|
| | |
|
| | |
| | | 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 void addRecommend(Long uid, String device, String recommendDesc, List<CommonGoods> goodsList)
|
| | | throws RecommendUserGoodsException;
|
| | | |
| | |
|
| | | /**
|
| | | *
|
| | | * @param uid
|
| | | * @param commonGoodsId
|
| | | * @return
|
| | | */
|
| | | public List<RecommendUserGoodsMap> listByUidAndCommonGoodsId(Long uid,Long commonGoodsId);
|
| | | |
| | | public List<RecommendUserGoodsMap> listByUidAndCommonGoodsId(Long uid, Long commonGoodsId);
|
| | |
|
| | | /**
|
| | | *
|
| | | * @param uid
|
| | | * @param commonGoodsId
|
| | | * @return
|
| | | */
|
| | | public Long countByUidAndCommonGoodsId(Long uid,Long commonGoodsId);
|
| | | |
| | | public Long countByUidAndCommonGoodsId(Long uid, Long commonGoodsId);
|
| | |
|
| | | /**
|
| | | * 获取推荐列表
|
| | |
| | | * @return
|
| | | */
|
| | | public long countRecommend(Long uid);
|
| | | |
| | |
|
| | | public RecommendUserGoods getLatestRecommendUserGoods(Long uid);
|
| | |
|
| | | /**
|
| | | * 根据设备获取最近的推荐
|
| | | * 根据设备获取最近的推荐
|
| | | * |
| | | * @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);
|
| | |
|
| | | }
|
| | |
| | | String key = "smsstate-alipay-" + phone;
|
| | | return !StringUtil.isNullOrEmpty(getString(key));
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 缓存短连接1分钟
|
| | | * |
| | | * @param uid
|
| | | * @param shortlink
|
| | | */
|
| | |
| | | String key = "invite-shortlink-" + uid;
|
| | |
|
| | | if (Constant.IS_OUTNET) {
|
| | | |
| | |
|
| | | value = getCommonString(key);
|
| | | |
| | |
|
| | | if (StringUtil.isNullOrEmpty(value)) {
|
| | | cacheCommonString(key, shortlink, 60);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 获取用户短连接
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public String getInviteShortLink(long uid) {
|
| | | |
| | |
|
| | | String value = "";
|
| | | String key = "invite-shortlink-" + uid;
|
| | | |
| | |
|
| | | if (Constant.IS_OUTNET)
|
| | | value = getCommonString(key);
|
| | | |
| | |
|
| | | 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;
|
| | | }
|
| | |
|
| | | }
|