WIN-2308041133\Administrator hai 4 meses
pai
achega
c595f26e84

+ 1 - 1
app/common/model/user/AwardLake.php

@@ -24,7 +24,7 @@ class AwardLake extends BaseModel
     }
 
     /**
-     * 奖池累加
+     * 奖池累加  已经废弃
      * @param int $lake_type 奖池类型 1:节能油,2:礼包
      * @param float $order_price 订单价格
      * @param int $order_id 订单ID

+ 35 - 28
app/common/repositories/store/order/StoreOrderRepository.php

@@ -1116,29 +1116,32 @@ class StoreOrderRepository extends BaseRepository
             $range_type = 'energy_saving_oil';
             $integral_type = 'spread_oil_integral';
             //            发放分红积分
-            $number2 = systemConfig('award_integral_energy_saving_oil', 1);
+            $number2 = systemConfig('award_integral_ordinary', 6);
         } elseif ($type == 0) {
             $mark = '普通';
             $range_type = 'ordinary';
             $integral_type = 'ordinary_integral';
-            $number2 = systemConfig('award_integral_ordinary', 1);
+            $number2 = systemConfig('award_integral_ordinary', 6);
         } elseif ($type == 6) {
             $mark = '礼包';
             $range_type = 'award_gift_pack';
             $integral_type = 'spread_pack_integral';
             $number2 = systemConfig('award_integral_gift_pack', 1);
         }
+        $number2 = bcmul($number2,0.01,2);
         if ($type == 5 || $type == 0) {  //节能油商品和普通商品
-            $number = systemConfig('award_energy_saving_oil', 1);  //获得份额的基准线
-            if ($order['pay_price'] >= $number) {
+//            $number = systemConfig('award_energy_saving_oil', 1);  //获得份额的基准线
+//            if ($order['pay_price'] >= $number) {
 //                $count = app()->make(User::class)->spread_order($order['uid']);  //获取推荐下级订单数
                 $count = $user['spread_pay_count'];
+                $multiple = systemConfig('award_ordinary', 3);  //获得份额的倍数
                 @file_put_contents('quanju.txt', $count . "-下级订单数量\r\n", 8);
                 if ($count > 0) {
-                    $order_award_range = bcmul($order['pay_price'], 3, 2);
+                    $order_award_range = bcmul($order['pay_price'], $multiple, 2);
                 } else {
+                    $multiple = bcsub($multiple, 1, 0);
                     $order_award_range = bcmul($order['pay_price'], 1, 2);
-                    $unclaimed_range = bcmul($order['pay_price'], 2, 2);
+                    $unclaimed_range = bcmul($order['pay_price'], $multiple, 2);
                     $unclaimed_range_after = bcadd($user['unclaimed_range'], $unclaimed_range, 2);
                     //                发放冻结份额
                     $make->incBill($order['uid'], 'award_unclaimed_range', 'unclaimed_range', [
@@ -1163,12 +1166,13 @@ class StoreOrderRepository extends BaseRepository
                     'mark' => $user['nickname'] . '成功消费' . $mark . '商品' . floatval($order['pay_price']) . '元,奖励分红额度' . $order_award_range,
                 ]);
                 User::where('uid', $order['uid'])->update(['award_range' => $after]);
-            }
+//            }
         } elseif ($type == 6) {  //礼包商品
-            $number = systemConfig('award_energy_saving_oil', 1);
+//            $number = systemConfig('award_energy_saving_oil', 1);
             @file_put_contents('quanju2.txt', $order['pay_price'] . "-支付金额\r\n", 8);
-            if ($order['pay_price'] >= $number) {
-                $order_award_range = bcmul($order['pay_price'], 3, 2);
+//            if ($order['pay_price'] >= $number) {
+            $multiple = systemConfig('award_gift_pack', 3);  //获得份额的倍数
+                $order_award_range = bcmul($order['pay_price'], $multiple, 2);
                 $after = bcadd($award_range, $order_award_range, 2);
                 $res = $make->incBill($order['uid'], 'award_range', 'award_gift_pack', [
                     'number' => $order_award_range,
@@ -1180,14 +1184,15 @@ class StoreOrderRepository extends BaseRepository
                 ]);
                 User::where('uid', $order['uid'])->update(['award_range' => $after]);
                 @file_put_contents('quanju2.txt', $res . "-结果\r\n", 8);
-            }
+//            }
 //            礼包购买数
             $this->pack_count($order['uid']);
         }
 
         $award_integral = $user['award_integral'];
-        if ($order['pay_price'] >= $number2) {
-            $order_award_range = bcmul($order['pay_price'], 0.2, 2);
+//        if ($order['pay_price'] >= $number2) {
+
+            $order_award_range = bcmul($order['pay_price'], $number2, 2);
             $order_award_range = bcdiv($order_award_range, $price['price'], 2);  //20%的业绩除以积分价格得到分红积分
             $after2 = bcadd($award_integral, $order_award_range, 2);
             $make->incBill($order['uid'], 'award_integral', $integral_type, [
@@ -1199,7 +1204,7 @@ class StoreOrderRepository extends BaseRepository
                 'mark' => $user['nickname'] . '成功消费' . $mark . '商品' . floatval($order['pay_price']) . '元,奖励分红积分' . $order_award_range . '(积分价格:' . $price['price'] . ')',
             ]);
             User::where('uid', $order['uid'])->update(['award_integral' => $after2]);
-        }
+//        }
 //        解冻冻结奖金
         $UserRepository = app()->make(UserRepository::class);
         $UserRepository->extractBrokerage($order['uid']);
@@ -1249,22 +1254,22 @@ class StoreOrderRepository extends BaseRepository
             $oil = app()->make(OilLevel::class);
             $oil->checkLevel($order['uid']);
 
-            $ratio = systemConfig('energy_saving_oil_ratio', 10);
-            @file_put_contents('quanju2.txt', $ratio . "-奖池比例12\r\n", 8);
-            $jackpot = bcmul($order['pay_price'], bcmul($ratio, 0.01, 2), 2);
-            @file_put_contents('quanju2.txt', $jackpot . "-奖池分到的金额12\r\n", 8);
-            $awardLake->addOrderLakes(1, $jackpot, $order['order_id']);
-            @file_put_contents('quanju2.txt', "-路径检查3\r\n", 8);
+//            $ratio = systemConfig('energy_saving_oil_ratio', 10);
+//            @file_put_contents('quanju2.txt', $ratio . "-奖池比例12\r\n", 8);
+//            $jackpot = bcmul($order['pay_price'], bcmul($ratio, 0.01, 2), 2);
+//            @file_put_contents('quanju2.txt', $jackpot . "-奖池分到的金额12\r\n", 8);
+//            $awardLake->addOrderLakes(1, $jackpot, $order['order_id']);
+//            @file_put_contents('quanju2.txt', "-路径检查3\r\n", 8);
         } elseif ($type == 6) {
             $gift = app()->make(GiftLevel::class);
             $gift->checkLevel($order['uid']);
 
-            $ratio = systemConfig('gift_pack_ratio', 10);
-            @file_put_contents('quanju2.txt', $ratio . "-奖池比例\r\n", 8);
-            $jackpot = bcmul($order['pay_price'], bcmul($ratio, 0.01, 2), 2);
-            @file_put_contents('quanju2.txt', $jackpot . "-奖池分到的金额\r\n", 8);
-            $awardLake->addOrderLakes(2, $jackpot, $order['order_id']);
-            @file_put_contents('quanju2.txt', "-路径检查4\r\n", 8);
+//            $ratio = systemConfig('gift_pack_ratio', 10);
+//            @file_put_contents('quanju2.txt', $ratio . "-奖池比例\r\n", 8);
+//            $jackpot = bcmul($order['pay_price'], bcmul($ratio, 0.01, 2), 2);
+//            @file_put_contents('quanju2.txt', $jackpot . "-奖池分到的金额\r\n", 8);
+//            $awardLake->addOrderLakes(2, $jackpot, $order['order_id']);
+//            @file_put_contents('quanju2.txt', "-路径检查4\r\n", 8);
         }
         return true;
     }
@@ -1451,11 +1456,13 @@ class StoreOrderRepository extends BaseRepository
                 $field = 'oil_level';
                 $product_type = 1;
                 $title = '节能油团队奖励';
+                $performance_ratio = systemConfig('energy_saving_oil_ratio',10);
             } else {
                 $model = new GiftLevel();
                 $field = 'gift_level';
                 $product_type = 2;
                 $title = '礼包团队奖励';
+                $performance_ratio = systemConfig('gift_pack_ratio',10);
             }
 //                case 1:
 //                    $model = new OilLevel();
@@ -1469,9 +1476,9 @@ class StoreOrderRepository extends BaseRepository
 //                    $name = '礼包';
 //                    $title = '礼包积分分红';
 //                    break;
-
+            $performance_ratio = bcmul($performance_ratio,0.01,2);
             $level = $model->where('award_ratio', '>', 0)->select();
-            $price = bcmul($order['pay_price'], 0.1, 2); //分红金额
+            $price = bcmul($order['pay_price'], $performance_ratio, 2); //分红金额
             $integral_price = app()->make(AwardIntegralPriceRepository::class)->awardIntegralPrice();  //分红积分价格
             foreach ($level as $k => $v) {  //遍历等级
                 $all_performance = 0;  //总业绩

+ 4 - 4
app/common/repositories/user/UserRepository.php

@@ -661,7 +661,7 @@ class UserRepository extends BaseRepository
                 ['label' => '减少', 'value' => 0],
             ])->requiredNum(),
             // 创建数字输入框字段,用于输入修改的金额
-            Elm::number('now_money', '金额')->required()->min(0)->max(999999)
+            Elm::number('now_money', '金额')->required()->min(0)->max(99999999)
         ])->setTitle('修改用户余额');
     }
     /**
@@ -685,7 +685,7 @@ class UserRepository extends BaseRepository
                 ['label' => '减少', 'value' => 0],
             ])->requiredNum(),
             // 创建数字输入框字段,用于输入修改的金额
-            Elm::number('award_integral', '分红积分')->required()->min(0)->max(999999)
+            Elm::number('award_integral', '分红积分')->required()->min(0)->max(99999999)
         ])->setTitle('修改用户分红积分');
     }
     /**
@@ -709,7 +709,7 @@ class UserRepository extends BaseRepository
                 ['label' => '减少', 'value' => 0],
             ])->requiredNum(),
             // 创建数字输入框字段,用于输入修改的金额
-            Elm::number('award_integral', '分红额度')->required()->min(0)->max(999999)
+            Elm::number('award_integral', '分红额度')->required()->min(0)->max(99999999)
         ])->setTitle('修改用户分红额度');
     }
 
@@ -733,7 +733,7 @@ class UserRepository extends BaseRepository
                 ['label' => '减少', 'value' => 0],
             ])->requiredNum(),
             // 创建数字输入框,用于输入当前积分值,要求非空,最小值为0,最大值为999999
-            Elm::number('now_money', '积分')->required()->min(0)->max(999999)
+            Elm::number('now_money', '积分')->required()->min(0)->max(99999999)
         ])->setTitle('修改用户积分');
     }
 

+ 4 - 3
app/controller/admin/system/config/ConfigOthers.php

@@ -66,7 +66,8 @@ class ConfigOthers extends BaseController
             'transfer_scene_id',
             'award_integral_price',
             'extract_commission',
-            'award_energy_saving_oil',
+            'award_ordinary',
+//            'award_energy_saving_oil',
             'award_gift_pack',
             'award_integral_ordinary',
             'award_integral_energy_saving_oil',
@@ -89,8 +90,8 @@ class ConfigOthers extends BaseController
 //            return app('json')->fail('分销绑定时间必须大于0');
         if ($data['promoter_type'] == 3 && (!ctype_digit((string)$data['promoter_low_money']) || $data['promoter_low_money'] <= 0))
             return app('json')->fail('满额分销最低金额必须大于0');
-        if ($data['award_energy_saving_oil'] < 0)
-            return app('json')->fail('节能油商品赠送分红额度消费金额不能小于0');
+        if ($data['award_ordinary'] < 0)
+            return app('json')->fail('节能油和普通商品赠送分红额度消费金额不能小于0');
         if ($data['award_gift_pack'] < 0)
             return app('json')->fail('礼包商品赠送分红额度消费金额不能小于0');
         if ($data['award_integral_ordinary'] < 0)