|
|
@@ -3,6 +3,8 @@ declare(strict_types=1);
|
|
|
namespace SixShop\Payment\Controller;
|
|
|
|
|
|
use SixShop\Core\Helper;
|
|
|
+use SixShop\Core\Request;
|
|
|
+use SixShop\Payment\Config;
|
|
|
use SixShop\Payment\PaymentManager;
|
|
|
use think\Response;
|
|
|
use think\response\Json;
|
|
|
@@ -10,8 +12,14 @@ use function SixShop\Core\success_response;
|
|
|
|
|
|
class PaymentController
|
|
|
{
|
|
|
- public function index(PaymentManager $paymentManager): Response
|
|
|
+ public function index(PaymentManager $paymentManager, Config $config, Request $request): Response
|
|
|
{
|
|
|
- return success_response($paymentManager->getAllPayment());
|
|
|
+ $env = $request->header('env', 'release');
|
|
|
+ if($env === 'release' || in_array($env, $config->supported_envs)) {
|
|
|
+ $payments = $paymentManager->getAllPayment();
|
|
|
+ } else {
|
|
|
+ $payments = [];
|
|
|
+ }
|
|
|
+ return success_response($payments);
|
|
|
}
|
|
|
}
|