referral sales
This commit is contained in:
1 parent
7baac11834
commit
7448023642
5 files changed
+48
-20
No files matched your search
+1
-1
@@ -48,5 +48,5 @@ TONCENTER_HOST = os.getenv('TONCENTER_HOST', 'https://toncenter.com/api/v2/')
|
||||
TONCENTER_API_KEY = os.getenv('TONCENTER_API_KEY')
|
||||
TONCENTER_V3_HOST = os.getenv('TONCENTER_V3_HOST', 'https://toncenter.com/api/v3/')
|
||||
|
||||
MY_PLATFORM_CONTRACT = 'EQAGbwW0sFghy9N4MQ0Ozp8YOIr0lcMI8J5kbbydFnQtheMY'
|
||||
MY_PLATFORM_CONTRACT = 'EQAX3WA7bRzmof9HoFoWCclSW1d7T954Gzj1Hsgt40AtheMY'
|
||||
MY_FUND_ADDRESS = 'UQDarChHFMOI2On9IdHJNeEKttqepgo0AY4bG1trw8OAAwMY'
|
||||
@@ -36,6 +36,8 @@ class PlayerTemplates:
|
||||
else:
|
||||
cd_log += "Can't decrypt content. "
|
||||
|
||||
user_existing_license = self.db_session.query(UserContent).filter_by(owner_address=user_wallet_address, status='active', content_id=content.id).first()
|
||||
|
||||
if local_content:
|
||||
content_meta = content.json_format()
|
||||
local_content_meta = local_content.json_format()
|
||||
@@ -73,6 +75,8 @@ class PlayerTemplates:
|
||||
'text': self.user.translated('p_shareLinkContext').format(title=content_metadata_json.get('name', "")),
|
||||
'url': f"https://t.me/{CLIENT_TELEGRAM_BOT_USERNAME}/content?startapp={content.cid.serialize_v2()}"
|
||||
}
|
||||
if user_existing_license:
|
||||
content_share_link['url'] = f"https://t.me/{CLIENT_TELEGRAM_BOT_USERNAME}/content?startapp={user_existing_license.onchain_address}"
|
||||
|
||||
preview_content = db_session.query(StoredContent).filter(
|
||||
StoredContent.hash == converted_content['low_preview']
|
||||
@@ -97,7 +101,7 @@ class PlayerTemplates:
|
||||
inline_keyboard_array.append([
|
||||
{
|
||||
'text': self.user.translated('shareTrack_button'),
|
||||
'switch_inline_query': f"C{content.cid.serialize_v2()}",
|
||||
'switch_inline_query': f"Q{user_existing_license.onchain_address}" if user_existing_license else f"C{content.cid.serialize_v2()}",
|
||||
},
|
||||
{
|
||||
'text': self.user.translated('shareLink_button'),
|
||||
@@ -115,7 +119,7 @@ class PlayerTemplates:
|
||||
}])
|
||||
inline_keyboard_array.append([{
|
||||
'text': self.user.translated('openContractPage_button'),
|
||||
'url': f"https://tonscan.org/address/{content_meta['item_address']}"
|
||||
'url': f"https://tonviewer.com/{content_meta['item_address']}"
|
||||
}])
|
||||
elif content_type == 'video':
|
||||
# Processing video
|
||||
@@ -132,7 +136,7 @@ class PlayerTemplates:
|
||||
inline_keyboard_array.append([
|
||||
{
|
||||
'text': self.user.translated('shareVideo_button'),
|
||||
'switch_inline_query': f"C{content.cid.serialize_v2()}",
|
||||
'switch_inline_query': f"Q{user_existing_license.onchain_address}" if user_existing_license else f"C{content.cid.serialize_v2()}",
|
||||
},
|
||||
{
|
||||
'text': self.user.translated('shareLink_button'),
|
||||
@@ -151,7 +155,7 @@ class PlayerTemplates:
|
||||
}])
|
||||
inline_keyboard_array.append([{
|
||||
'text': self.user.translated('openContractPage_button'),
|
||||
'url': f"https://tonscan.org/address/{content_meta['item_address']}"
|
||||
'url': f"https://tonviewer.com/address/{content_meta['item_address']}"
|
||||
}])
|
||||
else:
|
||||
local_content = None
|
||||
@@ -169,7 +173,7 @@ class PlayerTemplates:
|
||||
user_wallet_address = self.user.wallet_address(self.db_session)
|
||||
have_access = (
|
||||
(content.owner_address == user_wallet_address)
|
||||
or bool(self.db_session.query(UserContent).filter_by(owner_address=user_wallet_address, status='active', content_id=content.id).first())
|
||||
or bool(user_existing_license)
|
||||
or bool(self.db_session.query(StarsInvoice).filter(
|
||||
and_(
|
||||
StarsInvoice.user_id == self.user.id,
|
||||
@@ -222,6 +226,3 @@ class PlayerTemplates:
|
||||
self.db_session.commit()
|
||||
|
||||
return r
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user