예제 #1
0
def brand_data(request):
    url = request.get_full_path()
    # url = 'http://localhost:9000/data/?price_range=0%2C1000&sales_range=0%2C1000&collect_range=0%2C1000&start_date=0&end_date=-1&limit=25&offset=0&search=&_=1524989156915 '
    server = SearchServer()
    data = server.start(url)
    # data["total"] = 100
    return HttpResponse(json.dumps(data), content_type="application/json")
예제 #2
0
def brand(request):
    brand = request.GET['brand']
    bin = SearchServer()
    brandTopShop = bin.start(method='brandTopShop', param='brand=' + brand[1:])  # brandTopItem
    brandTopItem = bin.start(method='brandTopItem', param='brand=' + brand[1:])
    brandName = brand.replace("\\", "").replace("xa0", "")
    return render(request, '品牌详细分析.html',
                  {'brandTopShop': brandTopShop, 'brandTopItem': brandTopItem, 'brand': brand, "brandName": brandName})
예제 #3
0
def item_analysis(request):
    itemId = request.GET['itemId']
    bin = SearchServer()
    data = bin.start(method='itemDetail', param='itemId=' + itemId)
    s = data[0]["destailsDict"]
    s = s.replace("[", "").replace("]", "").replace("}", "").replace("{", "").replace("'", "").replace("'", "").replace(
        "\\xa0", "")
    details = s.split(",")
    titleAndItemImg = bin.itemImage(itemId)
    title = titleAndItemImg[0]
    itemImg = titleAndItemImg[1]
    print(details)
    return render(request, "商品详情分析.html", {'details': details, 'itemImg': itemImg, 'title': title, 'itemId': itemId})
예제 #4
0
def itemTrend(request):
    itemId = request.GET['itemId']
    bin = SearchServer()
    data = bin.start(method='itemTrend', param='itemId=' + itemId)
    return HttpResponse(json.dumps(data), content_type="application/json")
예제 #5
0
def dian_pu_analysis(request):
    shopUrl = request.GET['shopUrl']
    bin = SearchServer()
    shopImage = bin.shopImage(shopUrl)
    shopTopItem = bin.start(method='shopTopItem', param='shopUrl=' + shopUrl)
    return render(request, '店铺详细分析.html', {'shopImage': shopImage, 'shopTopItem': shopTopItem, 'shopUrl': shopUrl})
예제 #6
0
def shopEmotion(request):
    shopUrl = request.GET['shopUrl']
    bin = SearchServer()
    data = bin.start(method='shopEmotion', param='shopUrl=' + shopUrl)
    return HttpResponse(json.dumps(data), content_type="application/json")
예제 #7
0
def brandSource(request):
    brand = request.GET['brand']
    bin = SearchServer()
    data = bin.start(method='brandSource', param='brand=' + brand)
    return HttpResponse(json.dumps(data), content_type="application/json")