Kirin 9 ヶ月 前
コミット
1fa2e9d583
1 ファイル変更4 行追加42 行削除
  1. 4 42
      app/controller/api/v1/PublicController.php

+ 4 - 42
app/controller/api/v1/PublicController.php

@@ -70,49 +70,11 @@ class PublicController extends BaseController
 
     public function test()
     {
-//        $orders = StoreOrder::where('pid', '>', 0)->where('supplier_id', '>', 0)->select();
-//        var_dump(count($orders));
-//        foreach ($orders as $v) {
-//            SupplierFinanceJob::dispatch([$v['id'], 1]);
-//        }
-        $list = UserExtract::where('uid', 'in', ['60', '72'])->order('id', 'asc')->select();
+        $list = UserIntegral::where('price', 99.99999999)->select();
         foreach ($list as $v) {
-            if ($v['id'] == 183) {
-                continue;
-            }
-            $sum_money = UserExtract::where('uid', 'in', ['60', '72'])
-                ->whereTime('add_time', 'month')
-                ->where('user_type', 0)
-                ->where('extract_type', '<>', 'balance')
-                ->where('status', 1)->where('id', '<', $v['id'])->sum('extract_price');
-            $sum_fee = UserExtract::where('uid', 'in', ['60', '72'])
-                ->whereTime('add_time', 'month')
-                ->where('user_type', 0)
-                ->where('extract_type', '<>', 'balance')
-                ->where('status', 1)->where('id', '<', $v['id'])->sum('extract_fee');
-            $money_sum = bcadd(bcadd((string)$sum_money, (string)$sum_fee, 2), bcadd((string)$v['extract_price'], (string)$v['extract_fee'], 2), 2);
-            $max_range = 0;
-            $range = [];
-            $fee = sys_data('withdraw_fee');
-            foreach ($fee as $vv) {
-                if ($money_sum > $vv['month_number']) {
-                    if ($max_range < $vv['month_number']) {
-                        $range = $vv;
-                        $max_range = $vv['month_number'];
-                    }
-                }
-            }
-            if ($range != []) {
-                if ($range['free_type'] == 1) {
-                    $free = bcdiv(bcmul((string)$money_sum, (string)$range['free']), '100', 2);
-                } else {
-                    $free = $range['free'];
-                }
-                $the_fee = bcdiv(bcmul(bcsub((string)$money_sum, (string)$free, 2), (string)$range['fee']), '100', 2);
-                $the_fee = bcsub((string)$the_fee, (string)$range['dec'], 2);
-                $extract_fee = bcsub((string)$the_fee, (string)$sum_fee, 2);
-                UserExtract::where('id', $v['id'])
-                    ->update(['extract_fee' => $extract_fee, 'extract_price' => bcsub(bcadd((string)$v['extract_price'], (string)$v['extract_fee'], 2), $extract_fee, 2)]);
+            $p = bcdiv($v['sum_price'], $v['num'], 8);
+            if ($p != $v['price']) {
+                UserIntegral::where('id', $v['id'])->update(['price' => $p]);
             }
         }
     }