失败的订单

This commit is contained in:
wanyongkang
2020-10-16 17:45:04 +08:00
parent 3aadd03949
commit a2b249bece
5 changed files with 108 additions and 21 deletions

View File

@@ -5,7 +5,7 @@
* @Author: kangkang
* @Date: 2020-10-13 19:52:37
* @LastEditors: kangkang
* @LastEditTime: 2020-10-15 17:51:08
* @LastEditTime: 2020-10-16 11:15:13
*/
/*
* @Descripttion:
@@ -29,9 +29,11 @@ class TbRefund extends Controller
public function refundList()
{
$refund = new RefundMOdel;
$userModel = new UserModel;
$list = $refund->getListPage();
foreach ($list as &$v) {
$v['status'] = RefundEnum::$refundStatus[$v['status']];
$v['account'] = $userModel->getOne(['LoginCode' => $v['Phone']])['RestAmount'];
}
$count = $refund->getCount();
$data = [
@@ -49,9 +51,11 @@ class TbRefund extends Controller
}
$page = ($_GET['page'] - 1) * 50;
$refund = new RefundMOdel;
$userModel = new UserModel;
$list = $refund->getListPage([], '*', 'id desc', "$page,50");
foreach ($list as &$v) {
$v['status'] = RefundEnum::$refundStatus[$v['status']];
$v['account'] = $userModel->getOne(['LoginCode' => $v['Phone']])['RestAmount'];
}
$data = [
'Code' => 10000,
@@ -65,6 +69,7 @@ class TbRefund extends Controller
{
$Phone = json_decode(file_get_contents("php://input"), true)['Phone'];
$refund = new RefundMOdel;
$userModel = new UserModel;
if ($Phone) {
$list = $refund->getListPage(['Phone' => $Phone], '*', 'id desc', '100');
} else {
@@ -73,6 +78,7 @@ class TbRefund extends Controller
}
foreach ($list as &$v) {
$v['status'] = RefundEnum::$refundStatus[$v['status']];
$v['account'] = $userModel->getOne(['LoginCode' => $v['Phone']])['RestAmount'];
}
$data = [
'Code' => 10000,
@@ -96,11 +102,7 @@ class TbRefund extends Controller
$refund = new RefundMOdel;
$where = ['Id' => $id];
$info = $refund->getOne($where);
$data = [
'Code' => 10000,
'data' => $info,
];
echo json_encode($data);
\result($info);
}
/**
@@ -124,12 +126,7 @@ class TbRefund extends Controller
//判断余额是否大于退款金额
$returnOk = $user_info['RestAmount'] - $refund_info["RefundFee"];
if ($returnOk < 0) {
$return = [
'Code' => 30000,
'msg' => '余额不足',
];
echo json_encode($return);
die;
\result([],'余额不足',30000);
} else {
$update_data['f_balance'] = $user_info['RestAmount'];
if ($refund->updateOne(['Id' => $id], $update_data)) {