Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project
Project
Details
Activity
Releases
Dependency List
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
136
Issues
136
List
Boards
Labels
Service Desk
Milestones
Merge Requests
44
Merge Requests
44
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Backend - Engine
Commits
2b6ea12f
Commit
2b6ea12f
authored
2 hours ago
by
Mark Harding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(chore): add some more details
parent
1e29bc31
plus-fix.7022019
No related merge requests found
Pipeline
#69560725
passed with stages
in 4 minutes and 26 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
8 deletions
+29
-8
Subscriptions.php
Controllers/Cli/Payments/Subscriptions.php
+29
-8
No files found.
Controllers/Cli/Payments/Subscriptions.php
View file @
2b6ea12f
...
...
@@ -10,6 +10,7 @@ use Minds\Core\Payments\Subscriptions\Queue;
use
Minds\Core\Security\ACL
;
use
Minds\Helpers\Cql
;
use
Minds\Interfaces
;
use
Minds\Core\Util\BigNumber
;
class
Subscriptions
extends
Cli\Controller
implements
Interfaces\CliControllerInterface
{
...
...
@@ -59,12 +60,18 @@ class Subscriptions extends Cli\Controller implements Interfaces\CliControllerIn
$this
->
out
(
"Done"
);
}
/**
* Sometimes, plus doesn't hit the delegate so the badge
* doesn't apply. This is designed to run regularly via
* a cron job to fix that
* @return void
*/
public
function
fixPlusWires
()
{
ACL
::
$ignore
=
true
;
// we need to save to channels
$delegate
=
new
\Minds\Core\Wire\Delegates\Plus
;
$usersLastPlus
=
[];
foreach
(
$this
->
getWires
()
as
$wire
)
{
foreach
(
$this
->
getWires
(
false
)
as
$wire
)
{
$sender_guid
=
$wire
->
getSender
()
->
getGuid
();
$friendly
=
date
(
'd-m-Y'
,
$wire
->
getTimestamp
());
echo
"
\n
$sender_guid
"
;
...
...
@@ -74,29 +81,36 @@ class Subscriptions extends Cli\Controller implements Interfaces\CliControllerIn
}
$usersLastPlus
[
$sender_guid
]
=
$wire
->
getTimestamp
();
$friendly
=
date
(
'd-m-Y'
,
$wire
->
getTimestamp
());
echo
"
$friendly
sending plus update"
;
echo
"
$friendly
sending plus update
(
{
$wire
->
getAmount
()
}
)
"
;
//if ($delegate->onWire($wire, '0x6f2548b1bee178a49c8ea09be6845f6aeaf3e8da')) {
if
(
$delegate
->
onWire
(
$wire
,
'offchain'
))
{
if
(
$delegate
->
onWire
(
$wire
,
'offchain'
)
||
$delegate
->
onWire
(
$wire
,
'0x6f2548b1bee178a49c8ea09be6845f6aeaf3e8da'
))
{
echo
" done"
;
}
//exit;
}
}
public
function
getWires
()
public
function
getWires
(
$onchain
=
false
)
{
$cql
=
\Minds\Core\Di\Di
::
_
()
->
get
(
'Database\Cassandra\Cql'
);
$prepared
=
new
\Minds\Core\Data\Cassandra\Prepared\Custom
;
$statement
=
"SELECT * FROM blockchain_transactions_mainnet WHERE contract='offchain:wire' and user_guid=? ALLOW FILTERING"
;
$statement
=
"SELECT * FROM blockchain_transactions_mainnet WHERE user_guid=? ALLOW FILTERING"
;
if
(
$onchain
)
{
$statement
=
"SELECT * FROM blockchain_transactions_mainnet WHERE wallet_address=? ALLOW FILTERING"
;
}
else
{
$statement
=
"SELECT * FROM blockchain_transactions_mainnet WHERE user_guid=? and amount>=? ALLOW FILTERING"
;
}
$offset
=
""
;
while
(
true
)
{
$prepared
->
query
(
$statement
,
[
new
\Cassandra\Varint
(
730071191229833224
)
]);
if
(
$onchain
)
{
$prepared
->
query
(
$statement
,
[
'0x6f2548b1bee178a49c8ea09be6845f6aeaf3e8da'
]);
}
else
{
$prepared
->
query
(
$statement
,
[
new
\Cassandra\Varint
(
730071191229833224
),
new
\Cassandra\Varint
(
5
)
]);
}
$prepared
->
setOpts
([
'paging_state_token'
=>
$offset
,
'page_size'
=>
100
,
...
...
@@ -115,6 +129,13 @@ class Subscriptions extends Cli\Controller implements Interfaces\CliControllerIn
foreach
(
$result
as
$row
)
{
$data
=
json_decode
(
$row
[
'data'
],
true
);
if
(
$row
[
'timestamp'
]
->
time
()
<
strtotime
(
'35 days ago'
))
{
return
;
// Do not sync old
}
if
(
!
$data
[
'sender_guid'
])
{
var_dump
(
$row
);
}
$wire
=
new
\Minds\Core\Wire\Wire
();
$wire
->
setSender
(
new
\Minds\Entities\User
(
$data
[
'sender_guid'
]))
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment