| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 每天晚上11点50添加淘礼金
|
| | | */
|
| | | @Scheduled(cron = "0 50 23 * * ? ")
|
| | | public void autoAddTLJBuyGoods() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | String day = TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24L, "yyyy-MM-dd");
|
| | | List<TaoBaoGoodsBrief> list = tljBuyGoodsService.listPreGoods(1);
|
| | | Collections.shuffle(list);
|
| | | if (list.size() > 20)
|
| | | list = list.subList(0, 20);
|
| | | private void addTLJBuyGoods(List<TaoBaoGoodsBrief> list, String day) {
|
| | | for (TaoBaoGoodsBrief goods : list) {
|
| | | // 获取商品详情
|
| | | try {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 每天晚上11点50添加淘礼金1个商品,用于兼容Android前端没有商品不显示banner的问题
|
| | | */
|
| | | @Scheduled(cron = "0 50 23 * * ? ")
|
| | | public void autoAddTLJBuyGoods() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | String day = TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24L, "yyyy-MM-dd");
|
| | | List<TaoBaoGoodsBrief> list = tljBuyGoodsService.listPreGoods(1);
|
| | | Collections.shuffle(list);
|
| | | if (list.size() > 20)
|
| | | list = list.subList(0, 1);
|
| | | addTLJBuyGoods(list, day);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 每天凌晨5点过1分开始爬取剩余9个商品
|
| | | */
|
| | | @Scheduled(cron = "0 1 5 * * ? ")
|
| | | public void autoAddTLJBuyGoods2() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | String day = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd");
|
| | | List<TaoBaoGoodsBrief> list = tljBuyGoodsService.listPreGoods(1);
|
| | | Collections.shuffle(list);
|
| | | if (list.size() > 20)
|
| | | list = list.subList(0, 1);
|
| | | addTLJBuyGoods(list, day);
|
| | | }
|
| | |
|
| | | }
|