|
@@ -19,7 +19,7 @@ class PaymentOrder extends Controller
|
|
|
try {
|
|
try {
|
|
|
$validate = [
|
|
$validate = [
|
|
|
// 'id' => ['required', 'integer', 'min:1'],
|
|
// 'id' => ['required', 'integer', 'min:1'],
|
|
|
- 'ids' => ['required', 'array', 'min:1','max:20'],
|
|
|
|
|
|
|
+ 'ids' => ['required', 'array', 'min:1', 'max:20'],
|
|
|
'ids.*' => ['required', 'integer', 'min:1'],
|
|
'ids.*' => ['required', 'integer', 'min:1'],
|
|
|
'status' => ['required', 'integer', 'in:1,3'],
|
|
'status' => ['required', 'integer', 'in:1,3'],
|
|
|
];
|
|
];
|
|
@@ -31,16 +31,17 @@ class PaymentOrder extends Controller
|
|
|
$remark = request()->input('remark', '');
|
|
$remark = request()->input('remark', '');
|
|
|
|
|
|
|
|
$count = 0;
|
|
$count = 0;
|
|
|
- if ($params['status'] == 1) {
|
|
|
|
|
- $ret = PaymentOrderService::createPayout($params['id']);
|
|
|
|
|
- if ($ret['code'] === 0)$count++;
|
|
|
|
|
- if ($ret['code'] !== 0) throw new Exception($ret['msg'], HttpStatus::CUSTOM_ERROR);
|
|
|
|
|
- } else {
|
|
|
|
|
- $ret = PaymentOrderService::withdrawalFailed($params['id'], $remark);
|
|
|
|
|
- if ($ret['code'] === 0)$count++;
|
|
|
|
|
- if ($ret['code'] !== 0) throw new Exception($ret['msg'], HttpStatus::CUSTOM_ERROR);
|
|
|
|
|
|
|
+ foreach ($params['ids'] as $id) {
|
|
|
|
|
+ if ($params['status'] == 1) {
|
|
|
|
|
+ $ret = PaymentOrderService::createPayout($id);
|
|
|
|
|
+ if ($ret['code'] === 0) $count++;
|
|
|
|
|
+ if ($ret['code'] !== 0) throw new Exception($ret['msg'], HttpStatus::CUSTOM_ERROR);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $ret = PaymentOrderService::withdrawalFailed($id, $remark);
|
|
|
|
|
+ if ($ret['code'] === 0) $count++;
|
|
|
|
|
+ if ($ret['code'] !== 0) throw new Exception($ret['msg'], HttpStatus::CUSTOM_ERROR);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
if ($count < 1) {
|
|
if ($count < 1) {
|
|
|
throw new Exception('操作失败', HttpStatus::CUSTOM_ERROR);
|
|
throw new Exception('操作失败', HttpStatus::CUSTOM_ERROR);
|
|
|
}
|
|
}
|