index.py 671 字节
Newer Older
梦想橡皮擦's avatar
梦想橡皮擦 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
import math

from flask import Blueprint, jsonify, request
from flask import render_template
from sqlalchemy import not_, and_, or_, text, select

from ..model import HuaWei  # 导入上级模块
from app import db

hw = Blueprint('hw', __name__, url_prefix='/hw')
nav = dict();
nav['hw'] = 'active'


@hw.route('/rank')
def new_star_list():
    sql = text("""select * from (
select ydcomm_blog_author,blogs_author_info,count(id) as s from huawei 
where blogs_create_time like "2023/01%"
GROUP BY blogs_author_info
) b 
ORDER BY b.s desc""")

    result = db.engine.execute(sql)
    data = result.fetchall()
    return render_template('hw/rank.html', data=data, nav=nav)