thirdpayment
elf 11 months ago
parent d9f2d88f78
commit 7c154e0528

@ -10,11 +10,13 @@ use App\Helper\RedisKey;
use App\Helper\StringHelper; use App\Helper\StringHelper;
use App\Model\Account; use App\Model\Account;
use App\Model\BankCard; use App\Model\BankCard;
use App\Model\Order;
use App\Model\User; use App\Model\User;
use Hyperf\HttpServer\Contract\RequestInterface; use Hyperf\HttpServer\Contract\RequestInterface;
use App\Service\PaymentService; use App\Service\PaymentService;
use App\Service\RequestService; use App\Service\RequestService;
use App\Service\UserService; use App\Service\UserService;
use Hyperf\DbConnection\Db;
class AccountController extends AbstractController class AccountController extends AbstractController
{ {
@ -224,4 +226,89 @@ class AccountController extends AbstractController
$url = $this->userService->signWithdrawEntrust($requestLog->getData(), $requestLog->app, $requestLog->request_token); $url = $this->userService->signWithdrawEntrust($requestLog->getData(), $requestLog->app, $requestLog->request_token);
return $this->success(['url' => $url]); 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]);
}
} }

@ -29,4 +29,9 @@ class Order extends Model
{ {
return $this->hasMany(OrderSplitInfo::class, 'order_no', 'order_no'); return $this->hasMany(OrderSplitInfo::class, 'order_no', 'order_no');
} }
public function user()
{
return $this->belongsTo(User::class, 'member_id', 'member_id');
}
} }

@ -10,6 +10,7 @@ use App\Exception\BusinessException;
use App\Helper\Baofu\Baofu; use App\Helper\Baofu\Baofu;
use App\Helper\StringHelper; use App\Helper\StringHelper;
use App\Model\App; use App\Model\App;
use App\Model\BankCard;
use App\Model\Order; use App\Model\Order;
use App\Model\OrderSplitInfo; use App\Model\OrderSplitInfo;
use App\Model\Refund; use App\Model\Refund;
@ -184,6 +185,10 @@ class PaymentService extends AbstractService
if ($params['amount'] < 10) { if ($params['amount'] < 10) {
throw new BusinessException('金额不能小于10'); throw new BusinessException('金额不能小于10');
} }
$bankCard = BankCard::where('app_id', $app->app_id)->where('user_id', $user->user_id)->where('agreement_no', $params['agreementNo'])->first();
if (!$bankCard) {
throw new BusinessException('银行卡不存在');
}
$expiresIn = $params['expiresIn'] ?? 10 * 60; $expiresIn = $params['expiresIn'] ?? 10 * 60;
$order = new Order(); $order = new Order();
$order->app_id = $app->app_id; $order->app_id = $app->app_id;
@ -209,6 +214,13 @@ class PaymentService extends AbstractService
$order->market_info = $params['marketInfo'] ?? []; $order->market_info = $params['marketInfo'] ?? [];
$order->org_split_info_list = $params['splitInfoList']; $order->org_split_info_list = $params['splitInfoList'];
$order->remark = $params['remark'] ?? ''; $order->remark = $params['remark'] ?? '';
$order->last_card_no = $bankCard->last_card_no;
$order->card_user_name = $bankCard->card_user_name;
$order->bank_mobile = $bankCard->bank_mobile;
$order->bank_name = $bankCard->bank_name;
$order->bank_code = $bankCard->bank_code;
$order->card_type = $bankCard->card_type;
$order->cnaps_code = $bankCard->cnaps_code;
$order->save(); $order->save();
$platformAccount = User::getPlatformAccount($params['isAccountPay']); $platformAccount = User::getPlatformAccount($params['isAccountPay']);

@ -50,6 +50,7 @@ Router::addGroup('/account',function () {
Router::get('/company-register', [AccountController::class, 'companyRegister']); Router::get('/company-register', [AccountController::class, 'companyRegister']);
Router::post('/update-password', [AccountController::class, 'updatePassword']); Router::post('/update-password', [AccountController::class, 'updatePassword']);
Router::get('/sign-withdraw-entrust', [AccountController::class, 'signWithdrawEntrust']); Router::get('/sign-withdraw-entrust', [AccountController::class, 'signWithdrawEntrust']);
Router::post('/get-orders', [AccountController::class, 'getOrders']);
}, []); }, []);
Router::addGroup('/notify',function () { Router::addGroup('/notify',function () {

@ -17,16 +17,13 @@
<el-input v-model="search.outOrderNo" placeholder="商户订单号" clearable></el-input> <el-input v-model="search.outOrderNo" placeholder="商户订单号" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item label=""> <el-form-item label="">
<el-input v-model="search.orderNo" placeholder="支付订单号" clearable></el-input> <el-input v-model="search.mobile" placeholder="手机尾号(后四位)" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item label=""> <el-form-item label="">
<el-input v-model="search.cardNo" placeholder="身份证号" clearable></el-input> <el-input v-model="search.bankCardNo" placeholder="银行卡(后四位)" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item label=""> <el-form-item label="">
<el-input v-model="search.mobile" placeholder="手机号" clearable></el-input> <el-input v-model="search.cardUserName" placeholder="名字(不加姓)" clearable></el-input>
</el-form-item>
<el-form-item label="">
<el-input v-model="search.bankCardNo" placeholder="银行卡号" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item label=""> <el-form-item label="">
<el-date-picker <el-date-picker
@ -40,10 +37,11 @@
</el-form-item> </el-form-item>
<el-form-item label=""> <el-form-item label="">
<el-select v-model="search.status" placeholder="支付状态" clearable> <el-select v-model="search.status" placeholder="支付状态" clearable>
<el-option label="支付成功" value="6"></el-option> <el-option label="转账成功,入账成功" value="FINISH"></el-option>
<el-option label="支付失败" value="9"></el-option> <el-option label="转账成功,待入账" value="SUCCESS"></el-option>
<el-option label="待支付" value="2"></el-option> <el-option label="转账成功,入账失败" value="CONFIRM_FAILED"></el-option>
<el-option label="申请失败" value="3"></el-option> <el-option label="转账失败" value="FAILED"></el-option>
<el-option label="待转账" value="PROCESS"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@ -65,28 +63,28 @@
width="180"> width="180">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="real_name" prop="card_user_name"
label="姓名" label="姓名"
width="180"> width="180">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="card_no" prop="certificate_no"
label="身份证号"> label="身份证号">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="bank_card_no" prop="last_card_no"
label="银行卡号"> label="银行卡号(后四位)">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="mobile" prop="bank_mobile"
label="手机号"> label="手机号(后四位)">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="amount" prop="amount"
label="充值金额"> label="充值金额">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="payed_at" prop="created_at"
label="充值时间"> label="充值时间">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -133,12 +131,12 @@
data() { data() {
return { return {
search: { search: {
name: '',
mobile: '', mobile: '',
cardNo: '', cardNo: '',
bankCardNo: '', bankCardNo: '',
orderNo: '', orderNo: '',
outOrderNo: '', outOrderNo: '',
cardUserName: '',
timeRange: null, timeRange: null,
status: undefined status: undefined
}, },
@ -155,10 +153,12 @@
}, },
created() { created() {
if (!window.sessionStorage.getItem('token')) { if (!window.sessionStorage.getItem('token')) {
this.loginVisible = true; window.location.href = '/login.html'
return this.$message.error('请先登录'); return;
} else {
this.getUserInfo();
this.searchList();
} }
this.searchList();
}, },
methods: { methods: {
searchList(page) { searchList(page) {
@ -166,7 +166,7 @@
data.token = window.sessionStorage.getItem('token'); data.token = window.sessionStorage.getItem('token');
data.page = page; data.page = page;
data.pageSize = this.pageSize; data.pageSize = this.pageSize;
axios.post('/recharge/orders', data) axios.post('/account/get-orders', data)
.then( (response) => { .then( (response) => {
console.log(response); console.log(response);
let result = response.data let result = response.data
@ -191,24 +191,6 @@
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.searchList(val) this.searchList(val)
},
login() {
axios.post('/recharge/login', this.loginer)
.then( (response) => {
console.log(response);
let result = response.data
if (result.code != 1000) {
return this.$message.error(response.data.message);
}
window.sessionStorage.setItem('token', result.data.token)
this.loginVisible = false;
this.$message.success('登录成功');
this.searchList(1);
})
.catch((error) => {
this.$message.error('请求错误');
console.log(error);
});
} }
} }
}) })

Loading…
Cancel
Save