This commit is contained in:
aozhiwei 2024-07-09 16:52:35 +08:00
parent 1f9fbfe6e9
commit f12d084b13

View File

@ -578,4 +578,68 @@ EOD;
));
}
public function reward()
{
$gameDbConn = myself()->_getMysql('');
$rows = SqlHelper::ormSelect(
$gameDbConn,
't_test_punish070901',
array(
)
);
foreach ($rows as $row) {
if ($row['user_exists'] && $row['gold'] > 0 && $row['pre_send'] == 0) {
$itemNum = $row['gold'];
$srcGold = $this->getUserGold($gameDbConn, $row['account_id']);
echo $row['account_id'], $srcGold,1;
SqlHelper::update(
$gameDbConn,
't_test_punish070901',
array(
'account_id' => $row['account_id'],
),
array(
'pre_send' => 1,
'src_gold' => $srcGold,
)
);
SqlHelper::update(
$gameDbConn,
't_user',
array(
'account_id' => $row['account_id'],
),
array(
'gold' => function () use($itemNum) {
return "gold - ${itemNum}";
},
)
);
SqlHelper::update(
$gameDbConn,
't_test_punish070901',
array(
'account_id' => $row['account_id'],
),
array(
'post_send' => 1
)
);
}
}
echo 'ok';
}
private function getUserGold($gameDbConn, $accountId)
{
$row = SqlHelper::ormSelectOne(
$gameDbConn,
't_user',
array(
'account_id' => $accountId,
)
);
return empty($row) ? 0 : $row['gold'];
}
}