管理后台 server 使用蓝图模式,降低维护成本,降低修改功能时对其他模块的影响
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
from flask import Blueprint, render_template, jsonify, request
|
from flask import Blueprint, render_template, jsonify, request, current_app
|
||||||
from .auth import login_required
|
from .auth import login_required
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ def contacts_management():
|
|||||||
def api_contacts_all():
|
def api_contacts_all():
|
||||||
"""获取所有联系人信息API"""
|
"""获取所有联系人信息API"""
|
||||||
try:
|
try:
|
||||||
server = contacts_bp.server
|
server = current_app.dashboard_server
|
||||||
contacts = server.contact_manager.get_contacts()
|
contacts = server.contact_manager.get_contacts()
|
||||||
return jsonify({
|
return jsonify({
|
||||||
"success": True,
|
"success": True,
|
||||||
@@ -59,7 +59,7 @@ def api_contacts_statistics():
|
|||||||
def api_contacts_groups():
|
def api_contacts_groups():
|
||||||
"""获取群组联系人信息API"""
|
"""获取群组联系人信息API"""
|
||||||
try:
|
try:
|
||||||
server = contacts_bp.server
|
server = current_app.dashboard_server
|
||||||
group_contacts = server.contact_manager.get_group_contacts()
|
group_contacts = server.contact_manager.get_group_contacts()
|
||||||
|
|
||||||
return jsonify({
|
return jsonify({
|
||||||
@@ -77,7 +77,7 @@ def api_contacts_groups():
|
|||||||
def api_contacts_personal():
|
def api_contacts_personal():
|
||||||
"""获取个人联系人信息API"""
|
"""获取个人联系人信息API"""
|
||||||
try:
|
try:
|
||||||
server = contacts_bp.server
|
server = current_app.dashboard_server
|
||||||
personal_contacts = server.contact_manager.get_personal_contacts()
|
personal_contacts = server.contact_manager.get_personal_contacts()
|
||||||
|
|
||||||
return jsonify({
|
return jsonify({
|
||||||
@@ -95,7 +95,7 @@ def api_contacts_personal():
|
|||||||
def api_contacts_official():
|
def api_contacts_official():
|
||||||
"""获取公众号联系人信息API"""
|
"""获取公众号联系人信息API"""
|
||||||
try:
|
try:
|
||||||
server = contacts_bp.server
|
server = current_app.dashboard_server
|
||||||
official_accounts = server.contact_manager.get_official_accounts()
|
official_accounts = server.contact_manager.get_official_accounts()
|
||||||
|
|
||||||
return jsonify({
|
return jsonify({
|
||||||
@@ -113,7 +113,7 @@ def api_contacts_official():
|
|||||||
def api_contacts_public():
|
def api_contacts_public():
|
||||||
"""获取公共好友信息API"""
|
"""获取公共好友信息API"""
|
||||||
try:
|
try:
|
||||||
server = contacts_bp.server
|
server = current_app.dashboard_server
|
||||||
public_contacts = server.contact_manager.get_public_contacts()
|
public_contacts = server.contact_manager.get_public_contacts()
|
||||||
|
|
||||||
return jsonify({
|
return jsonify({
|
||||||
|
|||||||
Reference in New Issue
Block a user