fixed keyword and type filter
This commit is contained in:
parent
7029befc57
commit
0e17f523e2
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
namespace Beike\Admin\Http\Controllers;
|
||||
|
||||
use Beike\Repositories\PluginRepo;
|
||||
use ZanySoft\Zip\Zip;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
|
@ -24,9 +25,14 @@ class MarketingController
|
|||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$plugins = MarketingService::getList();
|
||||
$filters = [
|
||||
'type' => $request->get('type'),
|
||||
'keyword' => $request->get('keyword'),
|
||||
];
|
||||
$plugins = MarketingService::getList($filters);
|
||||
$data = [
|
||||
'plugins' => $plugins,
|
||||
'types' => PluginRepo::getTypes(),
|
||||
];
|
||||
|
||||
if ($request->expectsJson()) {
|
||||
|
|
|
|||
|
|
@ -15,9 +15,12 @@ use Illuminate\Support\Facades\Http;
|
|||
|
||||
class MarketingService
|
||||
{
|
||||
public static function getList()
|
||||
public static function getList($filters = [])
|
||||
{
|
||||
$url = config('beike.api_url') . '/api/plugins';
|
||||
if (!empty($filters)) {
|
||||
$url .= '?' . http_build_query($filters);
|
||||
}
|
||||
return Http::get($url)->json();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,5 +13,13 @@ namespace Beike\Models;
|
|||
|
||||
class Plugin extends Base
|
||||
{
|
||||
const TYPES = [
|
||||
'shipping', // 配送方式
|
||||
'payment', // 支付方式
|
||||
'total', // 订单金额
|
||||
'social', // 第三方登录
|
||||
'view' // 其他UI更改
|
||||
];
|
||||
|
||||
protected $fillable = ['type', 'code'];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,15 +12,28 @@
|
|||
namespace Beike\Repositories;
|
||||
|
||||
use Beike\Models\Plugin;
|
||||
use Beike\Plugin\Manager;
|
||||
use Beike\Plugin\Plugin as BPlugin;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class PluginRepo
|
||||
{
|
||||
public static $installedPlugins;
|
||||
|
||||
|
||||
public static function getTypes(): array
|
||||
{
|
||||
$types = [];
|
||||
foreach (Plugin::TYPES as $item) {
|
||||
$types[] = [
|
||||
'value' => $item,
|
||||
'label' => trans("admin/plugin.{$item}")
|
||||
];
|
||||
}
|
||||
return $types;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 安装插件到系统: 插入数据
|
||||
* @param BPlugin $bPlugin
|
||||
|
|
|
|||
Loading…
Reference in New Issue