1337.
This commit is contained in:
parent
eb4ec7208f
commit
9849b6ea12
@ -58,12 +58,15 @@ class BaseView(web.View):
|
||||
class EventView(BaseView):
|
||||
|
||||
document_fields = ['title','html','domain','href']
|
||||
|
||||
click_fields = ["event", "target"]
|
||||
event_fields = ['target','event','tag','scroll_height','scroll_left','scroll_top','client_width','client_height','page_x','page_y','screen_x','screen_y','client_x','client_y','target_x','target_y']
|
||||
|
||||
def is_document_record(self, data):
|
||||
return data.get('html') and True or False
|
||||
|
||||
def is_click_record(self,data):
|
||||
return data.get('event') == 'click'
|
||||
|
||||
def get_record(self, data):
|
||||
|
||||
try:
|
||||
@ -86,6 +89,16 @@ class EventView(BaseView):
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
record = {}
|
||||
for field in self.click_fields:
|
||||
if field in data:
|
||||
record[field] = data[field]
|
||||
if len(record.keys()) == len(self.click_fields):
|
||||
return record
|
||||
except:
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
async def get(self):
|
||||
@ -123,6 +136,10 @@ class EventView(BaseView):
|
||||
)
|
||||
self.insert('visit', record)
|
||||
self.app.view_count += 1
|
||||
elif self.is_click_record(data):
|
||||
data['visit_id'] = visit_id
|
||||
record = data
|
||||
self.insert('click', record)
|
||||
else:
|
||||
data['visit_id'] = visit_id
|
||||
record = data
|
||||
|
Loading…
Reference in New Issue
Block a user