Browse Source

update: surplus by onetime

tokumeikoi 2 năm trước cách đây
mục cha
commit
7ec4b06536
2 tập tin đã thay đổi với 3 bổ sung7 xóa
  1. 3 7
      app/Services/OrderService.php
  2. 0 0
      public/theme/v2board/assets/umi.js

+ 3 - 7
app/Services/OrderService.php

@@ -170,13 +170,9 @@ class OrderService
             ->orderBy('id', 'DESC')
             ->first();
         if (!$lastOneTimeOrder) return;
-        $plan = Plan::find($lastOneTimeOrder->plan_id);
-        if (!$plan) return;
-        $trafficUnitPrice = $plan->onetime_price / $plan->transfer_enable;
-        if ($user->discount && $trafficUnitPrice) {
-            $trafficUnitPrice = $trafficUnitPrice - ($trafficUnitPrice * $user->discount / 100);
-        }
-        $notUsedTraffic = $plan->transfer_enable - (($user->u + $user->d) / 1073741824);
+        $nowUserTraffic = $user->transfer_enable / 1073741824;
+        $trafficUnitPrice = ($lastOneTimeOrder->total_amount + $lastOneTimeOrder->balance_amount) / $nowUserTraffic;
+        $notUsedTraffic = $nowUserTraffic - (($user->u + $user->d) / 1073741824);
         $result = $trafficUnitPrice * $notUsedTraffic;
         $orderModel = Order::where('user_id', $user->id)->where('period', '!=', 'reset_price')->where('status', 3);
         $order->surplus_amount = $result > 0 ? $result : 0;

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
public/theme/v2board/assets/umi.js


Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác