This commit is contained in:
parent
aa1067aa96
commit
955b3b1a15
|
@ -88,3 +88,4 @@ create table datas (
|
||||||
insert into datas (`key`, data) values ('from_type', '{}');
|
insert into datas (`key`, data) values ('from_type', '{}');
|
||||||
insert into datas (`key`, data) values ('last_month_sell', '{}');
|
insert into datas (`key`, data) values ('last_month_sell', '{}');
|
||||||
insert into datas (`key`, data) values ('hour_sell', '{}');
|
insert into datas (`key`, data) values ('hour_sell', '{}');
|
||||||
|
insert into datas (`key`, data) values ('sentiments', '{}');
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
var top10_sells = {{top10_sells|safe}};
|
var top10_sells = {{top10_sells|safe}};
|
||||||
var last_month_sell = {{last_month_sell|safe}};
|
var last_month_sell = {{last_month_sell|safe}};
|
||||||
var hour_sell = {{hour_sell|safe}};
|
var hour_sell = {{hour_sell|safe}};
|
||||||
|
var sentiments = {{sentiments|safe}};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="{% static "scripts/Plugin/jquery-3.3.1.min.js" %}"></script>
|
<script src="{% static "scripts/Plugin/jquery-3.3.1.min.js" %}"></script>
|
||||||
|
|
|
@ -5,9 +5,11 @@ from myapp.models import CrawlInfos,PlatformInfos, News,LastDayCounts, Datas, To
|
||||||
from myapp.utils import get_platform_info
|
from myapp.utils import get_platform_info
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
return render(request, 'myapp/index.html')
|
return render(request, 'myapp/index.html')
|
||||||
|
|
||||||
|
|
||||||
def crawl(request):
|
def crawl(request):
|
||||||
# info = scrapy_client.get_scrapy_info()
|
# info = scrapy_client.get_scrapy_info()
|
||||||
crawl_info = CrawlInfos.objects.order_by('-id').first()
|
crawl_info = CrawlInfos.objects.order_by('-id').first()
|
||||||
|
@ -28,12 +30,20 @@ def crawl(request):
|
||||||
"last_day_product": json.dumps(last_day_product),
|
"last_day_product": json.dumps(last_day_product),
|
||||||
"last_day_comment": json.dumps(last_day_comment)})
|
"last_day_comment": json.dumps(last_day_comment)})
|
||||||
|
|
||||||
def result(request):
|
|
||||||
from_type_info = json.loads(Datas.objects.filter(key='from_type').first().data)
|
|
||||||
top10_sells = [entry for entry in Top10Sells.objects.order_by('id').values()]
|
|
||||||
|
|
||||||
last_month_sell = json.loads(Datas.objects.filter(key='last_month_sell').first().data)
|
def result(request):
|
||||||
|
from_type_info = json.loads(
|
||||||
|
Datas.objects.filter(key='from_type').first().data)
|
||||||
|
top10_sells = [
|
||||||
|
entry for entry in Top10Sells.objects.order_by('id').values()]
|
||||||
|
|
||||||
|
last_month_sell = json.loads(Datas.objects.filter(
|
||||||
|
key='last_month_sell').first().data)
|
||||||
|
|
||||||
hour_sell = json.loads(Datas.objects.filter(key='hour_sell').first().data)
|
hour_sell = json.loads(Datas.objects.filter(key='hour_sell').first().data)
|
||||||
|
sentiments = json.loads(Datas.objects.filter(key='sentiments').first().data)
|
||||||
return render(request, 'myapp/result.html', {"from_type_info": from_type_info,
|
return render(request, 'myapp/result.html', {"from_type_info": from_type_info,
|
||||||
"top10_sells": top10_sells, "last_month_sell": last_month_sell, "hour_sell": hour_sell})
|
"top10_sells": top10_sells,
|
||||||
|
"last_month_sell": last_month_sell,
|
||||||
|
"hour_sell": hour_sell,
|
||||||
|
"sentiments": sentiments})
|
||||||
|
|
Loading…
Reference in New Issue