mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
update: add payment sort
This commit is contained in:
parent
b6085fd34d
commit
8e23e74e53
@ -8,6 +8,7 @@ use App\Utils\Helper;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Payment;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class PaymentController extends Controller
|
||||
{
|
||||
@ -24,7 +25,7 @@ class PaymentController extends Controller
|
||||
|
||||
public function fetch()
|
||||
{
|
||||
$payments = Payment::all();
|
||||
$payments = Payment::orderBy('sort', 'ASC')->get();
|
||||
foreach ($payments as $k => $v) {
|
||||
$notifyUrl = url("/api/v1/guest/payment/notify/{$v->payment}/{$v->uuid}");
|
||||
if ($v->notify_domain) {
|
||||
@ -107,4 +108,26 @@ class PaymentController extends Controller
|
||||
'data' => $payment->delete()
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function sort(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'ids' => 'required|array'
|
||||
], [
|
||||
'ids.required' => '参数有误',
|
||||
'ids.array' => '参数有误'
|
||||
]);
|
||||
DB::beginTransaction();
|
||||
foreach ($request->input('ids') as $k => $v) {
|
||||
if (!Payment::find($v)->update(['sort' => $k + 1])) {
|
||||
DB::rollBack();
|
||||
abort(500, '保存失败');
|
||||
}
|
||||
}
|
||||
DB::commit();
|
||||
return response([
|
||||
'data' => true
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +232,9 @@ class OrderController extends Controller
|
||||
'handling_fee_fixed',
|
||||
'handling_fee_percent'
|
||||
])
|
||||
->where('enable', 1)->get();
|
||||
->where('enable', 1)
|
||||
->orderBy('sort', 'ASC')
|
||||
->get();
|
||||
|
||||
return response([
|
||||
'data' => $methods
|
||||
|
@ -112,6 +112,7 @@ class AdminRoute
|
||||
$router->post('/payment/save', 'Admin\\PaymentController@save');
|
||||
$router->post('/payment/drop', 'Admin\\PaymentController@drop');
|
||||
$router->post('/payment/show', 'Admin\\PaymentController@show');
|
||||
$router->post('/payment/sort', 'Admin\\PaymentController@sort');
|
||||
// System
|
||||
$router->get ('/system/getSystemStatus', 'Admin\\SystemController@getSystemStatus');
|
||||
$router->get ('/system/getQueueStats', 'Admin\\SystemController@getQueueStats');
|
||||
|
2
public/assets/admin/components.chunk.css
vendored
2
public/assets/admin/components.chunk.css
vendored
File diff suppressed because one or more lines are too long
2
public/assets/admin/umi.js
vendored
2
public/assets/admin/umi.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user