implement star price
This commit is contained in:
parent
1b9a965869
commit
a4e3de9a6c
|
|
@ -3,6 +3,7 @@ from sanic import response
|
||||||
from aiogram import Bot, types
|
from aiogram import Bot, types
|
||||||
from sqlalchemy import and_
|
from sqlalchemy import and_
|
||||||
from app.core.logger import make_log
|
from app.core.logger import make_log
|
||||||
|
from app.core.models._config import ServiceConfig
|
||||||
from app.core.models.node_storage import StoredContent
|
from app.core.models.node_storage import StoredContent
|
||||||
from app.core.models.keys import KnownKey
|
from app.core.models.keys import KnownKey
|
||||||
from app.core.models import StarsInvoice
|
from app.core.models import StarsInvoice
|
||||||
|
|
@ -69,8 +70,15 @@ async def s_api_v1_content_view(request, content_address: str):
|
||||||
)
|
)
|
||||||
).first())
|
).first())
|
||||||
)
|
)
|
||||||
|
|
||||||
if not have_access:
|
if not have_access:
|
||||||
stars_cost = 1 # TODO: как считать стоимость в звездах?
|
current_star_rate = ServiceConfig(request.ctx.db_session).get('live_tonPerStar', [0, 0])[0]
|
||||||
|
if current_star_rate < 0:
|
||||||
|
current_star_rate = 0.00000001
|
||||||
|
|
||||||
|
stars_cost = int(int(content['encrypted_content'].meta['license']['resale']['price']) / 1e9 / current_star_rate * 1.2)
|
||||||
|
if request.ctx.user.id in [5587262915, 6861699286]:
|
||||||
|
stars_cost = 2
|
||||||
|
|
||||||
exist_invoice = request.ctx.db_session.query(StarsInvoice).filter(
|
exist_invoice = request.ctx.db_session.query(StarsInvoice).filter(
|
||||||
and_(
|
and_(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue