|
@@ -7,6 +7,7 @@ namespace App\Controllers\User;
|
|
|
use App\Controllers\BaseController;
|
|
use App\Controllers\BaseController;
|
|
|
use App\Models\Invoice;
|
|
use App\Models\Invoice;
|
|
|
use App\Models\Paylist;
|
|
use App\Models\Paylist;
|
|
|
|
|
+use App\Models\UserMoneyLog;
|
|
|
use App\Services\Payment;
|
|
use App\Services\Payment;
|
|
|
use App\Utils\Tools;
|
|
use App\Utils\Tools;
|
|
|
use Exception;
|
|
use Exception;
|
|
@@ -103,9 +104,19 @@ final class InvoiceController extends BaseController
|
|
|
]);
|
|
]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ $money_before = $user->money;
|
|
|
$user->money -= $invoice->price;
|
|
$user->money -= $invoice->price;
|
|
|
$user->save();
|
|
$user->save();
|
|
|
|
|
|
|
|
|
|
+ $money_log = new UserMoneyLog();
|
|
|
|
|
+ $money_log->user_id = $user->id;
|
|
|
|
|
+ $money_log->before = $money_before;
|
|
|
|
|
+ $money_log->after = $user->money;
|
|
|
|
|
+ $money_log->amount = -$invoice->price;
|
|
|
|
|
+ $money_log->remark = '支付账单 #' . $invoice->id;
|
|
|
|
|
+ $money_log->create_time = time();
|
|
|
|
|
+ $money_log->save();
|
|
|
|
|
+
|
|
|
$invoice->status = 'paid_balance';
|
|
$invoice->status = 'paid_balance';
|
|
|
$invoice->update_time = time();
|
|
$invoice->update_time = time();
|
|
|
$invoice->pay_time = time();
|
|
$invoice->pay_time = time();
|