| xqd
@@ -44,27 +44,8 @@ class PayCallbackController extends Controller
|
|
|
try {
|
|
|
//更新payment
|
|
|
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', 'total_amount'])->where('id', $payment['order_id'])->first();
|
|
|
- $order_status = 2;
|
|
|
- if (in_array($order['product_type'], [3,4,5])) {
|
|
|
- $order_status = 7;
|
|
|
- }
|
|
|
- elseif ($order['product_type'] == 6) {
|
|
|
- $order_status = 3;
|
|
|
- }
|
|
|
- elseif ($order['product_type'] == 7) {
|
|
|
- $order_status = 4;
|
|
|
- //改变用户余额
|
|
|
- User::changeBalance($order['user_id'], $order['total_amount'], 2, $order['id'], '充值');
|
|
|
- }
|
|
|
- //更新订单
|
|
|
- Order::where('id', $payment['order_id'])->update([
|
|
|
- 'order_status' => $order_status,
|
|
|
- 'payment_status' => 2,
|
|
|
- 'payment_time' => time(),
|
|
|
- ]);
|
|
|
|
|
|
- Order::payCompletedHandle($order['id']);
|
|
|
+ Order::payCompletedHandle($payment['order_id']);
|
|
|
|
|
|
// 提交事务
|
|
|
DB::commit();
|