diff --git a/app/Console/Commands/PluginCronjob.php b/app/Console/Commands/PluginCronjob.php
new file mode 100644
index 00000000..ba9c1e67
--- /dev/null
+++ b/app/Console/Commands/PluginCronjob.php
@@ -0,0 +1,42 @@
+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;
+ }
+}
diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php
index dee5383c..52e44fa3 100644
--- a/app/Console/Commands/Test.php
+++ b/app/Console/Commands/Test.php
@@ -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);
}
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php
index 93288ef9..0e2cec11 100644
--- a/app/Console/Kernel.php
+++ b/app/Console/Kernel.php
@@ -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();
}
/**
diff --git a/app/Filament/Resources/System/PluginResource.php b/app/Filament/Resources/System/PluginResource.php
new file mode 100644
index 00000000..c3ae5800
--- /dev/null
+++ b/app/Filament/Resources/System/PluginResource.php
@@ -0,0 +1,114 @@
+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]);
+ })
+ ;
+ }
+
+}
diff --git a/app/Filament/Resources/System/PluginResource/Pages/ManagePlugins.php b/app/Filament/Resources/System/PluginResource/Pages/ManagePlugins.php
new file mode 100644
index 00000000..c46a6317
--- /dev/null
+++ b/app/Filament/Resources/System/PluginResource/Pages/ManagePlugins.php
@@ -0,0 +1,21 @@
+ ['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()
diff --git a/app/Models/Plugin.php b/app/Models/Plugin.php
new file mode 100644
index 00000000..d18ff2c3
--- /dev/null
+++ b/app/Models/Plugin.php
@@ -0,0 +1,32 @@
+ __('plugin.status.' . $attributes['status'])
+ );
+ }
+}
diff --git a/app/Repositories/BaseRepository.php b/app/Repositories/BaseRepository.php
index 5771074f..d07c6517 100644
--- a/app/Repositories/BaseRepository.php
+++ b/app/Repositories/BaseRepository.php
@@ -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;
+ }
+
}
diff --git a/app/Repositories/PluginRepository.php b/app/Repositories/PluginRepository.php
new file mode 100644
index 00000000..396f49ac
--- /dev/null
+++ b/app/Repositories/PluginRepository.php
@@ -0,0 +1,187 @@
+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;
+ }
+
+
+}
diff --git a/database/migrations/2022_09_16_164224_create_plugins_table.php b/database/migrations/2022_09_16_164224_create_plugins_table.php
new file mode 100644
index 00000000..b904aca8
--- /dev/null
+++ b/database/migrations/2022_09_16_164224_create_plugins_table.php
@@ -0,0 +1,38 @@
+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');
+ }
+};
diff --git a/include/constants.php b/include/constants.php
index ff74f3bf..42baac68 100644
--- a/include/constants.php
+++ b/include/constants.php
@@ -1,6 +1,6 @@
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;
diff --git a/lang/chs/lang_mybonus.php b/lang/chs/lang_mybonus.php
index 11ef47eb..28b45e47 100644
--- a/lang/chs/lang_mybonus.php
+++ b/lang/chs/lang_mybonus.php
@@ -6,6 +6,7 @@ $lang_mybonus = array
'std_karma_system_disabled' => "魔力值系统当前处于关闭中。",
'std_points_active' => "不过你的魔力值仍在计算中。",
'text_success_upload' => "祝贺你,你成功增加了上传值!",
+ 'text_success_download' => "祝贺你,你成功增加了下载值!",
'text_success_invites' => "祝贺你,你获得了1个新的邀请名额!",
'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' => "如果有足够的魔力值,你可以用它来换取下载量。交易完成后,你的魔力值会减少,下载量则会增加。",
'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 下载量",
+ 'text_downloaded_hundred_gb' => "100.0 GB 下载量",
'text_buy_invite' => "1个邀请名额",
'text_buy_invite_note' => "如果有足够的魔力值,你可以用它来换取邀请名额。交易完成后,你的魔力值会减少,邀请名额数则会增加。",
'text_custom_title' => "自定义头衔",
diff --git a/lang/chs/lang_settings.php b/lang/chs/lang_settings.php
index 9566cb22..da6f8585 100644
--- a/lang/chs/lang_settings.php
+++ b/lang/chs/lang_settings.php
@@ -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'。",
);
?>
diff --git a/lang/cht/lang_mybonus.php b/lang/cht/lang_mybonus.php
index d7376a0b..fcce5ccf 100644
--- a/lang/cht/lang_mybonus.php
+++ b/lang/cht/lang_mybonus.php
@@ -6,6 +6,7 @@ $lang_mybonus = array
'std_karma_system_disabled' => "魔力值系統當前處於關閉中。",
'std_points_active' => "不過你的魔力值仍在計算中。",
'text_success_upload' => "祝賀你,你成功增加了上傳值!",
+ 'text_success_download' => "祝賀你,你成功增加了下載值!",
'text_success_invites' => "祝賀你,你獲得了1個新的邀請名額!",
'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' => "如果有足夠的魔力值,你可以用它來換取下載量。交易完成後,你的魔力值會減少,下載量則會增加。",
'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 下載量",
+ 'text_downloaded_hundred_gb' => "100.0 GB 下載量",
'text_buy_invite' => "1個邀請名額",
'text_buy_invite_note' => "如果有足夠的魔力值,你可以用它來換取邀請名額。交易完成後,你的魔力值會減少,邀請名額數則會增加。",
'text_custom_title' => "自定義頭銜",
diff --git a/lang/cht/lang_settings.php b/lang/cht/lang_settings.php
index 6ec1fc42..af79ecf1 100644
--- a/lang/cht/lang_settings.php
+++ b/lang/cht/lang_settings.php
@@ -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'。",
);
?>
diff --git a/lang/en/lang_mybonus.php b/lang/en/lang_mybonus.php
index 8820f00f..b0b09edd 100644
--- a/lang/en/lang_mybonus.php
+++ b/lang/en/lang_mybonus.php
@@ -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 Uploaded Amount!",
+ 'text_success_download' => "Congratulations! You have just increased your Downloaded Amount!",
'text_success_invites' => "Congratulations! You have got yourself 1 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 Download Credit. The points are then removed from your Bonus Bank and the credit is added to your total downloaded 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 Downloaded",
+ 'text_downloaded_hundred_gb' => "100.0 GB Downloaded",
'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!",
diff --git a/lang/en/lang_settings.php b/lang/en/lang_settings.php
index 9e0fc03b..c172cd12 100644
--- a/lang/en/lang_settings.php
+++ b/lang/en/lang_settings.php
@@ -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'.",
);
?>
diff --git a/public/mybonus.php b/public/mybonus.php
index 5be81c7e..cbc9032a 100644
--- a/public/mybonus.php
+++ b/public/mybonus.php
@@ -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) {
diff --git a/public/settings.php b/public/settings.php
index d97ba88f..a7b746f0 100644
--- a/public/settings.php
+++ b/public/settings.php
@@ -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']."".$lang_settings['text_one_gb_credit_note'], 1);
tr($lang_settings['row_five_gb_credit'],$lang_settings['text_it_costs_user']."".$lang_settings['text_five_gb_credit_note'], 1);
tr($lang_settings['row_ten_gb_credit'],$lang_settings['text_it_costs_user']."".$lang_settings['text_ten_gb_credit_note'], 1);
+ tr($lang_settings['row_hundred_gb_credit'],$lang_settings['text_it_costs_user']."".$lang_settings['text_hundred_gb_credit_note'], 1);
+ tr($lang_settings['row_ten_gb_download_credit'],$lang_settings['text_it_costs_user']."".$lang_settings['text_ten_gb_download_credit_note'], 1);
+ tr($lang_settings['row_hundred_gb_download_credit'],$lang_settings['text_it_costs_user']."".$lang_settings['text_hundred_gb_download_credit_note'], 1);
+
+
tr($lang_settings['row_ratio_limit'],$lang_settings['text_user_with_ratio']."".$lang_settings['text_uploaded_amount_above']."".$lang_settings['text_ratio_limit_default'], 1);
tr($lang_settings['row_buy_an_invite'],$lang_settings['text_it_costs_user']."".$lang_settings['text_buy_an_invite_note'], 1);
tr($lang_settings['row_custom_title'],$lang_settings['text_it_costs_user']."".$lang_settings['text_custom_title_note'], 1);
diff --git a/resources/lang/zh_CN/admin.php b/resources/lang/zh_CN/admin.php
index ed68f5d7..546c835e 100644
--- a/resources/lang/zh_CN/admin.php
+++ b/resources/lang/zh_CN/admin.php
@@ -24,6 +24,7 @@ return [
'torrent_deny_reason' => '拒绝原因',
'roles' => '角色',
'permissions' => '权限',
+ 'plugin' => '插件',
],
'resources' => [
'agent_allow' => [
diff --git a/resources/lang/zh_CN/plugin.php b/resources/lang/zh_CN/plugin.php
new file mode 100644
index 00000000..23da8598
--- /dev/null
+++ b/resources/lang/zh_CN/plugin.php
@@ -0,0 +1,32 @@
+ [
+ '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 => '删除失败',
+ ],
+];
diff --git a/resources/views/filament/resources/system/plugin-resource/pages/plugins.blade.php b/resources/views/filament/resources/system/plugin-resource/pages/plugins.blade.php
new file mode 100644
index 00000000..cd00dafb
--- /dev/null
+++ b/resources/views/filament/resources/system/plugin-resource/pages/plugins.blade.php
@@ -0,0 +1,3 @@
+
+
+