Commit f1da1220 authored by 李小芳's avatar 李小芳

add

parent 99ef99ae
...@@ -184,7 +184,7 @@ class Diary(models.Model): ...@@ -184,7 +184,7 @@ class Diary(models.Model):
logging.error("catch exception,err_msg:%s" % traceback.format_exc()) logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return '' return ''
def get_keynote_sentence(user_id=None, id=None): def get_keynote_sentence(self, user_id=None, id=None):
try: try:
result = Problems.objects.filter(user_id=user_id, topic_type__in=["0", "1", "2"], diary_id=id, result = Problems.objects.filter(user_id=user_id, topic_type__in=["0", "1", "2"], diary_id=id,
is_online=True).order_by('-last_modified').values_list( is_online=True).order_by('-last_modified').values_list(
...@@ -216,7 +216,6 @@ class Diary(models.Model): ...@@ -216,7 +216,6 @@ class Diary(models.Model):
logging.error("catch exception,err_msg:%s" % traceback.format_exc()) logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return '' return ''
def get_hot_score(self, reply_num): def get_hot_score(self, reply_num):
try: try:
now = datetime.datetime.now() now = datetime.datetime.now()
...@@ -260,7 +259,8 @@ class Diary(models.Model): ...@@ -260,7 +259,8 @@ class Diary(models.Model):
def get_good_click(self): def get_good_click(self):
try: try:
results = list( results = list(
PageGoodClick.objects.using(settings.DORIS_DB_NAME).filter(business_id=self.id, page_name="diary_detail") PageGoodClick.objects.using(settings.DORIS_DB_NAME).filter(business_id=self.id,
page_name="diary_detail")
.order_by('-create_date').values_list("avg_new_gc", flat=True)) .order_by('-create_date').values_list("avg_new_gc", flat=True))
good_click_score = results and results[0] or 0 good_click_score = results and results[0] or 0
return good_click_score return good_click_score
...@@ -1259,7 +1259,6 @@ class PageGoodClick(models.Model): ...@@ -1259,7 +1259,6 @@ class PageGoodClick(models.Model):
db_table = 'al_community_detail_page_goodclick_v2' db_table = 'al_community_detail_page_goodclick_v2'
app_label = 'doris' app_label = 'doris'
page_name = models.CharField(max_length=50) page_name = models.CharField(max_length=50)
business_id = models.CharField(max_length=50) business_id = models.CharField(max_length=50)
detail_uv = models.IntegerField() detail_uv = models.IntegerField()
...@@ -1270,7 +1269,6 @@ class PageGoodClick(models.Model): ...@@ -1270,7 +1269,6 @@ class PageGoodClick(models.Model):
create_date = models.CharField(max_length=50) create_date = models.CharField(max_length=50)
class CpcPromote(models.Model): class CpcPromote(models.Model):
class Meta: class Meta:
db_table = 'cpc_community_communitypromote' db_table = 'cpc_community_communitypromote'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment