|
|
|
@ -10,11 +10,13 @@ use App\Helper\RedisKey;
|
|
|
|
|
use App\Helper\StringHelper;
|
|
|
|
|
use App\Model\Account;
|
|
|
|
|
use App\Model\BankCard;
|
|
|
|
|
use App\Model\Order;
|
|
|
|
|
use App\Model\User;
|
|
|
|
|
use Hyperf\HttpServer\Contract\RequestInterface;
|
|
|
|
|
use App\Service\PaymentService;
|
|
|
|
|
use App\Service\RequestService;
|
|
|
|
|
use App\Service\UserService;
|
|
|
|
|
use Hyperf\DbConnection\Db;
|
|
|
|
|
|
|
|
|
|
class AccountController extends AbstractController
|
|
|
|
|
{
|
|
|
|
@ -224,4 +226,89 @@ class AccountController extends AbstractController
|
|
|
|
|
$url = $this->userService->signWithdrawEntrust($requestLog->getData(), $requestLog->app, $requestLog->request_token);
|
|
|
|
|
return $this->success(['url' => $url]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getOrders(RequestInterface $request)
|
|
|
|
|
{
|
|
|
|
|
$userInfo = $this->checkUser($request);
|
|
|
|
|
$userId = $this->resetUserId($userInfo['userId']);
|
|
|
|
|
$query = Order::query()->with('user');
|
|
|
|
|
if ($userId != 'ACT_5') {
|
|
|
|
|
$query->where('user_id', $userId);
|
|
|
|
|
}
|
|
|
|
|
if (!empty($request->input('outOrderNo'))) {
|
|
|
|
|
$query->where('out_order_no', $request->input('outOrderNo'));
|
|
|
|
|
}
|
|
|
|
|
if (!empty($request->input('mobile'))) {
|
|
|
|
|
$query->where('bank_mobile', $request->input('mobile'));
|
|
|
|
|
}
|
|
|
|
|
if (!empty($request->input('bankCardNo'))) {
|
|
|
|
|
$query->where('last_card_no', $request->input('bankCardNo'));
|
|
|
|
|
}
|
|
|
|
|
if (!empty($request->input('cardUserName'))) {
|
|
|
|
|
$query->where('card_user_name', 'like', Db::raw('%' . $request->input('cardUserName'));
|
|
|
|
|
}
|
|
|
|
|
$status = $request->input('status');
|
|
|
|
|
if (!empty($status)) {
|
|
|
|
|
$statusList = [];
|
|
|
|
|
if ($status == 'FAILED') {
|
|
|
|
|
$statusList = ['APPLY_FAILED', 'FAILED'];
|
|
|
|
|
} elseif ($status == 'FINISH') {
|
|
|
|
|
$statusList = ['CONFIRM_SUCCESS', 'FINISH'];
|
|
|
|
|
} elseif ($status == 'SUCCESS') {
|
|
|
|
|
$statusList = ['SUCCESS'];
|
|
|
|
|
} elseif ($status == 'CONFIRM_FAILED') {
|
|
|
|
|
$statusList = ['CONFIRM_FAILED'];
|
|
|
|
|
} elseif ($status == 'PROCESS') {
|
|
|
|
|
$statusList = ['APPLY_SUCCESS', 'PROCESS'];
|
|
|
|
|
}
|
|
|
|
|
$query->whereIn('status', $statusList);
|
|
|
|
|
}
|
|
|
|
|
if (!empty($request->input('timeRange'))) {
|
|
|
|
|
$timeRange[0] .= ' 00:00:00';
|
|
|
|
|
$timeRange[1] .= ' 23:59:59';
|
|
|
|
|
$query->whereBetween('created_at', $timeRange);
|
|
|
|
|
}
|
|
|
|
|
$countQuery = clone $query;
|
|
|
|
|
$sumQuery = clone $query;
|
|
|
|
|
$total = $countQuery->count();
|
|
|
|
|
$amount = $sumQuery->sum('amount');
|
|
|
|
|
$orders = $query->get();
|
|
|
|
|
|
|
|
|
|
$records = [];
|
|
|
|
|
foreach ($orders as $order) {
|
|
|
|
|
$statusText = '';
|
|
|
|
|
$systemStatus = '';
|
|
|
|
|
if (in_array($order->status, ['APPLY_FAILED', 'FAILED'])) {
|
|
|
|
|
$statusText = '转账失败';
|
|
|
|
|
$systemStatus = 'FAILED';
|
|
|
|
|
} elseif (in_array($order->status, ['CONFIRM_SUCCESS', 'FINISH'])) {
|
|
|
|
|
$statusText = '转账成功,入账成功';
|
|
|
|
|
$systemStatus = 'FINISH';
|
|
|
|
|
} elseif (in_array($order->status, ['SUCCESS'])) {
|
|
|
|
|
$statusText = '转账成功,待入账';
|
|
|
|
|
$systemStatus = 'SUCCESS';
|
|
|
|
|
} elseif (in_array($order->status, ['CONFIRM_FAILED'])) {
|
|
|
|
|
$statusText = '转账成功,入账失败';
|
|
|
|
|
$systemStatus = 'CONFIRM_FAILED';
|
|
|
|
|
} elseif (in_array($order->status, ['APPLY_SUCCESS', 'PROCESS'])) {
|
|
|
|
|
$statusText = '待转账';
|
|
|
|
|
$systemStatus = 'PROCESS';
|
|
|
|
|
}
|
|
|
|
|
$records[] = [
|
|
|
|
|
'out_order_no' => $order->out_order_no,
|
|
|
|
|
'created_at' => $order->created_at,
|
|
|
|
|
'status' => $order->status,
|
|
|
|
|
'amount' => number_format($order->amount / 100, 2, '.', ''),
|
|
|
|
|
'card_user_name' => $order->card_user_name,
|
|
|
|
|
'last_card_no' => $order->last_card_no,
|
|
|
|
|
'bank_mobile' => $order->bank_mobile,
|
|
|
|
|
'certificate_no' => $order->ucertificate_no,
|
|
|
|
|
'status' => $order->status,
|
|
|
|
|
'system_status' => $systemStatus,
|
|
|
|
|
'status_text' => $statusText,
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $this->success(['records' => $records, 'total' => $total, 'amount' => $amount]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|