add bonus exchange downloaded

This commit is contained in:
xiaomlove
2022-09-17 14:59:46 +08:00
parent dd51f32193
commit fedc67ad5e
23 changed files with 572 additions and 5 deletions
+42
View File
@@ -0,0 +1,42 @@
<?php
namespace App\Console\Commands;
use App\Repositories\PluginRepository;
use Illuminate\Console\Command;
use Nexus\Plugin\BasePlugin;
class PluginCronjob extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'plugin:cronjob {--action=} {--id=} {--force=}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Plugin install / update / delete cronjob handler';
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$action = $this->option('action');
$id = $this->option('id');
$force = $this->option('force');
$pluginRep = new PluginRepository();
$pluginRep->cronjob($action, $id, $force);
$log = sprintf("[%s], action: %s, id: %s, force: %s run done !", nexus()->getRequestId(), $action, $id, $force);
$this->info($log);
do_log($log);
return 0;
}
}
+5 -1
View File
@@ -23,6 +23,7 @@ use App\Repositories\AgentAllowRepository;
use App\Repositories\AttendanceRepository;
use App\Repositories\ExamRepository;
use App\Repositories\HitAndRunRepository;
use App\Repositories\PluginRepository;
use App\Repositories\SearchBoxRepository;
use App\Repositories\SearchRepository;
use App\Repositories\TagRepository;
@@ -87,7 +88,10 @@ class Test extends Command
*/
public function handle()
{
$r = \Illuminate\Support\Facades\Cache::lock();
$rep = new PluginRepository();
// $rep->installCronjob();
$r = $rep->getInstalledVersion('xiaomlove/nexusphp-post-like');
dd($r);
}
+2
View File
@@ -35,6 +35,8 @@ class Kernel extends ConsoleKernel
$schedule->command('claim:settle')->hourly()->when(function () {
return Carbon::now()->format('d') == '01';
})->withoutOverlapping();
// $schedule->command('plugin:cronjob')->everyMinute()->withoutOverlapping();
}
/**
@@ -0,0 +1,114 @@
<?php
namespace App\Filament\Resources\System;
use App\Filament\Resources\System\PluginResource\Pages;
use App\Filament\Resources\System\PluginResource\RelationManagers;
use App\Models\Plugin;
use Filament\Forms;
use Filament\Resources\Form;
use Filament\Resources\Resource;
use Filament\Resources\Table;
use Filament\Tables;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\HtmlString;
class PluginResource extends Resource
{
protected static ?string $model = Plugin::class;
protected static ?string $navigationIcon = 'heroicon-o-plus-circle';
protected static ?string $navigationGroup = 'System';
protected static ?int $navigationSort = 99;
protected static bool $shouldRegisterNavigation = false;
protected static function getNavigationLabel(): string
{
return __('admin.sidebar.plugin');
}
public static function getBreadcrumb(): string
{
return self::getNavigationLabel();
}
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('package_name')->label(__('label.plugin.package_name')),
Forms\Components\TextInput::make('remote_url')->label(__('label.plugin.remote_url')),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('id'),
Tables\Columns\TextColumn::make('package_name')->label(__('plugin.labels.package_name')),
Tables\Columns\TextColumn::make('remote_url')->label(__('plugin.labels.remote_url')),
Tables\Columns\TextColumn::make('installed_version')->label(__('plugin.labels.installed_version')),
Tables\Columns\TextColumn::make('statusText')->label(__('label.status')),
])
->filters([
//
])
->actions(self::getActions())
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
]);
}
public static function getPages(): array
{
return [
'index' => Pages\ManagePlugins::route('/'),
];
}
private static function getActions()
{
$actions = [];
$actions[] = Tables\Actions\EditAction::make();
$actions[] = self::buildInstallAction();
$actions[] = self::buildUpdateAction();
$actions[] = Tables\Actions\DeleteAction::make('delete')
->hidden(fn ($record) => $record->status == Plugin::STATUS_NOT_INSTALLED)
->using(function ($record) {
$record->update(['status' => Plugin::STATUS_PRE_DELETE]);
});
return $actions;
}
private static function buildInstallAction()
{
return Tables\Actions\Action::make('install')
->label(__('plugin.actions.install'))
->icon('heroicon-o-arrow-down')
->requiresConfirmation()
->hidden(fn ($record) => $record->status == Plugin::STATUS_NORMAL)
->action(function ($record) {
$record->update(['status' => Plugin::STATUS_PRE_INSTALL]);
})
;
}
private static function buildUpdateAction()
{
return Tables\Actions\Action::make('update')
->label(__('plugin.actions.update'))
->icon('heroicon-o-arrow-up')
->requiresConfirmation()
->hidden(fn ($record) => in_array($record->status, [Plugin::STATUS_NOT_INSTALLED, Plugin::STATUS_PRE_UPDATE]))
->action(function ($record) {
$record->update(['status' => Plugin::STATUS_PRE_UPDATE]);
})
;
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Filament\Resources\System\PluginResource\Pages;
use App\Filament\Resources\System\PluginResource;
use Filament\Pages\Actions;
use Filament\Resources\Pages\ManageRecords;
class ManagePlugins extends ManageRecords
{
protected static string $resource = PluginResource::class;
protected ?string $maxContentWidth = 'full';
protected function getActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}
+2
View File
@@ -25,6 +25,7 @@ class BonusLogs extends NexusModel
const BUSINESS_TYPE_NO_AD = 11;
const BUSINESS_TYPE_GIFT_TO_LOW_SHARE_RATIO = 12;
const BUSINESS_TYPE_LUCKY_DRAW = 13;
const BUSINESS_TYPE_EXCHANGE_DOWNLOAD = 14;
public static array $businessTypes = [
self::BUSINESS_TYPE_CANCEL_HIT_AND_RUN => ['text' => 'Cancel H&R'],
@@ -40,6 +41,7 @@ class BonusLogs extends NexusModel
self::BUSINESS_TYPE_NO_AD => ['text' => 'No ad'],
self::BUSINESS_TYPE_GIFT_TO_LOW_SHARE_RATIO => ['text' => 'Gift to low share ratio'],
self::BUSINESS_TYPE_LUCKY_DRAW => ['text' => 'Lucky draw'],
self::BUSINESS_TYPE_EXCHANGE_DOWNLOAD => ['text' => 'Exchange download'],
];
public static function getBonusForCancelHitAndRun()
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
class Plugin extends NexusModel
{
protected $fillable = ['display_name', 'package_name', 'remote_url', 'installed_version', 'status', 'description', 'status_result'];
const STATUS_NOT_INSTALLED = -1;
const STATUS_NORMAL = 0;
const STATUS_PRE_INSTALL = 1;
const STATUS_INSTALLING = 2;
const STATUS_INSTALL_FAILED = 3;
const STATUS_PRE_UPDATE = 11;
const STATUS_UPDATING = 12;
const STATUS_UPDATE_FAILED = 13;
const STATUS_PRE_DELETE = 101;
const STATUS_DELETING = 102;
const STATUS_DELETE_FAILED = 103;
public function statusText(): Attribute
{
return new Attribute(
get: fn($value, $attributes) => __('plugin.status.' . $attributes['status'])
);
}
}
+16
View File
@@ -55,4 +55,20 @@ class BaseRepository
return User::query()->findOrFail(intval($user), $fields);
}
protected function executeCommand($command, $format = 'string'): string|array
{
$append = " 2>&1";
if (!str_ends_with($command, $append)) {
$command .= $append;
}
do_log("command: $command");
$result = exec($command, $output, $result_code);
$outputString = implode("\n", $output);
do_log(sprintf('result_code: %s, result: %s, output: %s', $result_code, $result, $outputString));
if ($result_code != 0) {
throw new \RuntimeException($outputString);
}
return $format == 'string' ? $outputString : $output;
}
}
+187
View File
@@ -0,0 +1,187 @@
<?php
namespace App\Repositories;
use App\Models\Plugin;
class PluginRepository extends BaseRepository
{
public function cronjob($action = null, $id = null, $force = false)
{
if ($action == 'install' || $action === null) {
$this->doCronjob('install', $id, $force, Plugin::STATUS_PRE_INSTALL, Plugin::STATUS_INSTALLING);
}
if ($action == 'delete' || $action === null) {
$this->doCronjob('delete', $id, $force, Plugin::STATUS_PRE_DELETE, Plugin::STATUS_DELETING);
}
if ($action == 'update' || $action === null) {
$this->doCronjob('update', $id, $force, Plugin::STATUS_PRE_UPDATE, Plugin::STATUS_UPDATING);
}
}
private function doCronjob($action, $id, $force, $preStatus, $doingStatus)
{
$query = Plugin::query();
if (!$force) {
$query->where('status', $preStatus);
}
if ($id !== null) {
$query->where("id", $id);
}
$list = $query->get();
if ($list->isEmpty()) {
do_log("No plugin need to be $action...");
return;
}
$idArr = $list->pluck('id')->toArray();
Plugin::query()->whereIn('id', $idArr)->update(['status' => $doingStatus]);
foreach ($list as $item) {
match ($action) {
'install' => $this->doInstall($item),
'update' => $this->doUpdate($item),
'delete' => $this->doDelete($item),
default => throw new \InvalidArgumentException("Invalid action: $action")
};
}
}
public function doInstall(Plugin $plugin)
{
$packageName = $plugin->package_name;
try {
$this->execComposerConfig($plugin);
$this->execComposerRequire($plugin);
$output = $this->execPluginInstall($plugin);
$version = $this->getInstalledVersion($packageName);
do_log("success install plugin: $packageName version: $version");
$update = [
'status' => Plugin::STATUS_NORMAL,
'status_result' => $output,
'installed_version' => $version
];
} catch (\Throwable $throwable) {
$update = [
'status' => Plugin::STATUS_INSTALL_FAILED,
'status_result' => $throwable->getMessage()
];
do_log("fail install plugin: " . $packageName);
} finally {
$this->updateResult($plugin, $update);
}
}
public function doDelete(Plugin $plugin)
{
$packageName = $plugin->package_name;
$removeSuccess = true;
try {
$output = $this->execComposerRemove($plugin);
do_log("success remove plugin: $packageName");
$update = [
'status' => Plugin::STATUS_NOT_INSTALLED,
'status_result' => $output,
'installed_version' => null,
];
} catch (\Throwable $throwable) {
$update = [
'status' => Plugin::STATUS_DELETE_FAILED,
'status_result' => $throwable->getMessage()
];
$removeSuccess = false;
do_log("fail remove plugin: " . $packageName);
} finally {
if ($removeSuccess) {
$plugin->delete();
} else {
$this->updateResult($plugin, $update);
}
}
}
public function doUpdate(Plugin $plugin)
{
$packageName = $plugin->package_name;
try {
$output = $this->execComposerUpdate($plugin);
$this->execPluginInstall($plugin);
$version = $this->getInstalledVersion($packageName);
do_log("success update plugin: $packageName to version: $version");
$update = [
'status' => Plugin::STATUS_NORMAL,
'status_result' => $output,
'installed_version' => $version,
];
} catch (\Throwable $throwable) {
$update = [
'status' => Plugin::STATUS_UPDATE_FAILED,
'status_result' => $throwable->getMessage()
];
do_log("fail update plugin: " . $packageName);
} finally {
$this->updateResult($plugin, $update);
}
}
private function getRepositoryKey(Plugin $plugin)
{
return str_replace("xiaomlove/nexusphp-", "", $plugin->package_name);
}
private function execComposerConfig(Plugin $plugin)
{
$command = sprintf("composer config repositories.%s git %s", $this->getRepositoryKey($plugin), $plugin->remote_url);
do_log("[COMPOSER_CONFIG]: $command");
return $this->executeCommand($command);
}
private function execComposerRequire(Plugin $plugin)
{
$command = sprintf("composer require %s", $plugin->package_name);
do_log("[COMPOSER_REQUIRE]: $command");
return $this->executeCommand($command);
}
private function execComposerRemove(Plugin $plugin)
{
$command = sprintf("composer remove %s", $plugin->package_name);
do_log("[COMPOSER_REMOVE]: $command");
return $this->executeCommand($command);
}
private function execComposerUpdate(Plugin $plugin)
{
$command = sprintf("composer update %s", $plugin->package_name);
do_log("[COMPOSER_UPDATE]: $command");
return $this->executeCommand($command);
}
private function execPluginInstall(Plugin $plugin)
{
$command = sprintf("php artisan plugin install %s", $plugin->package_name);
do_log("[PLUGIN_INSTALL]: $command");
return $this->executeCommand($command);
}
private function updateResult(Plugin $plugin, array $update)
{
$update['status_result'] = $update['status_result'] . "\n\nREQUEST_ID: " . nexus()->getRequestId();
do_log("[UPDATE]: " . json_encode($update));
$plugin->update($update);
}
public function getInstalledVersion($packageName)
{
$command = sprintf('composer info |grep -E %s', $packageName);
$result = $this->executeCommand($command);
$parts = preg_split("/[\s]+/", trim($result));
$version = $parts[1];
if (str_contains($version, 'dev')) {
$version .= " $parts[2]";
}
return $version;
}
}
@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('plugins', function (Blueprint $table) {
$table->id();
$table->string('display_name')->nullable(true);
$table->string('package_name')->nullable(false)->unique();
$table->string('remote_url')->nullable(true);
$table->string('installed_version')->nullable(true);
$table->text('description')->nullable(true);
$table->integer('status')->default(-1);
$table->text('status_result')->nullable(true);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('plugins');
}
};
+2 -2
View File
@@ -1,6 +1,6 @@
<?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.26');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-09-15');
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.27');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-09-17');
defined('IN_TRACKER') || define('IN_TRACKER', false);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
+1 -1
View File
@@ -5866,7 +5866,7 @@ function calculate_harem_addition($uid)
$haremsCount = $harems->count();
foreach ($harems as $harem) {
$result = calculate_seed_bonus($harem->id);
$addition += $result['all_bonus'];
$addition += $result['seed_bonus'];
}
do_log("[HAREM_ADDITION], user: $uid, haremsCount: $haremsCount ,addition: $addition");
return $addition;
+5
View File
@@ -6,6 +6,7 @@ $lang_mybonus = array
'std_karma_system_disabled' => "魔力值系统当前处于关闭中。",
'std_points_active' => "不过你的魔力值仍在计算中。",
'text_success_upload' => "祝贺你,你成功增加了<b>上传值</b>",
'text_success_download' => "祝贺你,你成功增加了<b>下载值</b>",
'text_success_invites' => "祝贺你,你获得了<b>1</b>个新的邀请名额!",
'text_success_vip' => "祝贺你,你获得了一个月的",
'text_success_vip_two' => "资格!",
@@ -74,8 +75,12 @@ $lang_mybonus = array
'text_not_enough_bonus' => "对不起,你没有足够的魔力值。还有,你怎么到这来的?",
'text_uploaded_one' => "1.0 GB上传量",
'text_uploaded_note' => "如果有足够的魔力值,你可以用它来换取上传量。交易完成后,你的魔力值会减少,上传量则会增加。",
'text_download_note' => "如果有足够的魔力值,你可以用它来换取<font color='#ff4500'>下载量</font>。交易完成后,你的魔力值会减少,<font color='#ff4500'>下载量</font>则会增加。",
'text_uploaded_two' => "5.0 GB上传量",
'text_uploaded_three' => "10.0 GB上传量",
'text_uploaded_four' => "100.0 GB上传量",
'text_downloaded_ten_gb' => "10.0 GB <font color='#ff4500'>下载量</font>",
'text_downloaded_hundred_gb' => "100.0 GB <font color='#ff4500'>下载量</font>",
'text_buy_invite' => "1个邀请名额",
'text_buy_invite_note' => "如果有足够的魔力值,你可以用它来换取邀请名额。交易完成后,你的魔力值会减少,邀请名额数则会增加。",
'text_custom_title' => "自定义头衔",
+6
View File
@@ -773,6 +773,12 @@ $lang_settings = array
'text_offer_skip_approved_count_note' => '当通过的候选数大于等于此数值时,可直接发布不用提交候选。',
'row_torrent_delete' => '删除种子',
'text_torrent_delete_note' => '。删除种子',
'row_hundred_gb_credit' => "100.0 GB 上传量",
'text_hundred_gb_credit_note' => "个魔力值,如果他选择交换100.0 GB上传量。默认'10000'。",
'row_ten_gb_download_credit' => "10.0 GB 下载量",
'text_ten_gb_download_credit_note' => " 个魔力值,如果他选择交换10.0 GB下载量。默认'1000'。",
'row_hundred_gb_download_credit' => "100.0 GB 下载量",
'text_hundred_gb_download_credit_note' => " 个魔力值,如果他选择交换100.0 GB下载量。默认'8000'。",
);
?>
+5
View File
@@ -6,6 +6,7 @@ $lang_mybonus = array
'std_karma_system_disabled' => "魔力值系統當前處於關閉中。",
'std_points_active' => "不過你的魔力值仍在計算中。",
'text_success_upload' => "祝賀你,你成功增加了<b>上傳值</b>",
'text_success_download' => "祝賀你,你成功增加了<b>下載值</b>",
'text_success_invites' => "祝賀你,你獲得了<b>1</b>個新的邀請名額!",
'text_success_vip' => "祝賀你,你獲得了一個月的",
'text_success_vip_two' => "資格!",
@@ -74,8 +75,12 @@ $lang_mybonus = array
'text_not_enough_bonus' => "對不起,你沒有足夠的魔力值。還有,你怎麼到這來的?",
'text_uploaded_one' => "1.0 GB上傳量",
'text_uploaded_note' => "如果有足夠的魔力值,你可以用它來換取上傳量。交易完成後,你的魔力值會減少,上傳量則會增加。",
'text_download_note' => "如果有足夠的魔力值,你可以用它來換取<font color='#ff4500'>下載量</font>。交易完成後,你的魔力值會減少,<font color='#ff4500'>下載量</font>則會增加。",
'text_uploaded_two' => "5.0 GB上傳量",
'text_uploaded_three' => "10.0 GB上傳量",
'text_uploaded_four' => "100.0 GB上傳量",
'text_downloaded_ten_gb' => "10.0 GB <font color='#ff4500'>下載量</font>",
'text_downloaded_hundred_gb' => "100.0 GB <font color='#ff4500'>下載量</font>",
'text_buy_invite' => "1個邀請名額",
'text_buy_invite_note' => "如果有足夠的魔力值,你可以用它來換取邀請名額。交易完成後,你的魔力值會減少,邀請名額數則會增加。",
'text_custom_title' => "自定義頭銜",
+6
View File
@@ -773,6 +773,12 @@ $lang_settings = array
'text_offer_skip_approved_count_note' => '當通過的候選數大於等於此數值時,可直接發布不用提交候選。',
'row_torrent_delete' => '移除種子',
'text_torrent_delete_note' => '。移除種子',
'row_hundred_gb_credit' => "100.0 GB 上傳量",
'text_hundred_gb_credit_note' => "個魔力值,如果他選擇交換100.0 GB上傳量。默認'10000'。",
'row_ten_gb_download_credit' => "10.0 GB 下載量",
'text_ten_gb_download_credit_note' => " 個魔力值,如果他選擇交換10.0 GB下載量。默認'1000'。",
'row_hundred_gb_download_credit' => "100.0 GB 下載量",
'text_hundred_gb_download_credit_note' => " 個魔力值,如果他選擇交換100.0 GB下載量。默認'8000'。",
);
?>
+5
View File
@@ -6,6 +6,7 @@ $lang_mybonus = array
'std_karma_system_disabled' => "Karma Bonus Point System is currently disabled. ",
'std_points_active' => "However your points is still active.",
'text_success_upload' => "Congratulations! You have just increased your <b>Uploaded Amount</b>!",
'text_success_download' => "Congratulations! You have just increased your <b>Downloaded Amount</b>!",
'text_success_invites' => "Congratulations! You have got yourself <b>1</b> new invite!",
'text_success_vip' => "Congratulations! You have got yourself ",
'text_success_vip_two' => " status for one month!",
@@ -74,8 +75,12 @@ $lang_mybonus = array
'text_not_enough_bonus' => "Sorry, you do not have enough bonus. BTW, how dou you get here?",
'text_uploaded_one' => "1.0 GB Uploaded",
'text_uploaded_note' => "With enough bonus points acquired, you are able to exchange them for an Upload Credit. The points are then removed from your Bonus Bank and the credit is added to your total uploaded amount.",
'text_download_note' => "With enough bonus points acquired, you are able to exchange them for an <font color='#ff4500'>Download</font> Credit. The points are then removed from your Bonus Bank and the credit is added to your total <font color='#ff4500'>downloaded</font> amount.",
'text_uploaded_two' => "5.0 GB Uploaded",
'text_uploaded_three' => "10.0 GB Uploaded",
'text_uploaded_four' => "100.0 GB Uploaded",
'text_downloaded_ten_gb' => "10.0 GB <font color='#ff4500'>Downloaded</font>",
'text_downloaded_hundred_gb' => "100.0 GB <font color='#ff4500'>Downloaded</font>",
'text_buy_invite' => "1 Invite",
'text_buy_invite_note' => "With enough bonus points acquired, you are able to exchange them for a few invites. The points are then removed from your Bonus Bank and the invitations are added to your invites amount.",
'text_custom_title' => "Custom Title!",
+6
View File
@@ -773,6 +773,12 @@ $lang_settings = array
'text_offer_skip_approved_count_note' => 'When the number of approved offer is greater than or equal to this value, you can upload directly without submitting offers.',
'row_torrent_delete' => 'Delete torrent',
'text_torrent_delete_note' => '.Delete torrent',
'row_hundred_gb_credit' => "100.0 GB uploading credit",
'text_hundred_gb_credit_note' => " bonus points to exchange for 100.0 GB uploading credit. Default '10000'.",
'row_ten_gb_download_credit' => "10.0 GB downloading credit",
'text_ten_gb_download_credit_note' => " bonus points to exchange for 10.0 GB downloading credit. Default '1000'.",
'row_hundred_gb_download_credit' => "100.0 GB downloading credit",
'text_hundred_gb_download_credit_note' => " bonus points to exchange for 100.0 GB downloading credit. Default '8000'.",
);
?>
+35
View File
@@ -39,6 +39,33 @@ function bonusarray($option = 0){
$bonus['description'] = $lang_mybonus['text_uploaded_note'];
$results[] = $bonus;
//100.0 GB Uploaded
$bonus = array();
$bonus['points'] = get_setting('bonus.hundredgbupload');
$bonus['art'] = 'traffic';
$bonus['menge'] = 107374182400;
$bonus['name'] = $lang_mybonus['text_uploaded_four'];
$bonus['description'] = $lang_mybonus['text_uploaded_note'];
$results[] = $bonus;
//10.0 GB Downloaded
$bonus = array();
$bonus['points'] = get_setting('bonus.tengbdownload');
$bonus['art'] = 'traffic_downloaded';
$bonus['menge'] = 10737418240;
$bonus['name'] = $lang_mybonus['text_downloaded_ten_gb'];
$bonus['description'] = $lang_mybonus['text_download_note'];
$results[] = $bonus;
//100.0 GB Downloaded
$bonus = array();
$bonus['points'] = get_setting('bonus.hundredgbdownload');
$bonus['art'] = 'traffic_downloaded';
$bonus['menge'] = 107374182400;
$bonus['name'] = $lang_mybonus['text_downloaded_hundred_gb'];
$bonus['description'] = $lang_mybonus['text_download_note'];
$results[] = $bonus;
//Invite
$bonus = array();
$bonus['points'] = $oneinvite_bonus;
@@ -246,6 +273,8 @@ unset($msg);
if (isset($do)) {
if ($do == "upload")
$msg = $lang_mybonus['text_success_upload'];
if ($do == "download")
$msg = $lang_mybonus['text_success_download'];
elseif ($do == "invite")
$msg = $lang_mybonus['text_success_invites'];
elseif ($do == "vip")
@@ -538,6 +567,12 @@ if ($action == "exchange") {
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=upload");
}
}
if($art == "traffic_downloaded") {
$downloaded = $CURUSER['downloaded'];
$down = $downloaded + $bonusarray['menge'];
$bonusRep->consumeUserBonus($CURUSER['id'], $points, \App\Models\BonusLogs::BUSINESS_TYPE_EXCHANGE_DOWNLOAD, $points. " Points for download bonus.", ['downloaded' => $down]);
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=download");
}
//=== trade for one month VIP status ***note "SET class = '10'" change "10" to whatever your VIP class number is
elseif($art == "class") {
if (get_user_class() >= UC_VIP) {
+6 -1
View File
@@ -97,7 +97,7 @@ elseif ($action == 'savesettings_bonus') // save bonus
'addcomment','pollvote','offervote', 'funboxvote','saythanks','receivethanks','funboxreward','onegbupload','fivegbupload',
'tengbupload', 'ratiolimit','dlamountlimit','oneinvite','customtitle','vipstatus','bonusgift', 'basictax', 'taxpercentage',
'prolinkpoint', 'prolinktime', 'attendance_initial', 'attendance_step', 'attendance_max', 'cancel_hr', 'attendance_card',
'harem_addition'
'harem_addition', 'hundredgbupload', 'tengbdownload', 'hundredgbdownload'
);
GetVar($validConfig);
$BONUS = [];
@@ -582,6 +582,11 @@ elseif ($action == 'bonussettings'){
tr($lang_settings['row_one_gb_credit'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=onegbupload value='".(isset($BONUS["onegbupload"]) ? $BONUS["onegbupload"] : 300 )."'>".$lang_settings['text_one_gb_credit_note'], 1);
tr($lang_settings['row_five_gb_credit'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=fivegbupload value='".(isset($BONUS["fivegbupload"]) ? $BONUS["fivegbupload"] : 800 )."'>".$lang_settings['text_five_gb_credit_note'], 1);
tr($lang_settings['row_ten_gb_credit'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=tengbupload value='".(isset($BONUS["tengbupload"]) ? $BONUS["tengbupload"] : 1200 )."'>".$lang_settings['text_ten_gb_credit_note'], 1);
tr($lang_settings['row_hundred_gb_credit'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=hundredgbupload value='".(isset($BONUS["hundredgbupload"]) ? $BONUS["hundredgbupload"] : 10000 )."'>".$lang_settings['text_hundred_gb_credit_note'], 1);
tr($lang_settings['row_ten_gb_download_credit'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=tengbdownload value='".(isset($BONUS["tengbdownload"]) ? $BONUS["tengbdownload"] : 1000 )."'>".$lang_settings['text_ten_gb_download_credit_note'], 1);
tr($lang_settings['row_hundred_gb_download_credit'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=hundredgbdownload value='".(isset($BONUS["hundredgbdownload"]) ? $BONUS["hundredgbdownload"] : 8000 )."'>".$lang_settings['text_hundred_gb_download_credit_note'], 1);
tr($lang_settings['row_ratio_limit'],$lang_settings['text_user_with_ratio']."<input type='text' style=\"width: 50px\" name=ratiolimit value='".(isset($BONUS["ratiolimit"]) ? $BONUS["ratiolimit"] : 6 )."'>".$lang_settings['text_uploaded_amount_above']."<input type='text' style=\"width: 50px\" name=dlamountlimit value='".(isset($BONUS["dlamountlimit"]) ? $BONUS["dlamountlimit"] : 50 )."'>".$lang_settings['text_ratio_limit_default'], 1);
tr($lang_settings['row_buy_an_invite'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=oneinvite value='".(isset($BONUS["oneinvite"]) ? $BONUS["oneinvite"] : 1000 )."'>".$lang_settings['text_buy_an_invite_note'], 1);
tr($lang_settings['row_custom_title'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=customtitle value='".(isset($BONUS["customtitle"]) ? $BONUS["customtitle"] : 5000 )."'>".$lang_settings['text_custom_title_note'], 1);
+1
View File
@@ -24,6 +24,7 @@ return [
'torrent_deny_reason' => '拒绝原因',
'roles' => '角色',
'permissions' => '权限',
'plugin' => '插件',
],
'resources' => [
'agent_allow' => [
+32
View File
@@ -0,0 +1,32 @@
<?php
return [
'actions' => [
'install' => '安装',
'delete' => '删除',
'update' => '升级',
],
'labels' => [
'display_name' => '名称',
'package_name' => '包名',
'remote_url' => '仓库地址',
'installed_version' => '已安装版本',
'status' => '状态',
],
'status' => [
\App\Models\Plugin::STATUS_NORMAL => '正常',
\App\Models\Plugin::STATUS_NOT_INSTALLED => '未安装',
\App\Models\Plugin::STATUS_PRE_INSTALL => '准备安装',
\App\Models\Plugin::STATUS_INSTALLING => '安装中',
\App\Models\Plugin::STATUS_INSTALL_FAILED => '安装失败',
\App\Models\Plugin::STATUS_PRE_UPDATE => '准备升级',
\App\Models\Plugin::STATUS_UPDATING => '升级中',
\App\Models\Plugin::STATUS_UPDATE_FAILED => '升级失败',
\App\Models\Plugin::STATUS_PRE_DELETE => '准备删除',
\App\Models\Plugin::STATUS_DELETING => '删除中',
\App\Models\Plugin::STATUS_DELETE_FAILED => '删除失败',
],
];
@@ -0,0 +1,3 @@
<x-filament::page>
</x-filament::page>