admin
2019-07-17 d05d72ebe95caa55247ff4fb97c8479a5d8e2583
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.yeshi.fanli.service.impl.pdd;
 
import java.util.List;
 
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
 
import com.yeshi.fanli.service.inter.pdd.PDDGoodsService;
import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil;
 
@Service
public class PDDGoodsServiceImpl implements PDDGoodsService {
 
    @Cacheable(value = "pddCache", key = "'getDetailImageList'+#id")
    @Override
    public List<String> getDetailImageList(Long id) {
        List<String> list = null;
        int count = 0;
        // 重试3次
        while ((list == null || list.size() == 0) && count < 3) {
            list = PinDuoDuoUtil.getDetailImages(id);
            count++;
        }
        return list;
    }
 
}