Kirin vor 1 Jahr
Ursprung
Commit
44c0948ece

+ 13 - 9
app/controller/api/v1/user/UserExtractController.php

@@ -59,16 +59,19 @@ class UserExtractController
             ->where('extract_type', '<>', 'balance')
             ->where('status', 1)->sum('extract_price');
         $money = $request->post('money');
+        $user_type = $request->post('user_type', 0);
         $extract_fee = 0;
-        $max = PHP_INT_MAX;
-        foreach ($fees as $k => $v) {
-            if ($sum_money > $max) {
-                break;
-            }
-            $max = $k;
-            if ($sum_money + $money > $k) {
-                $extract_fee = bcadd((string)$extract_fee, bcmul((string)($sum_money + $money - ($sum_money > $k ? $sum_money : $k)), bcdiv($v, '100', 4), 2));
-                $money = $money - ($sum_money + $money - $k);
+        if ($user_type == 0) {
+            $max = PHP_INT_MAX;
+            foreach ($fees as $k => $v) {
+                if ($sum_money > $max) {
+                    break;
+                }
+                $max = $k;
+                if ($sum_money + $money > $k) {
+                    $extract_fee = bcadd((string)$extract_fee, bcmul((string)($sum_money + $money - ($sum_money > $k ? $sum_money : $k)), bcdiv($v, '100', 4), 2));
+                    $money = $money - ($sum_money + $money - $k);
+                }
             }
         }
         return app('json')->success('ok', ['fee' => $extract_fee]);
@@ -91,6 +94,7 @@ class UserExtractController
             ['cardnum', ''],
             ['weixin', ''],
             ['qrcode_url', ''],
+            ['user_type', 0],
         ]);
         $extractType = Config::get('pay.extractType', []);
         if (!in_array($extractInfo['extract_type'], $extractType))

+ 13 - 10
app/services/user/UserExtractServices.php

@@ -488,15 +488,17 @@ class UserExtractServices extends BaseServices
             ->where('status', 1)->sum('extract_price');
         $money = $data['money'];
         $extract_fee = 0;
-        $max = PHP_INT_MAX;
-        foreach ($fees as $k => $v) {
-            if ($sum_money > $max) {
-                break;
-            }
-            $max = $k;
-            if ($sum_money + $money > $k) {
-                $extract_fee = bcadd((string)$extract_fee, bcmul((string)($sum_money + $money - ($sum_money > $k ? $sum_money : $k)), bcdiv($v, '100', 4), 2));
-                $money = $money - ($sum_money + $money - $k);
+        if ($data['user_type'] == 0) {
+            $max = PHP_INT_MAX;
+            foreach ($fees as $k => $v) {
+                if ($sum_money > $max) {
+                    break;
+                }
+                $max = $k;
+                if ($sum_money + $money > $k) {
+                    $extract_fee = bcadd((string)$extract_fee, bcmul((string)($sum_money + $money - ($sum_money > $k ? $sum_money : $k)), bcdiv($v, '100', 4), 2));
+                    $money = $money - ($sum_money + $money - $k);
+                }
             }
         }
         $insertData = [
@@ -507,7 +509,8 @@ class UserExtractServices extends BaseServices
             'add_time' => time(),
             'balance' => $user['brokerage_price'],
             'image' => $data['image'],
-            'status' => 0
+            'status' => 0,
+            'user_type' => $data['user_type']
         ];
         if (isset($data['name']) && strlen(trim($data['name']))) $insertData['real_name'] = $data['name'];
         else $insertData['real_name'] = $user['nickname'];