add medal bonus addition

This commit is contained in:
xiaomlove
2023-01-26 23:08:49 +08:00
parent 1ca8502b91
commit 9cf6583d9a
15 changed files with 108 additions and 14 deletions

View File

@@ -21,6 +21,7 @@ $columnDescriptionLabel = nexus_trans('medal.fields.description');
$columnActionLabel = nexus_trans('nexus.action');
$columnSaleBeginEndTimeLabel = nexus_trans('medal.fields.sale_begin_end_time');
$columnInventoryLabel = nexus_trans('medal.fields.inventory');
$columnBonusAdditionFactorLabel = nexus_trans('medal.fields.bonus_addition_factor');
$header = '<h1 style="text-align: center">'.$title.'</h1>';
$filterForm = <<<FORM
<div>
@@ -41,6 +42,7 @@ $table = <<<TABLE
<td class="colhead">$columnNameLabel</td>
<td class="colhead">$columnImageLargeLabel</td>
<td class="colhead">$columnSaleBeginEndTimeLabel</td>
<td class="colhead">$columnBonusAdditionFactorLabel</td>
<td class="colhead">$columnPriceLabel</td>
<td class="colhead">$columnDurationLabel</td>
<td class="colhead">$columnInventoryLabel</td>
@@ -81,8 +83,8 @@ foreach ($rows as $row) {
$class, $row->id, $btnText, $disabled
);
$table .= sprintf(
'<tr><td>%s</td><td>%s</td><td><img src="%s" style="max-width: 60px;max-height: 60px;" class="preview" /></td><td>%s ~<br>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>',
$row->id, $row->name, $row->image_large, $row->sale_begin_time ?? '--', $row->sale_end_time ?? '--', number_format($row->price), $row->durationText, $row->inventory ?? nexus_trans('label.infinite'), $row->description, $action
'<tr><td>%s</td><td>%s</td><td><img src="%s" style="max-width: 60px;max-height: 60px;" class="preview" /></td><td>%s ~<br>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>',
$row->id, $row->name, $row->image_large, $row->sale_begin_time ?? '--', $row->sale_end_time ?? '--', $row->bonus_addition_factor, number_format($row->price), $row->durationText, $row->inventory ?? nexus_trans('label.infinite'), $row->description, $action
);
}
$table .= '</tbody></table>';

View File

@@ -489,6 +489,13 @@ else $loadpic = "loadbargreen";
$width = $percent * 4;
print("<img class=\"".$loadpic."\" src=\"pic/trans.gif\" style=\"width: ".$width."px;\" alt=\"".$percent."%\" /></td></tr></table>");
if ($bonusTableResult['has_medal_addition']) {
print("<h1>".$lang_mybonus['text_get_by_medal']."</h1>");
print("<ul>");
print("<li>".sprintf($lang_mybonus['medal_additional_desc'], $CURUSER['id'])."</li>");
print("<li>".$lang_mybonus['medal_additional_factor'].$bonusTableResult['medal_addition_factor']."</li>");
print("</ul>");
}
if ($bonusTableResult['has_official_addition']) {
print("<h1>".$lang_mybonus['text_get_by_seeding_official']."</h1>");
print("<ul>");
@@ -757,12 +764,12 @@ if ($action == "exchange") {
}
$bonusRep->consumeToCancelHitAndRun($userid, $_POST['hr_id']);
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=cancel_hr");
} elseif ($art == 'buy_medal') {
if (empty($_POST['medal_id'])) {
stderr("Error","Invalid Medal ID: " . ($_POST['medal_id'] ?? ''), false, false);
}
$bonusRep->consumeToBuyMedal($userid, $_POST['medal_id']);
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=buy_medal");
// } elseif ($art == 'buy_medal') {
// if (empty($_POST['medal_id'])) {
// stderr("Error","Invalid Medal ID: " . ($_POST['medal_id'] ?? ''), false, false);
// }
// $bonusRep->consumeToBuyMedal($userid, $_POST['medal_id']);
// nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=buy_medal");
} elseif ($art == 'attendance_card') {
$bonusRep->consumeToBuyAttendanceCard($userid);
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=attendance_card");