提交 2b14716c 编写于 作者: 梦想橡皮擦's avatar 梦想橡皮擦 💬

华为云社区

上级 3d98130a
......@@ -5,20 +5,19 @@ from .config import BaseConfig # 导入配置文件
# Flask 限流器
from flask_limiter import Limiter
from flask_limiter.util import get_remote_address,get_ipaddr
from flask_limiter.util import get_remote_address, get_ipaddr
app = Flask(__name__)
app.config.from_object(BaseConfig) # 启用配置
def get_real_ip():
if request.headers.getlist("X-Forwarded-For"):
return request.headers.getlist("X-Forwarded-For")[0]
return request.remote_addr
limiter = Limiter(app, key_func=get_real_ip)
# limiter = Limiter(app, key_func=get_ipaddr)
......@@ -37,10 +36,13 @@ from .csdn.index import *
from .slow.index import *
from .user.index import *
from .apis.index import *
from .hw.index import *
app.register_blueprint(s)
app.register_blueprint(f)
app.register_blueprint(antispider)
app.register_blueprint(cs)
app.register_blueprint(slow)
app.register_blueprint(u)
app.register_blueprint(api)
\ No newline at end of file
app.register_blueprint(api)
app.register_blueprint(hw)
from flask import Blueprint, send_file
from flask import Blueprint, send_file, jsonify
from PIL import Image, ImageDraw, ImageFont
import random
......@@ -63,3 +63,23 @@ def index():
buf.seek(0)
return send_file(buf, mimetype='image/png')
@api.route('/phone')
def phone():
def generate_phone_number():
# 随机生成手机号码的前缀
prefix = random.choice(['130', '131', '132', '133', '134', '135', '136', '137', '138', '139',
'150', '151', '152', '153', '155', '156', '157', '158', '159',
'180', '181', '182', '183', '184', '185', '186', '187', '188', '189'])
# 随机生成手机号码的后缀
suffix = ''.join(random.choice(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']) for _ in range(8))
# 将前缀和后缀组合起来,生成手机号码
return prefix + suffix
phone_number = generate_phone_number()
phone = {
'phone': phone_number
}
return jsonify(phone)
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)
......@@ -60,3 +60,17 @@ class Csdn(db.Model, EntityBase):
ip = db.Column(db.String(255))
url = db.Column(db.String(255))
class HuaWei(db.Model, EntityBase):
"""
表名,字段名
"""
__tablename__ = "huawei"
id = db.Column(db.Integer, primary_key=True)
blog_id = db.Column(db.Integer)
href = db.Column(db.String(20))
blogs_author_info = db.Column(db.BigInteger)
ydcomm_blog_author = db.Column(db.String(30))
blogs_create_time = db.Column(db.String(30))
......@@ -16,7 +16,7 @@
<li class="nav-item">
<a href="/index" class="nav-link {{nav['h']}}">案例场</a>
</li>
<li class="nav-item">
<a class="nav-link {{nav['b']}}" href="/blog">站点建设中</a>
</li>
......@@ -28,6 +28,9 @@
</li>
<li class="nav-item">
<a class="nav-link {{nav['csdn']}}" href="/csdn/blogstar">博客之星(临时)</a>
</li>
<li class="nav-item">
<a class="nav-link {{nav['hw']}}" href="/hw/rank">华为月更榜</a>
</li>
<li class="nav-item">
<a class="nav-link {{nav['time']}}" href="/timeline">建站时间轴</a>
......
......@@ -8,9 +8,14 @@
}
</style>
<div class="container">
<div class="alert alert-danger alert-dismissible text-center">
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
<strong>2022年博客之星,投票即将落幕,2023年我们再见!</strong>
</div>
<table class="table table-hover table-bordered table-responsive">
<caption class="caption-top text-center">
<div class="alert alert-warning">
......@@ -19,8 +24,12 @@
<p class="text-success p-0"><small>数据同步时间:2023-01-04 21:00</small></p>
<p class="m-0"><small>来都来了,不去给橡皮擦打个5分么?</small> <br> <a target="_blank"
href="https://bbs.csdn.net/topics/611387187"><small>https://bbs.csdn.net/topics/611387187</small></a>
</p>
</p>
<p class="d-block d-sm-none text-center"><img width="30%"
src="{{url_for('static',filename='images/qrcode.png')}}"
alt="">
<br><strong>【2023年博客之星预备群】 | 下一届继续战 </strong></p>
</div>
<div class="btn-group btn-group-sm">
<a class="btn btn-primary active" href="/csdn/blogstar">总榜</a>
......@@ -52,18 +61,33 @@
</thead>
<tbody>
{% for u in user %}
{% if loop.index<=bg_green %}
<tr class="bg-success text-white">
{% else %}
{% if u.nickname in ['西京刀客','音视频牛哥','尼德兰的喵','WongSSH','chinusyan'] %}
<tr class="bg-success text-white">
{% else %}
<tr>
{% endif %}
{% endif %}
<td>{{loop.index}}</td>
<td>
{% if loop.index<=bg_green %}
<a href="{{u.url}}" target="_blank" style="color:white;">{{u.nickname}}</a>
{% else %}
{% if u.nickname in ['西京刀客','音视频牛哥','尼德兰的喵','WongSSH','chinusyan'] %}
<a href="{{u.url}}" target="_blank" style="color:white;">{{u.nickname}}</a>
{% else %}
<a href="{{u.url}}" target="_blank" style="color:black;">{{u.nickname}}</a>
{% endif %}
{% endif %}
</td>
<td>{% if u.cateName =='后端' %}
<span class="badge bg-danger">{{u.cateName}}</span>
......@@ -100,10 +124,14 @@
<div class="card-header ">2022年博客之星</div>
<div class="card-body">
<div class="alert alert-success">
<p><strong>使用 Ctrl+F 检索自己的昵称即可</strong></p>
<p><strong>使用Ctrl+F检索自己的昵称即可</strong></p>
<p><a href="https://bbs.csdn.net/topics/611387187" target="_blank" class="btn btn-primary btn-block"
data-bs-toggle="tooltip" title="快点去,快点去!">为【橡皮擦去打个 5 分】</a></p>
<p class="text-danger">数据每天12:00前后同步 <br>得分越多,同步越快</p>
data-bs-toggle="tooltip" title="快点去,快点去!">为【橡皮擦】去打个5分</a></p>
<p class="d-none d-sm-block text-center"><img width="40%"
src="{{url_for('static',filename='images/qrcode.png')}}"
alt="">
<br><strong>【2023年博客之星预备群】 </strong><br>
<strong>下一届继续战 </strong></p>
</div>
</div>
<div class="card-footer ">
......
{% extends "base.html" %}
{% block content %}
<style>
#msg_table td{
padding:3px;}
</style>
<div class="container">
<table class="table table-hover table-bordered table-striped table-responsive">
<caption class="caption-top text-center">
<div class="alert alert-warning">
<p class="m-0">
<strong>华为云社区月更榜</strong><br><strong>
<2023年1月数据>
</strong></p>
<p class="text-success p-0"><small>数据每小时同步一次</small></p>
<table id="msg_table" style="font-size:10px;margin:0 auto;" class="table-striped table-bordered">
<tr>
<th>奖项设置</th>
<th>条件</th>
<th>人数</th>
<th>奖品</th>
</tr>
<tr>
<td>博客之星</td>
<td>【优质】原创技术文章数TOP 1</td>
<td>1</td>
<td>800 元盲盒</td>
</tr>
<tr>
<td>创作之星</td>
<td>原创技术文章数TOP 1</td>
<td>1</td>
<td>500 元盲盒</td>
</tr>
<tr>
<td>优秀博主</td>
<td>【优质】原创技术文章数TOP 2-11</td>
<td>10</td>
<td>400 元盲盒</td>
</tr>
<tr>
<td>积极博主</td>
<td>原创技术文章数TOP 2-31</td>
<td>30</td>
<td>300 元盲盒</td>
</tr>
</table>
</div>
</caption>
<thead>
<tr>
<th>排名</th>
<th>昵称</th>
<th>本月更文数量</th>
</tr>
</thead>
<tbody>
{% for u in data %}
<td>{{loop.index}}</td>
<td>{{u[0]}}</td>
<td>{{u[2]}}</td>
</tr>
{%endfor%}
</tbody>
</table>
</div>
<div class="card text-center" style="position:fixed;bottom:20px;right:0px;">
<div class="card-body">
<div class="alert alert-success">
<p class="text-center"><img width="40%" src="{{url_for('static',filename='images/qrcode.png')}}"
alt="">
<br><strong>【后期榜单群内同步】 </strong></p>
</div>
</div>
</div>
{% endblock %}
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册