This commit is contained in:
parent
968576e58c
commit
096d2ea2fd
|
@ -87,3 +87,4 @@ create table datas (
|
|||
) comment = '通用配置表';
|
||||
insert into datas (`key`, data) values ('from_type', '{}');
|
||||
insert into datas (`key`, data) values ('last_month_sell', '{}');
|
||||
insert into datas (`key`, data) values ('hour_sell', '{}');
|
||||
|
|
|
@ -82,7 +82,6 @@ $(function(){
|
|||
|
||||
|
||||
|
||||
//主要症状
|
||||
var histogramChart2 = echarts.init(document.getElementById('histogramChart2'));
|
||||
histogramChart2.setOption({
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
</div>
|
||||
<div class="left div_any01" style="width:41.5%;">
|
||||
<div class="div_any_child" style="height: 420px;">
|
||||
<div class="div_any_title"><img src="{% static "images/title_14.png" %}">时段访问占比</div>
|
||||
<div class="div_any_title"><img src="{% static "images/title_14.png" %}">时段购买占比</div>
|
||||
<p id="histogramChart2" class="p_chart" style="height: 400px;"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -57,6 +57,15 @@ def collect_last_month_sells(spark):
|
|||
data[month] = jd_comment_count
|
||||
mysql_execute("update datas set data = '{}' where `key` = 'last_month_sell'".format( json.dumps(data,ensure_ascii=False) ))
|
||||
|
||||
def collect_hour_sells(spark):
|
||||
data = {}
|
||||
for i in range(24):
|
||||
hour = "%02d" % (i)
|
||||
df = spark.sql("select count(*) as N from jd_comment where comment_time like '% "+hour+":%'")
|
||||
jd_comment_count = df.rdd.collect()[0]["N"]
|
||||
data[hour] = jd_comment_count
|
||||
|
||||
mysql_execute("update datas set data = '{}' where `key` = 'hour_sell'".format( json.dumps(data,ensure_ascii=False) ))
|
||||
|
||||
|
||||
def collect_crawl_info(spark):
|
||||
|
@ -137,6 +146,7 @@ if __name__ == "__main__":
|
|||
collect_top10_sells(spark)
|
||||
collect_from_type(spark)
|
||||
collect_last_month_sells(spark)
|
||||
collect_hour_sells(spark)
|
||||
count = 1
|
||||
|
||||
time.sleep(10)
|
||||
|
|
Loading…
Reference in New Issue