|
@@ -44,7 +44,7 @@ class PayCallbackController extends Controller
|
|
try {
|
|
try {
|
|
//更新payment
|
|
//更新payment
|
|
Payment::where('id', $payment['id'])->update(['online_sn' => $message['transaction_id'], 'status' => 2, 'payment_time' => time()]);
|
|
Payment::where('id', $payment['id'])->update(['online_sn' => $message['transaction_id'], 'status' => 2, 'payment_time' => time()]);
|
|
- $order = Order::select(['id', 'user_id', 'docter_id', 'product_type', 'payment_amount'])->where('id', $payment['order_id'])->first();
|
|
|
|
|
|
+ $order = Order::select(['id', 'user_id', 'docter_id', 'product_type', 'payment_amount', 'total_amount'])->where('id', $payment['order_id'])->first();
|
|
$order_status = 2;
|
|
$order_status = 2;
|
|
if (in_array($order['product_type'], [3,4,5,6])) {
|
|
if (in_array($order['product_type'], [3,4,5,6])) {
|
|
$order_status = 3;
|
|
$order_status = 3;
|
|
@@ -52,7 +52,7 @@ class PayCallbackController extends Controller
|
|
elseif ($order['product_type'] == 7) {
|
|
elseif ($order['product_type'] == 7) {
|
|
$order_status = 4;
|
|
$order_status = 4;
|
|
//改变用户余额
|
|
//改变用户余额
|
|
- User::changeBalance($order['user_id'], $order['payment_amount'], 2, $order['id'], '充值');
|
|
|
|
|
|
+ User::changeBalance($order['user_id'], $order['total_amount'], 2, $order['id'], '充值');
|
|
}
|
|
}
|
|
//更新订单
|
|
//更新订单
|
|
Order::where('id', $payment['order_id'])->update([
|
|
Order::where('id', $payment['order_id'])->update([
|
|
@@ -66,6 +66,8 @@ class PayCallbackController extends Controller
|
|
Docter::where('id', $order['docter_id'])->increment('service_persons');
|
|
Docter::where('id', $order['docter_id'])->increment('service_persons');
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ Order::payCompletedHandle($order['id']);
|
|
|
|
+
|
|
// 提交事务
|
|
// 提交事务
|
|
DB::commit();
|
|
DB::commit();
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|