| 12345678910111213141516171819202122232425262728293031323334 |
- from .base import BaseStrategy
- class GetTopArticleStrategy(BaseStrategy):
- @staticmethod
- def base() -> str:
- query = """
- SELECT title, sum(view_count) as total_view_count, sum(fans) as total_fan_count
- FROM datastat_sort_strategy
- WHERE position = 1 and gh_id = %s AND date_str >= '20250501' AND view_count > 1000
- GROUP BY title
- ORDER BY sum(view_count) / sum(fans) DESC
- LIMIT 25;
- """
- return query
- @staticmethod
- def strategy_v1() -> str:
- query = """
- SELECT title, sum(view_count) as total_view_count, sum(fans) as total_fan_count
- FROM datastat_sort_strategy
- WHERE position = 1 and gh_id = %s AND date_str >= '20250501' AND view_count > 1000
- GROUP BY title
- ORDER BY sum(view_count) / sum(fans) DESC
- LIMIT 25;
- """
- return query
- @staticmethod
- def strategy_v2() -> str:
- query = """
- SELECT date_str, title, view_count from datastat_sort_strategy where position = 1 and gh_id = %s
- """
- return query
|