阶段更新
This commit is contained in:
32
modules/Mall/Http/Controllers/Admin/Action/Shop/Close.php
Normal file
32
modules/Mall/Http/Controllers/Admin/Action/Shop/Close.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Mall\Http\Controllers\Admin\Action\Shop;
|
||||
|
||||
use Encore\Admin\Actions\Response;
|
||||
use Encore\Admin\Actions\RowAction;
|
||||
use Modules\Mall\Models\Shop;
|
||||
|
||||
class Close extends RowAction
|
||||
{
|
||||
|
||||
public $name = '关闭店铺';
|
||||
|
||||
public function handle(Shop $shop): Response
|
||||
{
|
||||
try {
|
||||
if ($shop->close()) {
|
||||
return $this->response()->success('店铺关闭成功')->refresh();
|
||||
} else {
|
||||
return $this->response()->error('店铺关闭失败')->refresh();
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
return $this->response()->error($exception->getMessage())->refresh();
|
||||
}
|
||||
}
|
||||
|
||||
public function dialog()
|
||||
{
|
||||
$this->confirm('确定关闭店铺吗?');
|
||||
}
|
||||
|
||||
}
|
||||
32
modules/Mall/Http/Controllers/Admin/Action/Shop/Open.php
Normal file
32
modules/Mall/Http/Controllers/Admin/Action/Shop/Open.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Mall\Http\Controllers\Admin\Action\Shop;
|
||||
|
||||
use Encore\Admin\Actions\Response;
|
||||
use Encore\Admin\Actions\RowAction;
|
||||
use Modules\Mall\Models\Shop;
|
||||
|
||||
class Open extends RowAction
|
||||
{
|
||||
|
||||
public $name = '开启店铺';
|
||||
|
||||
public function handle(Shop $shop): Response
|
||||
{
|
||||
try {
|
||||
if ($shop->open()) {
|
||||
return $this->response()->success('店铺开启成功')->refresh();
|
||||
} else {
|
||||
return $this->response()->error('店铺开启失败')->refresh();
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
return $this->response()->error($exception->getMessage())->refresh();
|
||||
}
|
||||
}
|
||||
|
||||
public function dialog()
|
||||
{
|
||||
$this->confirm('确定开启店铺吗?');
|
||||
}
|
||||
|
||||
}
|
||||
32
modules/Mall/Http/Controllers/Admin/Action/Shop/Pass.php
Normal file
32
modules/Mall/Http/Controllers/Admin/Action/Shop/Pass.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Mall\Http\Controllers\Admin\Action\Shop;
|
||||
|
||||
use Encore\Admin\Actions\Response;
|
||||
use Encore\Admin\Actions\RowAction;
|
||||
use Modules\Mall\Models\Shop;
|
||||
|
||||
class Pass extends RowAction
|
||||
{
|
||||
|
||||
public $name = '审核通过';
|
||||
|
||||
public function handle(Shop $shop): Response
|
||||
{
|
||||
try {
|
||||
if ($shop->pass()) {
|
||||
return $this->response()->success('审核通过成功')->refresh();
|
||||
} else {
|
||||
return $this->response()->error('审核通过失败')->refresh();
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
return $this->response()->error($exception->getMessage())->refresh();
|
||||
}
|
||||
}
|
||||
|
||||
public function dialog()
|
||||
{
|
||||
$this->confirm('确定审核通过?');
|
||||
}
|
||||
|
||||
}
|
||||
33
modules/Mall/Http/Controllers/Admin/Action/Shop/Reject.php
Normal file
33
modules/Mall/Http/Controllers/Admin/Action/Shop/Reject.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Mall\Http\Controllers\Admin\Action\Shop;
|
||||
|
||||
use Encore\Admin\Actions\Response;
|
||||
use Encore\Admin\Actions\RowAction;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Mall\Models\Shop;
|
||||
|
||||
class Reject extends RowAction
|
||||
{
|
||||
|
||||
public $name = '驳回申请';
|
||||
|
||||
public function handle(Shop $shop, Request $request): Response
|
||||
{
|
||||
try {
|
||||
if ($shop->reject($request->reject_reason)) {
|
||||
return $this->response()->success('驳回申请成功')->refresh();
|
||||
} else {
|
||||
return $this->response()->error('驳回申请失败')->refresh();
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
return $this->response()->error($exception->getMessage())->refresh();
|
||||
}
|
||||
}
|
||||
|
||||
public function form()
|
||||
{
|
||||
$this->textarea('reject_reason', '驳回原因')->rules('required');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user