index.py 674 字节
Newer Older
梦想橡皮擦's avatar
梦想橡皮擦 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
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')
16
def hua_wei():
梦想橡皮擦's avatar
梦想橡皮擦 已提交
17 18 19 20 21
    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 
22 23
ORDER BY b.s desc
limit 31""")
梦想橡皮擦's avatar
梦想橡皮擦 已提交
24 25 26 27

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