添加APP开关配置
parent
89252298ad
commit
93795a8c40
|
|
@ -2,8 +2,10 @@
|
||||||
|
|
||||||
namespace App\Admin\Controllers;
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Forms\Settings\Android;
|
||||||
use App\Admin\Forms\Settings\App;
|
use App\Admin\Forms\Settings\App;
|
||||||
use App\Admin\Forms\Settings\Distribution;
|
use App\Admin\Forms\Settings\Distribution;
|
||||||
|
use App\Admin\Forms\Settings\Ios;
|
||||||
use App\Admin\Forms\Settings\Kuaidi100;
|
use App\Admin\Forms\Settings\Kuaidi100;
|
||||||
use App\Admin\Forms\Settings\Unipush;
|
use App\Admin\Forms\Settings\Unipush;
|
||||||
use App\Admin\Repositories\Setting;
|
use App\Admin\Repositories\Setting;
|
||||||
|
|
@ -107,27 +109,51 @@ class SettingController extends AdminController
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'app':
|
case 'app':
|
||||||
$tab->add('系统配置', new App(), true);
|
$tab->add('系统配置', new App(), true);
|
||||||
|
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
|
||||||
|
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
|
||||||
|
$tab->addLink('Android配置', admin_route('settings.index', ['type'=>'ios']));
|
||||||
$tab->addLink('快递100配置', admin_route('settings.index', ['type'=>'kuaidi100']));
|
$tab->addLink('快递100配置', admin_route('settings.index', ['type'=>'kuaidi100']));
|
||||||
$tab->addLink('Uni-push配置', admin_route('settings.index', ['type'=>'unipush']));
|
$tab->addLink('Uni-push配置', admin_route('settings.index', ['type'=>'unipush']));
|
||||||
|
break;
|
||||||
|
case 'ios':
|
||||||
|
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
|
||||||
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
|
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
|
||||||
|
$tab->add('Ios配置', new Ios(), true);
|
||||||
|
$tab->addLink('Android配置', admin_route('settings.index', ['type'=>'android']));
|
||||||
|
$tab->addLink('快递100配置', admin_route('settings.index', ['type'=>'kuaidi100']));
|
||||||
|
$tab->addLink('Uni-push配置', admin_route('settings.index', ['type'=>'unipush']));
|
||||||
|
break;
|
||||||
|
case 'android':
|
||||||
|
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
|
||||||
|
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
|
||||||
|
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
|
||||||
|
$tab->add('Android配置', new Android(), true);
|
||||||
|
$tab->addLink('快递100配置', admin_route('settings.index', ['type'=>'kuaidi100']));
|
||||||
|
$tab->addLink('Uni-push配置', admin_route('settings.index', ['type'=>'unipush']));
|
||||||
break;
|
break;
|
||||||
case 'kuaidi100':
|
case 'kuaidi100':
|
||||||
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
|
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
|
||||||
|
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
|
||||||
|
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
|
||||||
|
$tab->addLink('Android配置', admin_route('settings.index', ['type'=>'android']));
|
||||||
$tab->add('快递100配置', new Kuaidi100(), true);
|
$tab->add('快递100配置', new Kuaidi100(), true);
|
||||||
$tab->addLink('Uni-push配置', admin_route('settings.index', ['type'=>'unipush']));
|
$tab->addLink('Uni-push配置', admin_route('settings.index', ['type'=>'unipush']));
|
||||||
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
|
|
||||||
break;
|
break;
|
||||||
case 'unipush':
|
case 'unipush':
|
||||||
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
|
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
|
||||||
|
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
|
||||||
|
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
|
||||||
|
$tab->addLink('Android配置', admin_route('settings.index', ['type'=>'android']));
|
||||||
$tab->addLink('快递100配置', admin_route('settings.index', ['type'=>'kuaidi100']));
|
$tab->addLink('快递100配置', admin_route('settings.index', ['type'=>'kuaidi100']));
|
||||||
$tab->add('Uni-push配置', new Unipush(), true);
|
$tab->add('Uni-push配置', new Unipush(), true);
|
||||||
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
|
|
||||||
break;
|
break;
|
||||||
case 'distribution':
|
case 'distribution':
|
||||||
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
|
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
|
||||||
|
$tab->add('会员奖励配置', new Distribution(), true);
|
||||||
|
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
|
||||||
|
$tab->addLink('Android配置', admin_route('settings.index', ['type'=>'android']));
|
||||||
$tab->addLink('快递100配置', admin_route('settings.index', ['type'=>'kuaidi100']));
|
$tab->addLink('快递100配置', admin_route('settings.index', ['type'=>'kuaidi100']));
|
||||||
$tab->addLink('Uni-push配置', admin_route('settings.index', ['type'=>'unipush']));
|
$tab->addLink('Uni-push配置', admin_route('settings.index', ['type'=>'unipush']));
|
||||||
$tab->add('会员奖励配置', new Distribution(), true);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Forms\Settings;
|
||||||
|
|
||||||
|
use App\Models\Order;
|
||||||
|
use App\Models\Setting;
|
||||||
|
use App\Services\SettingService;
|
||||||
|
use Dcat\Admin\Widgets\Form;
|
||||||
|
|
||||||
|
class Android extends Form
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle the form request.
|
||||||
|
*
|
||||||
|
* @param array $input
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle(array $input)
|
||||||
|
{
|
||||||
|
Setting::where('key', 'android')->updateOrCreate([
|
||||||
|
'key' => 'android',
|
||||||
|
], ['value' => $input]);
|
||||||
|
|
||||||
|
//清配置缓存
|
||||||
|
app(SettingService::class)->cleanCache('android');
|
||||||
|
|
||||||
|
return $this
|
||||||
|
->response()
|
||||||
|
->success('配置更新成功!')
|
||||||
|
->refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build a form here.
|
||||||
|
*/
|
||||||
|
public function form()
|
||||||
|
{
|
||||||
|
$appSettings = Setting::where('key', 'android')->value('value');
|
||||||
|
|
||||||
|
$this->number('v', '版本号')->min(0)->value($appSettings['v']??0)->help('配置应用最小版本号');
|
||||||
|
$this->divider();
|
||||||
|
|
||||||
|
$this->switch('is_verify', '审核开关')->value($appSettings['is_verify'] ?? 0);
|
||||||
|
$this->switch('wallet_show', '账户开关')->value($appSettings['wallet_show'] ?? 0);
|
||||||
|
|
||||||
|
$this->checkbox('pay_way', '支付方式')->options([
|
||||||
|
Order::PAY_WAY_WXPAY => '微信支付',
|
||||||
|
Order::PAY_WAY_ALIPAY => '支付宝',
|
||||||
|
Order::PAY_WAY_WALLET => '可提',
|
||||||
|
Order::PAY_WAY_BALANCE => '余额',
|
||||||
|
// Order::PAY_WAY_OFFLINE = 'offline'; // 现金支付
|
||||||
|
])->canCheckAll()->customFormat(function () use ($appSettings) {
|
||||||
|
return $appSettings['pay_way']??[];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Forms\Settings;
|
||||||
|
|
||||||
|
use App\Models\Order;
|
||||||
|
use App\Models\Setting;
|
||||||
|
use App\Services\SettingService;
|
||||||
|
use Dcat\Admin\Widgets\Form;
|
||||||
|
|
||||||
|
class Ios extends Form
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle the form request.
|
||||||
|
*
|
||||||
|
* @param array $input
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle(array $input)
|
||||||
|
{
|
||||||
|
Setting::where('key', 'ios')->updateOrCreate([
|
||||||
|
'key' => 'ios',
|
||||||
|
], ['value' => $input]);
|
||||||
|
|
||||||
|
//清配置缓存
|
||||||
|
app(SettingService::class)->cleanCache('ios');
|
||||||
|
|
||||||
|
return $this
|
||||||
|
->response()
|
||||||
|
->success('配置更新成功!')
|
||||||
|
->refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build a form here.
|
||||||
|
*/
|
||||||
|
public function form()
|
||||||
|
{
|
||||||
|
$appSettings = Setting::where('key', 'ios')->value('value');
|
||||||
|
|
||||||
|
$this->number('v', '版本号')->min(0)->value($appSettings['v']??0)->help('配置应用最小版本号');
|
||||||
|
$this->divider();
|
||||||
|
|
||||||
|
$this->switch('is_verify', '审核开关')->value($appSettings['is_verify'] ?? 0);
|
||||||
|
$this->switch('wallet_show', '账户开关')->value($appSettings['wallet_show'] ?? 0);
|
||||||
|
|
||||||
|
$this->checkbox('pay_way', '支付方式')->options([
|
||||||
|
Order::PAY_WAY_WXPAY => '微信支付',
|
||||||
|
Order::PAY_WAY_ALIPAY => '支付宝',
|
||||||
|
Order::PAY_WAY_WALLET => '可提',
|
||||||
|
Order::PAY_WAY_BALANCE => '余额',
|
||||||
|
// Order::PAY_WAY_OFFLINE = 'offline'; // 现金支付
|
||||||
|
])->canCheckAll()->customFormat(function () use ($appSettings) {
|
||||||
|
// dd($appSettings['pay_way']);
|
||||||
|
return $appSettings['pay_way']??[];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Endpoint\Api\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class SettingController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
return response()->json([
|
||||||
|
'ios'=>app_settings('ios'),
|
||||||
|
'android'=>app_settings('android'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -27,6 +27,7 @@ use App\Endpoint\Api\Http\Controllers\Product\ProductFavoriteController;
|
||||||
use App\Endpoint\Api\Http\Controllers\Product\ProductSkuController;
|
use App\Endpoint\Api\Http\Controllers\Product\ProductSkuController;
|
||||||
use App\Endpoint\Api\Http\Controllers\Product\ProductViewLogController;
|
use App\Endpoint\Api\Http\Controllers\Product\ProductViewLogController;
|
||||||
use App\Endpoint\Api\Http\Controllers\PushController;
|
use App\Endpoint\Api\Http\Controllers\PushController;
|
||||||
|
use App\Endpoint\Api\Http\Controllers\SettingController;
|
||||||
use App\Endpoint\Api\Http\Controllers\ShareBgController;
|
use App\Endpoint\Api\Http\Controllers\ShareBgController;
|
||||||
use App\Endpoint\Api\Http\Controllers\ShippingAddressController;
|
use App\Endpoint\Api\Http\Controllers\ShippingAddressController;
|
||||||
use App\Endpoint\Api\Http\Controllers\ShoppingCartItemController;
|
use App\Endpoint\Api\Http\Controllers\ShoppingCartItemController;
|
||||||
|
|
@ -79,6 +80,9 @@ Route::group([
|
||||||
//绑定用户端cid
|
//绑定用户端cid
|
||||||
Route::post('push-bind-uni', [PushController::class, 'bindUniCid']);
|
Route::post('push-bind-uni', [PushController::class, 'bindUniCid']);
|
||||||
|
|
||||||
|
//获取配置
|
||||||
|
Route::get('configs', [SettingController::class, 'index']);
|
||||||
|
|
||||||
Route::middleware(['auth:api'])->group(function () {
|
Route::middleware(['auth:api'])->group(function () {
|
||||||
// 我的信息
|
// 我的信息
|
||||||
Route::get('me', [UserController::class, 'show']);
|
Route::get('me', [UserController::class, 'show']);
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\Order;
|
||||||
use App\Models\Setting;
|
use App\Models\Setting;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
|
@ -35,6 +36,34 @@ class AppSettingSeeder extends Seeder
|
||||||
],
|
],
|
||||||
'remarks' => '系统配置',
|
'remarks' => '系统配置',
|
||||||
],
|
],
|
||||||
|
'ios' => [
|
||||||
|
'value'=> [
|
||||||
|
'v'=>0,
|
||||||
|
'is_verify'=> false,
|
||||||
|
'wallet_show'=> true,
|
||||||
|
'pay_way' => [
|
||||||
|
Order::PAY_WAY_WXPAY,
|
||||||
|
Order::PAY_WAY_ALIPAY,
|
||||||
|
Order::PAY_WAY_WALLET,
|
||||||
|
Order::PAY_WAY_BALANCE,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'remarks' => 'Ios配置',
|
||||||
|
],
|
||||||
|
'android' => [
|
||||||
|
'value'=> [
|
||||||
|
'v'=>0,
|
||||||
|
'is_verify'=> false,
|
||||||
|
'wallet_show'=> true,
|
||||||
|
'pay_way' => [
|
||||||
|
Order::PAY_WAY_WXPAY,
|
||||||
|
Order::PAY_WAY_ALIPAY,
|
||||||
|
Order::PAY_WAY_WALLET,
|
||||||
|
Order::PAY_WAY_BALANCE,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'remarks' => 'Android配置',
|
||||||
|
],
|
||||||
'kuaidi100' => [
|
'kuaidi100' => [
|
||||||
'value' => [
|
'value' => [
|
||||||
'is_use' => true,
|
'is_use' => true,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue