mirror of
https://github.com/YFGaia/dify-plus.git
synced 2026-06-14 20:41:21 +08:00
28 lines
944 B
Python
28 lines
944 B
Python
from flask_login import current_user
|
|
from flask_restful import Resource, marshal_with
|
|
|
|
from controllers.console import api
|
|
from controllers.console.workspace.workspace import account_initialization_required, setup_required
|
|
from extensions.ext_database import db
|
|
from fields.member_fields_extend import account_money_fields
|
|
from libs.login import login_required
|
|
from models.account_money_extend import AccountMoneyExtend
|
|
|
|
|
|
class AccountMoneyApi(Resource):
|
|
@setup_required
|
|
@login_required
|
|
@account_initialization_required
|
|
@marshal_with(account_money_fields)
|
|
def get(self):
|
|
account_money = (
|
|
db.session.query(AccountMoneyExtend).filter(AccountMoneyExtend.account_id == current_user.id).first()
|
|
)
|
|
if not account_money:
|
|
return {"total_quota": "15", "used_quota": "0"}, 200
|
|
return account_money
|
|
|
|
|
|
# Register API resources
|
|
api.add_resource(AccountMoneyApi, "/account/money")
|