Просмотр исходного кода

游车房,新增加权及车房合并

kevin_zhangl 3 лет назад
Родитель
Сommit
7aaa1fbfc0

+ 4 - 4
backendApi/config/menu.php

@@ -42,14 +42,14 @@ return [
             // 新添加的商品操作 ---stop
             ['name'=>'商品列表导出', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'goods-list-export', 'routePath'=>'shop/goods-list-export', 'show'=>0,],
             ['name'=>'套餐管理', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'package', 'routePath'=>'shop/package', 'show'=>1,],
-            ['name'=>'报单列表', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'dec-order-list', 'routePath'=>'shop/dec-order-list', 'show'=>1,],
-            ['name'=>'报单列表导出', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'dec-order-list-export', 'routePath'=>'shop/dec-order-list-export', 'show'=>0,],
+//            ['name'=>'报单列表', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'dec-order-list', 'routePath'=>'shop/dec-order-list', 'show'=>1,],
+//            ['name'=>'报单列表导出', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'dec-order-list-export', 'routePath'=>'shop/dec-order-list-export', 'show'=>0,],
             ['name'=>'订单列表', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'order-list', 'routePath'=>'shop/order-list', 'show'=>1,],
             ['name'=>'订单列表导出', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'order-list-export', 'routePath'=>'shop/order-list-export', 'show'=>0,],
             ['name'=>'订单发货', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'order-delivery', 'routePath'=>'shop/order-delivery', 'show'=>0,],
             ['name'=>'外部商城订单列表', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'order-shop-list', 'routePath'=>'shop/order-shop-list', 'show'=>1,],
-            ['name'=>'外部商城报单列表', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'order-dec-list', 'routePath'=>'shop/order-dec-list', 'show'=>1,],
-            ['name'=>'外部商城达标订单列表', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'order-standard-list', 'routePath'=>'shop/order-standard-list', 'show'=>1,],
+//            ['name'=>'外部商城报单列表', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'order-dec-list', 'routePath'=>'shop/order-dec-list', 'show'=>1,],
+//            ['name'=>'外部商城达标订单列表', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'order-standard-list', 'routePath'=>'shop/order-standard-list', 'show'=>1,],
         ]
     ],
     'user'=>[

+ 2 - 3
backendApi/modules/v1/controllers/UserController.php

@@ -885,9 +885,8 @@ class UserController extends BaseController
             $userInfo['CASH'] = Cash::getAvailableBalance($userInfo['ID']);
             $userInfo['RECONSUME_POINTS'] = Balance::getBalanceReconsumePoints($userInfo['ID']);
             $userInfo['EXCHANGE_POINTS'] = Balance::getBalanceExchangePoints($userInfo['ID']);
-            $userInfo['TRAVEL_POINTS'] = Balance::getAccountBalance($userInfo['ID'], 'travel_points');
-            $userInfo['CAR_POINTS'] = Balance::getAccountBalance($userInfo['ID'], 'car_points');
-            $userInfo['HOUSE_POINTS'] = Balance::getAccountBalance($userInfo['ID'], 'house_points');
+            $userInfo['TOURISM_POINTS'] = Balance::getAccountBalance($userInfo['ID'], 'tourism_points');
+            $userInfo['GARAGE_POINTS'] = Balance::getAccountBalance($userInfo['ID'], 'garage_points');
             return static::notice($userInfo);
         }else{
             return static::notice('会员编号不存在', 400);

+ 7 - 22
backendApi/modules/v1/models/lists/bonus/BalanceList.php

@@ -317,46 +317,31 @@ class BalanceList extends \common\libs\dataList\DataList implements DataListInte
 //                    'header' => '历史最高聘级',
 //                    'headerOther' => ['width' => '130'],
 //                ],
-                'TRAVEL_POINTS' => [
+                'TOURISM_POINTS' => [
                     'header' => '旅游积分',
                     'value' => function($row) {
                         return (new Price([
-                            'value' => $row['TRAVEL_POINTS'],
+                            'value' => $row['TOURISM_POINTS'],
                         ]))->result();
                     },
                     'headerOther' => [
                         'width' => '150',
-                        'prop'=>'TRAVEL_POINTS',
+                        'prop'=>'TOURISM_POINTS',
                     ],
                     'valueOther' => [
                         'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],
                     ],
                 ],
-                'CAR_POINTS' => [
-                    'header' => '车积分',
+                'GARAGE_POINTS' => [
+                    'header' => '车积分',
                     'value' => function($row) {
                         return (new Price([
-                            'value' => $row['CAR_POINTS'],
+                            'value' => $row['GARAGE_POINTS'],
                         ]))->result();
                     },
                     'headerOther' => [
                         'width' => '150',
-                        'prop'=>'CAR_POINTS',
-                    ],
-                    'valueOther' => [
-                        'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],
-                    ],
-                ],
-                'HOUSE_POINTS' => [
-                    'header' => '豪宅积分',
-                    'value' => function($row) {
-                        return (new Price([
-                            'value' => $row['HOUSE_POINTS'],
-                        ]))->result();
-                    },
-                    'headerOther' => [
-                        'width' => '150',
-                        'prop'=>'HOUSE_POINTS',
+                        'prop'=>'GARAGE_POINTS',
                     ],
                     'valueOther' => [
                         'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],

+ 5 - 9
common/config/params.php

@@ -209,17 +209,13 @@ return [
 //            'name' => 'lx',
 //            'label' => '领袖分红奖余额',
 //        ],
-        'travel_points' => [
-            'name' => 'travel_points',
+        'tourism_points' => [
+            'name' => 'tourism_points',
             'label' => '旅游积分余额',
         ],
-        'car_points' => [
-            'name' => 'car_points',
-            'label' => '名车积分余额',
-        ],
-        'house_points' => [
-            'name' => 'house_points',
-            'label' => '豪宅积分余额',
+        'garage_points' => [
+            'name' => 'garage_points',
+            'label' => '车房积分余额',
         ],
     ],
     'auditStatus' => [

+ 2 - 1
common/helpers/PayStack.php

@@ -57,8 +57,9 @@ class PayStack
 
     /**
      * 交易退款.
-     * @param string $transaction
+     * @param string $reference
      * @param int $amount
+     * @return array
      */
     public static function transactionRefund(string $reference, int $amount)
     {

+ 190 - 126
common/helpers/bonus/BonusCalc.php

@@ -20,6 +20,7 @@ use common\models\CalcBonusCF;
 use common\models\CalcBonusFL;
 use common\models\CalcBonusFW;
 use common\models\CalcBonusFX;
+use common\models\CalcBonusGarage;
 use common\models\CalcBonusGL;
 use common\models\CalcBonusGX;
 use common\models\CalcBonusHB;
@@ -28,11 +29,11 @@ use common\models\CalcBonusLX;
 use common\models\CalcBonusQY;
 use common\models\CalcBonusStandard;
 use common\models\CalcBonusTG;
+use common\models\CalcBonusTourism;
 use common\models\CalcBonusVIP;
 use common\models\CalcBonusXF;
 use common\models\CalcBonusYC;
 use common\models\CalcBonusYJ;
-use common\models\CalcBonusZone;
 use common\models\CalcMonthBonusUser;
 use common\models\Config;
 use common\models\FlowDeductZR;
@@ -182,15 +183,17 @@ class BonusCalc extends BaseObject {
             $this->_updatePercent(5);
             $t3 = microtime(true);
             $this->_updatePercent(10);
-            // 奖金部分
-            if($this->_sysConfig['openFW']['VALUE']) {
-                $this->calcBonusBDStepOne();
-                $this->calcBonusBDStepTwo();
-            }
+
+//            // 奖金部分
+//            if($this->_sysConfig['openFW']['VALUE']) {
+//                $this->calcBonusBDStepOne();
+//                $this->calcBonusBDStepTwo();
+//            }
             $t4 = microtime(true);
-            echo('计算服务奖'.($this->_sysConfig['openFW']['VALUE']?'完成':'关闭').',耗时:' . round($t4 - $t3, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(15);
+//            echo('计算服务奖'.($this->_sysConfig['openFW']['VALUE']?'完成':'关闭').',耗时:' . round($t4 - $t3, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+//            $this->_updatePercent(15);
 
+            // 销售奖/推广奖
             if($this->_sysConfig['openTG']['VALUE']) {
                 $this->calcBonusTG();
             }
@@ -198,117 +201,115 @@ class BonusCalc extends BaseObject {
             echo('计算推广奖'.($this->_sysConfig['openTG']['VALUE']?'完成':'关闭').',耗时:' . round($t5 - $t4, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
             $this->_updatePercent(20);
 
-            if($this->_sysConfig['openXF']['VALUE']) {
-                if( $this->_sysConfig['consumeRecPercent']['VALUE'] > 0 ) {
-                    $this->calcBonusXFToRec();
-                }
-                if( $this->_sysConfig['consumeSelfPercent']['VALUE'] > 0 ) {
-                    $this->calcBonusXFToSelf();
-                }
-            }
-            $t6 = microtime(true);
-            echo('计算消费奖'.($this->_sysConfig['openXF']['VALUE']?'完成':'关闭').',耗时:' . round($t6 - $t5, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(25);
-
-            if($this->_sysConfig['openYJ']['VALUE']) {
-                $this->calcBonusBdYJ();
-            }
-            $t7 = microtime(true);
-            echo('计算报单业绩奖'.($this->_sysConfig['openYJ']['VALUE']?'完成':'关闭').',耗时:' . round($t7 - $t6, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(30);
-
-            if($this->_sysConfig['fxOpenYJ']['VALUE']) {
-                $this->calcBonusFxYJ();
-            }
+//            if($this->_sysConfig['openXF']['VALUE']) {
+//                if( $this->_sysConfig['consumeRecPercent']['VALUE'] > 0 ) {
+//                    $this->calcBonusXFToRec();
+//                }
+//                if( $this->_sysConfig['consumeSelfPercent']['VALUE'] > 0 ) {
+//                    $this->calcBonusXFToSelf();
+//                }
+//            }
+//            $t6 = microtime(true);
+//            echo('计算消费奖'.($this->_sysConfig['openXF']['VALUE']?'完成':'关闭').',耗时:' . round($t6 - $t5, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+//            $this->_updatePercent(25);
+//
+//            if($this->_sysConfig['openYJ']['VALUE']) {
+//                $this->calcBonusBdYJ();
+//            }
+//            $t7 = microtime(true);
+//            echo('计算报单业绩奖'.($this->_sysConfig['openYJ']['VALUE']?'完成':'关闭').',耗时:' . round($t7 - $t6, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+//            $this->_updatePercent(30);
+//
+//            if($this->_sysConfig['fxOpenYJ']['VALUE']) {
+//                $this->calcBonusFxYJ();
+//            }
             $t8 = microtime(true);
-            echo('计算复消业绩奖'.($this->_sysConfig['fxOpenYJ']['VALUE']?'完成':'关闭').',耗时:' . round($t8 - $t7, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(35);
-
+//            echo('计算复消业绩奖'.($this->_sysConfig['fxOpenYJ']['VALUE']?'完成':'关闭').',耗时:' . round($t8 - $t7, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+//            $this->_updatePercent(35);
 
+            // 绩效奖/团队奖
             if($this->_sysConfig['openQY']['VALUE']) {
                 $this->calcBonusQY();
-                $this->calcBonusBdQY();
-                $this->calcBonusFxQY();
+//                $this->calcBonusBdQY();
+//                $this->calcBonusFxQY();
             }
             $t9 = microtime(true);
             echo('计算团队奖'.($this->_sysConfig['openQY']['VALUE']?'完成':'关闭').',耗时:' . round($t9 - $t8, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
             $this->_updatePercent(65);
 
-            if($this->_sysConfig['openGX']['VALUE']) {
-                $this->calcBonusGXBefore();
-                $this->calcBonusGX();
-            }
-            $t11 = microtime(true);
-            echo('计算共享奖'.($this->_sysConfig['openGX']['VALUE']?'完成':'关闭').',耗时:' . round($t11 - $t9, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(68);
-
-            if($this->_sysConfig['openGL']['VALUE']) {
-                $this->calcBonusBdGL();
-            }
-            $t13 = microtime(true);
-            echo('计算报单管理奖'.($this->_sysConfig['openGL']['VALUE']?'完成':'关闭').',耗时:' . round($t13 - $t11, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(50);
-
+//            if($this->_sysConfig['openGX']['VALUE']) {
+//                $this->calcBonusGXBefore();
+//                $this->calcBonusGX();
+//            }
+//            $t11 = microtime(true);
+//            echo('计算共享奖'.($this->_sysConfig['openGX']['VALUE']?'完成':'关闭').',耗时:' . round($t11 - $t9, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+//            $this->_updatePercent(68);
+//
+//            if($this->_sysConfig['openGL']['VALUE']) {
+//                $this->calcBonusBdGL();
+//            }
+//            $t13 = microtime(true);
+//            echo('计算报单管理奖'.($this->_sysConfig['openGL']['VALUE']?'完成':'关闭').',耗时:' . round($t13 - $t11, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+//            $this->_updatePercent(50);
+//
 //            if($this->_sysConfig['fxOpenGL']['VALUE']) {
 //                $this->calcBonusFxGL();
 //            }
 //            $t14 = microtime(true);
 //            echo('计算复消管理奖'.($this->_sysConfig['fxOpenGL']['VALUE']?'完成':'关闭').',耗时:' . round($t14 - $t13, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
 //            $this->_updatePercent(70);
+//
+//            if($this->_sysConfig['openYC']['VALUE']) {
+//                $this->calcBonusYCStepOne();
+//                $this->calcBonusYCStepTwo();
+//            }
+//            $t16 = microtime(true);
+//            echo('计算荣衔奖'.($this->_sysConfig['openYC']['VALUE']?'完成':'关闭').',耗时:' . round($t16 - $t13, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+//            $this->_updatePercent(55);
+//
+//            if($this->_sysConfig['openVIP']['VALUE']) {
+//                $this->calcBonusVIP();
+//            }
+//            $t17 = microtime(true);
+//            echo('计算VIP奖'.($this->_sysConfig['openVIP']['VALUE']?'完成':'关闭').',耗时:' . round($t17 - $t16, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+//            $this->_updatePercent(60);
+//
+//            if($this->_sysConfig['openJXS']['VALUE']) {
+//                $this->calcBonusStandard();
+//            }
+//            $t18 = microtime(true);
+//            echo('计算达标奖'.($this->_sysConfig['openJXS']['VALUE']?'完成':'关闭').',耗时:' . round($t18 - $t17, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+//            $this->_updatePercent(65);
 
-            if($this->_sysConfig['openYC']['VALUE']) {
-                $this->calcBonusYCStepOne();
-                $this->calcBonusYCStepTwo();
-            }
-            $t16 = microtime(true);
-            echo('计算荣衔奖'.($this->_sysConfig['openYC']['VALUE']?'完成':'关闭').',耗时:' . round($t16 - $t13, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(55);
-
-            if($this->_sysConfig['openVIP']['VALUE']) {
-                $this->calcBonusVIP();
-            }
-            $t17 = microtime(true);
-            echo('计算VIP奖'.($this->_sysConfig['openVIP']['VALUE']?'完成':'关闭').',耗时:' . round($t17 - $t16, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(60);
-
-            if($this->_sysConfig['openJXS']['VALUE']) {
-                $this->calcBonusStandard();
-            }
-            $t18 = microtime(true);
-            echo('计算达标奖'.($this->_sysConfig['openJXS']['VALUE']?'完成':'关闭').',耗时:' . round($t18 - $t17, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(65);
-
+            $t19 = microtime(true);
             // 蓝星奖入库,实际上是插入有奖金会员数据缓存中.
+            echo('计算蓝星奖开始,' . date('Y-m-d H:i:s', $t19) . PHP_EOL);
             // 调用存储过程,计算蓝星管理奖金
             $this->calcBsProcedure();
             // 将有【蓝星业绩奖金】的用户加入到有奖金缓存用户中
             $this->calcBonusBsYJ();
             // 将有【蓝星管理奖金】的用户加入到有奖金缓存用户中
             $this->calcBonusBsGL();
-            $t18temp = microtime(true);
-            echo('计算蓝星奖'.($this->_sysConfig['openGL']['VALUE']?'完成':'关闭').',耗时:' . round($t18temp - $t18, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(65);
-
-            $this->calcBonusZoneBS($this->_sysConfig['openTravel']);
-            $t18travel = microtime(true);
-            echo('计算旅游奖' . ($this->_sysConfig['openTravel']['VALUE'] ? '完成' : '关闭') . ',耗时:' . round($t18travel - $t18temp, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+            $t20 = microtime(true);
+            echo('计算蓝星奖'.($this->_sysConfig['openGL']['VALUE']?'完成':'关闭').',耗时:' . round($t20 - $t19, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
             $this->_updatePercent(67);
 
-            $this->calcBonusZoneBS($this->_sysConfig['openCar']);
-            $t18car = microtime(true);
-            echo('计算名车奖' . ($this->_sysConfig['openCar']['VALUE'] ? '完成' : '关闭').',耗时:' . round($t18car - $t18travel, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+            $this->calcBonusTourism($this->_sysConfig['openTourism']);
+            $t21 = microtime(true);
+            echo('计算旅游奖' . ($this->_sysConfig['openTourism']['VALUE'] ? '完成' : '关闭') . ',耗时:' . round($t21 - $t20, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
             $this->_updatePercent(68);
 
-            $this->calcBonusZoneBS($this->_sysConfig['openHouse']);
-            $t18house = microtime(true);
-            echo('计算豪宅奖' . ($this->_sysConfig['openHouse']['VALUE'] ? '完成' : '关闭').',耗时:' . round($t18house - $t18car, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+            $this->calcBonusGarage($this->_sysConfig['openGarage']);
+            $t22 = microtime(true);
+            echo('计算车房奖' . ($this->_sysConfig['openGarage']['VALUE'] ? '完成' : '关闭').',耗时:' . round($t22 - $t21, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
             $this->_updatePercent(69);
 
 
+
             //把奖金会员写入缓存
             $this->loopMonthBonusUserFromDbToCache();
-            $t19 = microtime(true);
-            echo('奖金会员写入缓存完成,耗时:' . round($t19 - $t18, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+            $t30 = microtime(true);
+            echo('奖金会员写入缓存完成,耗时:' . round($t30 - $t22, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
             $this->_updatePercent(70);
 
             //奖金写库
@@ -318,31 +319,29 @@ class BonusCalc extends BaseObject {
             $this->loopCalcBlueEmpLv();
             $this->_updatePercent(75);
             unset($calcWrite);
-            $t20 = microtime(true);
-            echo('奖金写库操作完成,耗时:' . round($t20 - $t19, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+            $t31 = microtime(true);
+            echo('奖金写库操作完成,耗时:' . round($t31 - $t30, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
 
             //把本期奖金会员入库 - 把缓存中的月奖用户信息存到数据库.存储过程的入库不在这里进行,这里代码取的缓存,存储过程没有缓存,在上面进行入库
             $this->loopMonthBonusUserToDb();
-            $t21 = microtime(true);
-            echo('奖金会员入库完成,耗时:' . round($t21 - $t20, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+            $t32 = microtime(true);
+            echo('奖金会员入库完成,耗时:' . round($t32 - $t31, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
             $this->_updatePercent(80);
 
             // 计算基础积分,不可以奖金入库之前计算这样可能会丢掉只有本期的奖金的会员
             $this->calcBaseScore();
             $this->_updatePercent(90);
-            $t22 = microtime(true);
-            echo('计算基础积分,耗时:' . round($t22 - $t21, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+            $t33 = microtime(true);
+            echo('计算基础积分,耗时:' . round($t33 - $t32, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
 
             //积分入库
             $this->loopWriteScore();
             $this->_updatePercent(100);
-            $t23 = microtime(true);
-            echo('积分写库操作完成,耗时:' . round($t23 - $t22, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-
-            //@todo 计算房产奖
+            $t34 = microtime(true);
+            echo('积分写库操作完成,耗时:' . round($t34 - $t33, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
 
-            $t30 = microtime(true);
-            echo('结算全部完成,共耗时:' . round($t30 - $t1, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+            $t35 = microtime(true);
+            echo('结算全部完成,共耗时:' . round($t35 - $t34, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
         } catch (\Exception $e) {
             $this->errorCalcTask();
             $this->addError('calc', $e->getMessage());
@@ -444,7 +443,8 @@ class BonusCalc extends BaseObject {
             CalcBonusVIP::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
             CalcBonusStandard::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
             ScoreMonth::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
-            CalcBonusZone::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
+            CalcBonusTourism::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
+            CalcBonusGarage::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
         }
     }
 
@@ -1632,8 +1632,8 @@ class BonusCalc extends BaseObject {
         return $result;
     }
 
-    // 执行旅游奖、名车奖、豪宅奖的计算
-    public function calcBonusZoneBS(array $bonusConfig) {
+    // 执行旅游奖的计算
+    public function calcBonusTourism(array $bonusConfig) {
         // 月结,如果不是月结点,则直接退出
         if (!$this->_isCalcMonth) {
             return true;
@@ -1662,38 +1662,105 @@ class BonusCalc extends BaseObject {
         $userBonusData = CalcBonusBS::find()
             ->yearMonth($this->_calcYearMonth)
             ->where('CALC_MONTH=:CALC_MONTH', [':CALC_MONTH' => $this->_calcYearMonth])
-            ->select('USER_ID,LEVEL_ID,LAST_DEC_LV,LAST_EMP_LV,LAST_STATUS,RECONSUME_POINTS')
+            ->select('USER_ID,LEVEL_ID,LAST_DEC_LV,LAST_EMP_LV,LAST_STATUS')
             ->groupBy('USER_ID')
             ->asArray()
             ->all();
 
-        // 获奖会员数
-        $userBonusNumber = count($userBonusData);
-        if (!$userBonusNumber) {
-            return true;
+        $insertBonusData = [];
+        foreach($userBonusData as $userBonus) {
+            // TODO:基于绩效奖,获取会员starCrown级别,计算奖金
+            $startCrownPoint = (mt_rand(10, 75) / 10) / 100;
+            $amount = Tool::formatPrice(($monthTotalPV * $mate) * $startCrownPoint);
+            if ($amount <= 0) {
+                continue;
+            }
+
+            // 会员级别+聘级都达到要求才会发放奖金
+            if (in_array($userBonus['LAST_DEC_LV'], $minDecLevel) && in_array($userBonus['LEVEL_ID'], $minEmpLevel)) {
+                // 放入缓存
+                CalcCache::tourismBonus($userBonus['USER_ID'], $this->_periodNum, $amount);
+                // 加入月奖的会员
+                CalcCache::addHasMonthBonusUsers($userBonus['USER_ID'], $this->_periodNum);
+            }
+
+            $insertBonusData[] = [
+                'ID' => SnowFake::instance()->generateId(),
+                'USER_ID' => $userBonus['USER_ID'],
+                'LEVEL_ID' => $userBonus['LEVEL_ID'],
+                'LAST_DEC_LV' => $userBonus['LAST_DEC_LV'],
+                'LAST_EMP_LV' => $userBonus['LAST_EMP_LV'],
+                'LAST_STATUS' => $userBonus['LAST_STATUS'],
+                'AMOUNT' => $amount,
+                'PERIOD_NUM' => $this->_periodNum,
+                'CALC_YEAR' => $this->_calcYear,
+                'CALC_MONTH' => $this->_calcYearMonth,
+                'P_CALC_MONTH' => Date::ociToDate($this->_calcYearMonth, Date::OCI_TIME_FORMAT_SHORT_MONTH),
+                'CREATED_AT' => Date::nowTime(),
+            ];
         }
 
-        // 计算奖金:(公司月总PV * 奖金比) / 得奖人数
-        $amount = Tool::formatPrice(($monthTotalPV  * $mate) / $userBonusNumber);
-        if ($amount <= 0) {
+        // 数据写入总表
+        if ($insertBonusData) {
+            CalcBonusTourism::batchInsert($insertBonusData);
+        }
+
+        return true;
+    }
+
+    // 执行车房奖的计算
+    public function calcBonusGarage($bonusConfig) {
+        // 月结,如果不是月结点,则直接退出
+        if (!$this->_isCalcMonth) {
             return true;
         }
 
-        // 奖金标识
-        if ($bonusConfig['CONFIG_NAME'] == 'openTravel') {
-            $bonusCacheKey = 'calc:travel:bonus_';
-        } else if ($bonusConfig['CONFIG_NAME'] == 'openCar') {
-            $bonusCacheKey = 'calc:car:bonus_';
-        } else {
-            $bonusCacheKey = 'calc:house:bonus_';
+        // 达标条件:聘级、级别、奖项比例
+        $config = json_decode($bonusConfig['OPTIONS'], true);
+        // 奖金总比例
+        $mate = $bonusConfig['VALUE'] / 100;
+        // 会员级别
+        $minDecLevel = $config['OPTIONS']['declarationLevel'] ?? [];
+        // 会员聘级
+        $minEmpLevel = $config['OPTIONS']['employLevel'] ?? [];
+        // 个人奖金封顶
+        $capBonus = intval($this->_sysConfig['openGarageCap']['VALUE'] ?? 0);
+
+        // 月度公司总PV
+        $monthTotalPV = PerfMonth::find()
+            ->yearMonth($this->_calcYearMonth)
+            ->where('CALC_MONTH=:CALC_MONTH', [':CALC_MONTH' => $this->_calcYearMonth])
+            ->sum('PV_PCS');
+
+        if ($monthTotalPV <= 0) {
+            return true;
         }
 
+        // 基于蓝星奖结果计算符合获奖条件的会员
+        $userBonusData = CalcBonusBS::find()
+            ->yearMonth($this->_calcYearMonth)
+            ->where('CALC_MONTH=:CALC_MONTH', [':CALC_MONTH' => $this->_calcYearMonth])
+            ->select('USER_ID,LEVEL_ID,LAST_DEC_LV,LAST_EMP_LV,LAST_STATUS,RECONSUME_POINTS')
+            ->groupBy('USER_ID')
+            ->asArray()
+            ->all();
+
         $insertBonusData = [];
         foreach($userBonusData as $userBonus) {
+            // TODO:基于绩效奖,获取会员starCrown级别,计算奖金
+            $startCrownPoint = mt_rand(1, 10) / 100;
+            $amount = Tool::formatPrice(($monthTotalPV * $mate) * $startCrownPoint);
+            if ($amount <= 0) {
+                continue;
+            }
+
+            // 奖金数不能大于封顶值
+            $amount = ($amount > $capBonus) ? $capBonus : $amount;
+
             // 会员级别+聘级都达到要求才会发放奖金
             if (in_array($userBonus['LAST_DEC_LV'], $minDecLevel) && in_array($userBonus['LEVEL_ID'], $minEmpLevel)) {
                 // 放入缓存
-                CalcCache::zoneBonus($userBonus['USER_ID'], $this->_periodNum, $bonusCacheKey, $amount);
+                CalcCache::garageBonus($userBonus['USER_ID'], $this->_periodNum, $amount);
                 // 加入月奖的会员
                 CalcCache::addHasMonthBonusUsers($userBonus['USER_ID'], $this->_periodNum);
             }
@@ -1711,13 +1778,12 @@ class BonusCalc extends BaseObject {
                 'CALC_MONTH' => $this->_calcYearMonth,
                 'P_CALC_MONTH' => Date::ociToDate($this->_calcYearMonth, Date::OCI_TIME_FORMAT_SHORT_MONTH),
                 'CREATED_AT' => Date::nowTime(),
-                'BONUS_TYPE' => $bonusConfig['CONFIG_NAME'],
             ];
         }
 
         // 数据写入总表
         if ($insertBonusData) {
-            CalcBonusZone::batchInsert($insertBonusData);
+            CalcBonusGarage::batchInsert($insertBonusData);
         }
 
         return true;
@@ -3378,9 +3444,8 @@ class BonusCalc extends BaseObject {
         $standardBonus = CalcCache::standardBonus($userId, $this->_periodNum);
         $baseInfo = CalcCache::getUserInfo($userId, $this->_periodNum);
         $perfData = CalcCache::nowPeriodPerf($userId, $this->_periodNum);
-        $travelBonus = CalcCache::zoneBonus($userId, $this->_periodNum, CalcCache::REDIS_KEY_PREFIX_TRAVEL_BONUS);
-        $carBonus = CalcCache::zoneBonus($userId, $this->_periodNum, CalcCache::REDIS_KEY_PREFIX_CAR_BONUS);
-        $houseBonus = CalcCache::zoneBonus($userId, $this->_periodNum, CalcCache::REDIS_KEY_PREFIX_HOUSE_BONUS);
+        $tourismBonus = CalcCache::tourismBonus($userId, $this->_periodNum);
+        $garageBonus = CalcCache::garageBonus($userId, $this->_periodNum);
         $empLv = $baseInfo['EMP_LV'];
 //        if($this->_isCalcMonth){
 //            $empLv = $this->nowMonthPerfData($userId)['LAST_EMP_LV'];
@@ -3561,9 +3626,8 @@ class BonusCalc extends BaseObject {
             'ORI_BONUS_VIP' => $bonus['ORI_BONUS_VIP'],
             'ORI_BONUS_STANDARD' => $standardBonus,
 
-            'BONUS_TRAVEL' => $travelBonus, // 旅游奖
-            'BONUS_CAR' => $carBonus, // 名车奖
-            'BONUS_HOUSE' => $houseBonus, // 豪宅奖
+            'BONUS_TOURISM' => $tourismBonus, // 旅游奖
+            'BONUS_GARAGE' => $garageBonus, // 车房奖
 
             //以下没有用
             'BONUS_FW' => 0,

+ 9 - 21
common/helpers/bonus/BonusSend.php

@@ -348,37 +348,25 @@ class BonusSend extends BaseObject {
                     }
 
                     // 旅游奖
-                    if ($data['BONUS_TRAVEL'] > 0) {
-                        Balance::changeUserBonus($data['USER_ID'], 'travel_points', $data['BONUS_TRAVEL'], [
+                    if ($data['BONUS_TOURISM'] > 0) {
+                        Balance::changeUserBonus($data['USER_ID'], 'tourism_points', $data['BONUS_TOURISM'], [
                             'CALC_ID' => $data['ID'],
                             'REMARK' => 'From ' . $periodNum . '期',
                             'PERIOD_NUM' => $periodNum,
-                            'TRAVEL' => $data['BONUS_TRAVEL'],
-                            'DEAL_TYPE_ID' => DealType::TRAVEL_SEND,
+                            'TRAVEL' => $data['BONUS_TOURISM'],
+                            'DEAL_TYPE_ID' => DealType::TOURISM_SEND,
                             'SORT' => $key * 10,
                             'BONUS_ISSUE' => true,
                         ]);
                     }
-                    // 车奖
-                    if ($data['BONUS_CAR'] > 0) {
-                        Balance::changeUserBonus($data['USER_ID'], 'car_points', $data['BONUS_CAR'], [
+                    // 车
+                    if ($data['BONUS_GARAGE'] > 0) {
+                        Balance::changeUserBonus($data['USER_ID'], 'garage_points', $data['BONUS_GARAGE'], [
                             'CALC_ID' => $data['ID'],
                             'REMARK' => 'From ' . $periodNum . '期',
                             'PERIOD_NUM' => $periodNum,
-                            'HOUSE' => $data['BONUS_CAR'],
-                            'DEAL_TYPE_ID' => DealType::CAR_SEND,
-                            'SORT' => $key * 10,
-                            'BONUS_ISSUE' => true,
-                        ]);
-                    }
-                    // 豪宅奖
-                    if ($data['BONUS_HOUSE'] > 0) {
-                        Balance::changeUserBonus($data['USER_ID'], 'house_points', $data['BONUS_HOUSE'], [
-                            'CALC_ID' => $data['ID'],
-                            'REMARK' => 'From ' . $periodNum . '期',
-                            'PERIOD_NUM' => $periodNum,
-                            'HOUSE' => $data['BONUS_HOUSE'],
-                            'DEAL_TYPE_ID' => DealType::HOUSE_SEND,
+                            'HOUSE' => $data['BONUS_GARAGE'],
+                            'DEAL_TYPE_ID' => DealType::GARAGE_SEND,
                             'SORT' => $key * 10,
                             'BONUS_ISSUE' => true,
                         ]);

+ 25 - 5
common/helpers/bonus/CalcCache.php

@@ -49,9 +49,8 @@ class CalcCache {
     const REDIS_KEY_PREFIX_STANDARD_BONUS = 'calc:standard:bonus_';
     const REDIS_KEY_PREFIX_YC_BONUS = 'calc:yc:bonus_';
     const REDIS_KEY_PREFIX_FW_BONUS = 'calc:fw:bonus_';
-    const REDIS_KEY_PREFIX_TRAVEL_BONUS = 'calc:travel:bonus_';
-    const REDIS_KEY_PREFIX_CAR_BONUS = 'calc:car:bonus_';
-    const REDIS_KEY_PREFIX_HOUSE_BONUS = 'calc:house:bonus_';
+    const REDIS_KEY_PREFIX_TOURISM_BONUS = 'calc:tourism:bonus_';
+    const REDIS_KEY_PREFIX_GARAGE_BONUS = 'calc:garage:bonus_';
     const REDIS_KEY_PREFIX_HAS_PERF_USER = 'calc:hasPerfUser_';
     const REDIS_KEY_PREFIX_HAS_MONTH_PERF_USER = 'calc:hasMonthPerfUser_';
     const REDIS_KEY_PREFIX_HAS_STANDARD_MONTH_PERF_USER = 'calc:hasStandardMonthPerfUser_';
@@ -1543,8 +1542,29 @@ class CalcCache {
         return $value;
     }
 
-    public static function zoneBonus($userId, $periodNum, $bonusCacheKey, $bonus = 0.00) {
-        $cacheKey = $bonusCacheKey . $periodNum;
+    public static function tourismBonus($userId, $periodNum, $bonus = 0.00) {
+        $cacheKey = self::REDIS_KEY_PREFIX_TOURISM_BONUS . $periodNum;
+
+        $value = 0.00;
+        if( $bonus > 0 ) {
+            Yii::$app->redis->hset($cacheKey, $userId, $bonus);
+            $value = $bonus;
+            //加入有奖金的会员中
+            self::addHasBonusUsers($userId, $periodNum);
+        }else {
+            $cacheValue = \Yii::$app->redis->hget($cacheKey, $userId);
+            if ($cacheValue) {
+                $value = $cacheValue;
+            }
+            unset($cacheValue);
+        }
+
+        unset($cacheKey, $userId, $periodNum, $bonus);
+        return $value;
+    }
+
+    public static function garageBonus($userId, $periodNum, $bonus = 0.00) {
+        $cacheKey = self::REDIS_KEY_PREFIX_GARAGE_BONUS . $periodNum;
 
         $value = 0.00;
         if( $bonus > 0 ) {

+ 1 - 0
common/helpers/bonus/PerfCalc.php

@@ -131,6 +131,7 @@ class PerfCalc {
             echo('初始化、清空缓存及相关数据表完成,耗时:' . round($t2 - $t1, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
             $this->_updatePercent(10);
             // 计算月奖,才需要向缓存中加入按推荐深度的所有用户
+            echo('向缓存中加入用户开始 ' . date('Y-m-d  H:i:s', time()) . PHP_EOL);
             //修改每一期都缓存所有用户
             CalcCache::addUsers($this->_periodNum);
             $t3 = microtime(true);

+ 52 - 47
common/helpers/user/Balance.php

@@ -15,9 +15,10 @@ use common\helpers\Form;
 use common\libs\lock\RedisLock;
 use common\models\FlowBonus;
 use common\models\FlowCF;
+use common\models\FlowGaragePoints;
 use common\models\FlowLX;
 use common\models\FlowReconsumePoints;
-use common\models\FlowZonePoints;
+use common\models\FlowTourismPoints;
 use common\models\InvoiceFlow;
 use common\models\Period;
 use common\models\DeclarationLevel;
@@ -43,9 +44,8 @@ class Balance {
     const CF_BALANCE_LOCK_KEY = 'CF';
     const LX_BALANCE_LOCK_KEY = 'LX';
     const INVOICE_BALANCE_LOCK_KEY = 'Invoice';
-    const TRAVEL_POINTS_BALANCE_LOCK_KEY = 'travelPoints';
-    const CAR_POINTS_BALANCE_LOCK_KEY = 'carPoints';
-    const HOUSE_POINTS_BALANCE_LOCK_KEY = 'housePoints';
+    const TOURISM_POINTS_BALANCE_LOCK_KEY = 'tourismPoints';
+    const GARAGE_POINTS_BALANCE_LOCK_KEY = 'garagePoints';
 
     const BALANCE_TYPE = [
         'exchange' => [
@@ -54,22 +54,16 @@ class Balance {
             'attr'  => 'EXCHANGE_POINTS',
             'pv'    => false,
         ],
-        'travel_points' => [
-            'id'    => 'travel_points',
+        'tourism_points' => [
+            'id'    => 'tourism_points',
             'title' => '旅游积分',
-            'attr'  => 'TRAVEL_POINTS',
+            'attr'  => 'TOURISM_POINTS',
             'pv'    => false,
         ],
-        'car_points' => [
-            'id'    => 'car_points',
-            'title' => '名车积分',
-            'attr'  => 'CAR_POINTS',
-            'pv'    => false,
-        ],
-        'house_points' => [
-            'id'    => 'house_points',
-            'title' => '豪宅积分',
-            'attr'  => 'HOUSE_POINTS',
+        'garage_points' => [
+            'id'    => 'garage_points',
+            'title' => '车房积分',
+            'attr'  => 'GARAGE_POINTS',
             'pv'    => false,
         ],
     ];
@@ -213,6 +207,26 @@ class Balance {
         }
     }
 
+    /**
+     * 获取当前旅游积分余额
+     * @param $userId
+     * @return int|mixed
+     */
+    public static function getBalanceTourism($userId) {
+        $oneData = UserBonus::find()->where('USER_ID=:USER_ID', [':USER_ID' => $userId])->asArray()->one();
+        return $oneData['TOURISM_POINTS'] ?? 0;
+    }
+
+    /**
+     * 获取当前车房余额
+     * @param $userId
+     * @return int|mixed
+     */
+    public static function getBalanceGarage($userId) {
+        $oneData = UserBonus::find()->where('USER_ID=:USER_ID', [':USER_ID' => $userId])->asArray()->one();
+        return $oneData['GARAGE_POINTS'] ?? 0;
+    }
+
     /**
      * 查询会员账户余额.
      * @param $userId
@@ -266,14 +280,11 @@ class Balance {
             case 'LX':
                 $lockKey = self::LX_BALANCE_LOCK_KEY . $userId;
                 break;
-            case 'TRAVEL_POINTS':
-                $lockKey = self::TRAVEL_POINTS_BALANCE_LOCK_KEY . $userId;
+            case 'TOURISM_POINTS':
+                $lockKey = self::TOURISM_POINTS_BALANCE_LOCK_KEY . $userId;
                 break;
-            case 'CAR_POINTS':
-                $lockKey = self::CAR_POINTS_BALANCE_LOCK_KEY . $userId;
-                break;
-            case 'HOUSE_POINTS':
-                $lockKey = self::HOUSE_POINTS_BALANCE_LOCK_KEY . $userId;
+            case 'GARAGE_POINTS':
+                $lockKey = self::GARAGE_POINTS_BALANCE_LOCK_KEY . $userId;
                 break;
             default:
                 throw new Exception('流水类型错误');
@@ -336,14 +347,11 @@ class Balance {
                 if (isset($params['BS_ABBR'])) {
                     $paramData['BS_ABBR_TOTAL'] = new Expression('BS_ABBR_TOTAL + ' . ($issueBonus ? $params['BS_ABBR'] * $exchangeRate : $params['BS_ABBR']));
                 }
-                if (isset($params['TRAVEL_POINTS'])) {
-                    $paramData['TRAVEL_POINTS_TOTAL'] = new Expression('TRAVEL_POINTS_TOTAL + ' . ($issueBonus ? $params['TRAVEL_POINTS'] * $exchangeRate : $params['TRAVEL_POINTS']));
-                }
-                if (isset($params['CAR_POINTS'])) {
-                    $paramData['CAR_POINTS_TOTAL'] = new Expression('CAR_POINTS_TOTAL + ' . ($issueBonus ? $params['CAR_POINTS'] * $exchangeRate : $params['CAR_POINTS']));
+                if (isset($params['TOURISM_POINTS'])) {
+                    $paramData['TOURISM_POINTS_TOTAL'] = new Expression('TOURISM_POINTS_TOTAL + ' . $params['TOURISM_POINTS']);
                 }
-                if (isset($params['HOUSE_POINTS'])) {
-                    $paramData['HOUSE_POINTS_TOTAL'] = new Expression('HOUSE_POINTS_TOTAL + ' . ($issueBonus ? $params['HOUSE_POINTS'] * $exchangeRate : $params['HOUSE_POINTS']));
+                if (isset($params['GARAGE_POINTS'])) {
+                    $paramData['GARAGE_POINTS_TOTAL'] = new Expression('GARAGE_POINTS_TOTAL + '.$params['GARAGE_POINTS']);
                 }
                 if (isset($params['RECONSUME_POINTS_TOTAL'])) {
                     $paramData['RECONSUME_POINTS_TOTAL'] = new Expression('RECONSUME_POINTS_TOTAL + ' . ($issueBonus ? $params['RECONSUME_POINTS_TOTAL'] * $exchangeRate : $params['RECONSUME_POINTS_TOTAL']));
@@ -464,16 +472,12 @@ class Balance {
                 if (isset($params['BS_ABBR'])) {
                     $paramData['BS_ABBR_TOTAL'] = ($issueBonus ? $params['BS_ABBR'] * $exchangeRate : $params['BS_ABBR']);
                 }
-                if (isset($params['TRAVEL_POINTS'])) {
-                    $paramData['TRAVEL_POINTS_TOTAL'] = ($issueBonus ? $params['TRAVEL_POINTS'] * $exchangeRate : $params['TRAVEL_POINTS']);
-                }
-                if (isset($params['CAR_POINTS'])) {
-                    $paramData['CAR_POINTS_TOTAL'] = ($issueBonus ? $params['CAR_POINTS'] * $exchangeRate : $params['CAR_POINTS']);
+                if (isset($params['TOURISM_POINTS'])) {
+                    $paramData['TOURISM_POINTS_TOTAL'] = $params['TOURISM_POINTS'];
                 }
-                if (isset($params['HOUSE_POINTS'])) {
-                    $paramData['HOUSE_POINTS_TOTAL'] = ($issueBonus ? $params['HOUSE_POINTS'] * $exchangeRate : $params['HOUSE_POINTS']);
+                if (isset($params['GARAGE_POINTS'])) {
+                    $paramData['GARAGE_POINTS_TOTAL'] = $params['GARAGE_POINTS'];
                 }
-
                 if (isset($params['RECONSUME_POINTS_TOTAL'])) {
 //                    $paramData['RECONSUME_POINTS_TOTAL'] = new Expression('RECONSUME_POINTS_TOTAL + '.$params['RECONSUME_POINTS_TOTAL']);
                     $paramData['RECONSUME_POINTS_TOTAL'] = ($issueBonus ? $params['RECONSUME_POINTS_TOTAL'] * $exchangeRate : $params['RECONSUME_POINTS_TOTAL']);
@@ -594,15 +598,16 @@ class Balance {
                     self::deductPeriodExchangePoints($userId, abs($amount));
                 }
                 FlowExchangePoints::insertOne($flowInsertData);
-//            } elseif (strtolower($type) == 'cf') {
-//                FlowCF::insertOne($flowInsertData);
-//            } elseif (strtolower($type) == 'lx') {
-//                FlowLX::insertOne($flowInsertData);
-            } elseif (in_array(strtolower($type), ['travel_points', 'car_points', 'house_points'])) {
-                // 这3个奖流水在一个表,需要加二级标识码
-                $flowInsertData['WALLET_TYPE'] = strtolower($type);
-                FlowZonePoints::insertOne($flowInsertData);
+            } elseif (strtolower($type) == 'cf') {
+                FlowCF::insertOne($flowInsertData);
+            } elseif (strtolower($type) == 'lx') {
+                FlowLX::insertOne($flowInsertData);
+            } elseif (strtolower($type) == 'tourism_points') {
+                FlowTourismPoints::insertOne($flowInsertData);
+            } elseif (strtolower($type) == 'garage_points') {
+                FlowGaragePoints::insertOne($flowInsertData);
             }
+
             unset($flowInsertData);
             RedisLock::instance()->unlock($lockKey);
         } else {

+ 5 - 9
common/models/BalanceAudit.php

@@ -54,17 +54,13 @@ class BalanceAudit extends \common\components\ActiveRecord
 //            'name' => 'lx',
 //            'label' => '领袖分红奖余额',
 //        ],
-        'travel_points' => [
-            'name' => 'travel_points',
+        'tourism_points' => [
+            'name' => 'tourism_points',
             'label' => '旅游积分',
         ],
-        'car_points' => [
-            'name' => 'car_points',
-            'label' => '名车积分',
-        ],
-        'house_points' => [
-            'name' => 'house_points',
-            'label' => '豪宅积分',
+        'garage_points' => [
+            'name' => 'garage_points',
+            'label' => '车房积分',
         ],
     ];
 

+ 6 - 8
common/models/CalcBonus.php

@@ -103,9 +103,8 @@ use Yii;
  * @property string $MANAGE_TAX 管理费 
  * @property string $BONUS_BS 蓝星奖金(即新的管理奖)
  * @property string $ORI_BONUS_BS 蓝星原奖金(即新的管理奖,原奖金)
- * @property string $BONUS_TRAVEL 旅游奖奖金
- * @property string $BONUS_CAR 名车奖奖金
- * @property string $BONUS_HOUSE 豪宅奖奖金
+ * @property string $BONUS_TOURISM 旅游奖奖金
+ * @property string $BONUS_GARAGE 车房奖奖金
  */
 class CalcBonus extends \common\components\ActiveRecord
 {
@@ -125,7 +124,7 @@ class CalcBonus extends \common\components\ActiveRecord
         return [
             [['USER_ID', 'LAST_USER_NAME', 'LAST_REAL_NAME', 'LAST_MOBILE', 'LAST_SYSTEM_ID','LAST_LOCATION', 'PERIOD_NUM', 'CALC_YEAR', 'CALC_MONTH', 'CALCULATED_AT', 'P_CALC_MONTH', 'CREATED_AT'], 'required'],
             [['LAST_STATUS', 'LAST_PERIOD_AT', 'LAST_CREATED_AT', 'LAST_PROVINCE', 'LAST_CITY', 'LAST_COUNTY', 'LAST_IS_DIRECT_SELLER', 'LAST_LOCATION', 'PERIOD_NUM', 'CALC_YEAR', 'CALC_MONTH', 'CALCULATED_AT', 'IS_SENT', 'SENT_AT', 'CREATED_AT'], 'integer'],
-            [['ORI_BONUS_BS','EXCHANGE_POINTS','BONUS_BS','BONUS_QY', 'BONUS_YC', 'BONUS_VIP', 'BONUS_FX', 'BONUS_LS', 'BONUS_FW', 'BONUS_BT', 'BONUS_BT_PROD', 'BONUS_BT_TOOL', 'DEDUCT_ZR', 'BONUS_FL', 'BONUS_CF', 'BONUS_LX', 'SHOULD_QY', 'SHOULD_DEDUCT_ZR', 'PV_1L', 'QY_1L', 'SURPLUS_1L', 'PV_2L', 'QY_2L', 'SURPLUS_2L', 'PV_3L', 'QY_3L', 'SURPLUS_3L', 'PV_4L', 'QY_4L', 'SURPLUS_4L', 'PV_5L', 'QY_5L', 'SURPLUS_5L', 'PV_PCS', 'PV_LS_TOUCH', 'SURPLUS_LS', 'QY_LS', 'PV_TOUCH', 'BONUS_REAL', 'BONUS_TOTAL', 'BONUS_INCOME', 'ORI_BONUS_QY','ORI_BONUS_QY_BD','ORI_BONUS_QY_FX','ORI_BONUS_YC', 'ORI_BONUS_VIP','ORI_BONUS_STANDARD','BONUS_BD','ORI_BONUS_BD','BONUS_TG','ORI_BONUS_TG','BONUS_XF','ORI_BONUS_XF','BONUS_YJ','ORI_BONUS_YJ','ORI_BONUS_YJ_BD','ORI_BONUS_YJ_FX','BONUS_GX','ORI_BONUS_GX','REAL_BONUS_GX','BONUS_GL','ORI_BONUS_GL','REAL_BONUS_GL','ORI_BONUS_GL_BD','ORI_BONUS_GL_FX','RECONSUME_POINTS','MANAGE_TAX', 'BONUS_TRAVEL', 'BONUS_CAR', 'BONUS_HOUSE'], 'number'],
+            [['ORI_BONUS_BS','EXCHANGE_POINTS','BONUS_BS','BONUS_QY', 'BONUS_YC', 'BONUS_VIP', 'BONUS_FX', 'BONUS_LS', 'BONUS_FW', 'BONUS_BT', 'BONUS_BT_PROD', 'BONUS_BT_TOOL', 'DEDUCT_ZR', 'BONUS_FL', 'BONUS_CF', 'BONUS_LX', 'SHOULD_QY', 'SHOULD_DEDUCT_ZR', 'PV_1L', 'QY_1L', 'SURPLUS_1L', 'PV_2L', 'QY_2L', 'SURPLUS_2L', 'PV_3L', 'QY_3L', 'SURPLUS_3L', 'PV_4L', 'QY_4L', 'SURPLUS_4L', 'PV_5L', 'QY_5L', 'SURPLUS_5L', 'PV_PCS', 'PV_LS_TOUCH', 'SURPLUS_LS', 'QY_LS', 'PV_TOUCH', 'BONUS_REAL', 'BONUS_TOTAL', 'BONUS_INCOME', 'ORI_BONUS_QY','ORI_BONUS_QY_BD','ORI_BONUS_QY_FX','ORI_BONUS_YC', 'ORI_BONUS_VIP','ORI_BONUS_STANDARD','BONUS_BD','ORI_BONUS_BD','BONUS_TG','ORI_BONUS_TG','BONUS_XF','ORI_BONUS_XF','BONUS_YJ','ORI_BONUS_YJ','ORI_BONUS_YJ_BD','ORI_BONUS_YJ_FX','BONUS_GX','ORI_BONUS_GX','REAL_BONUS_GX','BONUS_GL','ORI_BONUS_GL','REAL_BONUS_GL','ORI_BONUS_GL_BD','ORI_BONUS_GL_FX','RECONSUME_POINTS','MANAGE_TAX', 'BONUS_TOURISM', 'BONUS_GARAGE'], 'number'],
             [['ID', 'USER_ID', 'LAST_DEC_LV', 'LAST_EMP_LV', 'LAST_SUB_COM_ID', 'LAST_SYSTEM_ID'], 'string', 'max' => 32],
             [['LAST_USER_NAME', 'LAST_REC_USER_NAME', 'LAST_CON_USER_NAME'], 'string', 'max' => 16],
             [['LAST_REAL_NAME', 'LAST_REC_REAL_NAME', 'LAST_CON_REAL_NAME'], 'string', 'max' => 128],
@@ -241,9 +240,8 @@ class CalcBonus extends \common\components\ActiveRecord
             'ORI_BONUS_BS_MNT' => '蓝星管理奖原奖金',
             'BONUS_BS_ABBR' => '蓝星业绩奖',
             'ORI_BONUS_BS_ABBR' => '蓝星业绩奖原奖金',
-            'BONUS_TRAVEL' => '旅游奖奖金',
-            'BONUS_CAR' => '名车奖奖金',
-            'BONUS_HOUSE' => '豪宅奖奖金',
+            'BONUS_TOURISM' => '旅游奖奖金',
+            'BONUS_GARAGE' => '车房奖奖金',
         ];
     }
 
@@ -259,7 +257,7 @@ class CalcBonus extends \common\components\ActiveRecord
         $periodYearMonths = Period::getNearlyPeriodYearMonth($num);
         $allBonus = [];
         foreach($periodYearMonths as $data){
-            $allBonus[] = static::findUseSlaves()->yearMonth($data['yearMonth'])->select('USER_ID,BONUS_QY, BONUS_YC, BONUS_FX, BONUS_LS, BONUS_FW, BONUS_BT, BONUS_BT_PROD, BONUS_BT_TOOL, DEDUCT_ZR, BONUS_FL, BONUS_CF, BONUS_LX, SHOULD_QY')->where('USER_ID=:USER_ID AND PERIOD_NUM=:PERIOD_NUM AND IS_SENT=1', [':USER_ID'=>$userId, ':PERIOD_NUM'=>$data['periodNum']])->asArray()->one();
+            $allBonus[] = static::findUseSlaves()->yearMonth($data['yearMonth'])->select('USER_ID,BONUS_QY, BONUS_YC, BONUS_FX, BONUS_LS, BONUS_FW, BONUS_BT, BONUS_BT_PROD, BONUS_BT_TOOL, DEDUCT_ZR, BONUS_FL, BONUS_CF, BONUS_LX, SHOULD_QY,BONUS_TOURISM,BONUS_GARAGE')->where('USER_ID=:USER_ID AND PERIOD_NUM=:PERIOD_NUM AND IS_SENT=1', [':USER_ID'=>$userId, ':PERIOD_NUM'=>$data['periodNum']])->asArray()->one();
         }
         return $allBonus;
     }

+ 4 - 6
common/models/CalcBonusZone.php → common/models/CalcBonusGarage.php

@@ -5,7 +5,7 @@ namespace common\models;
 use Yii;
 
 /**
- * This is the model class for table "{{%CALC_BONUS_ZONE}}".
+ * This is the model class for table "{{%CALC_BONUS_GARAGE}}".
  *
  * @property string $ID
  * @property string $USER_ID 会员ID
@@ -19,16 +19,15 @@ use Yii;
  * @property string $P_CALC_MONTH 表分区的日期索引
  * @property string $LOGS 日志
  * @property int $CREATED_AT 创建时间
- * @property string $BONUS_TYPE 奖金类型
  */
-class CalcBonusZone extends \common\components\ActiveRecord
+class CalcBonusGarage extends \common\components\ActiveRecord
 {
     /**
      * @inheritdoc
      */
     public static function tableName()
     {
-        return '{{%CALC_BONUS_ZONE}}';
+        return '{{%CALC_BONUS_GARAGE}}';
     }
 
     /**
@@ -37,7 +36,7 @@ class CalcBonusZone extends \common\components\ActiveRecord
     public function rules()
     {
         return [
-            [['USER_ID', 'PERIOD_NUM', 'CALC_YEAR', 'CALC_MONTH', 'P_CALC_MONTH', 'CREATED_AT', 'BONUS_TYPE'], 'required'],
+            [['USER_ID', 'PERIOD_NUM', 'CALC_YEAR', 'CALC_MONTH', 'P_CALC_MONTH', 'CREATED_AT'], 'required'],
             [['AMOUNT'], 'number'],
             [['LAST_STATUS', 'PERIOD_NUM', 'CALC_YEAR', 'CALC_MONTH', 'CREATED_AT'], 'integer'],
             [['ID', 'USER_ID', 'LAST_DEC_LV', 'BONUS_TYPE'], 'string', 'max' => 32],
@@ -65,7 +64,6 @@ class CalcBonusZone extends \common\components\ActiveRecord
             'P_CALC_MONTH' => '表分区的日期索引',
             'CREATED_AT' => '创建时间',
             'LOGS' => '日志',
-            'BONUS_TYPE' => '奖金类型',
         ];
     }
 }

+ 69 - 0
common/models/CalcBonusTourism.php

@@ -0,0 +1,69 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "{{%CALC_BONUS_TOURISM}}".
+ *
+ * @property string $ID
+ * @property string $USER_ID 会员ID
+ * @property string $LAST_DEC_LV 结算时会员级别
+ * @property string $LAST_EMP_LV 结算时会员聘级
+ * @property int $LAST_STATUS 结算时状态
+ * @property string $AMOUNT 奖金金额
+ * @property int $PERIOD_NUM 结算期数
+ * @property int $CALC_YEAR 所在结算年
+ * @property int $CALC_MONTH 所在结算月
+ * @property string $P_CALC_MONTH 表分区的日期索引
+ * @property string $LOGS 日志
+ * @property int $CREATED_AT 创建时间
+ */
+class CalcBonusTourism extends \common\components\ActiveRecord
+{
+    /**
+     * @inheritdoc
+     */
+    public static function tableName()
+    {
+        return '{{%CALC_BONUS_TOURISM}}';
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function rules()
+    {
+        return [
+            [['USER_ID', 'PERIOD_NUM', 'CALC_YEAR', 'CALC_MONTH', 'P_CALC_MONTH', 'CREATED_AT'], 'required'],
+            [['AMOUNT'], 'number'],
+            [['LAST_STATUS', 'PERIOD_NUM', 'CALC_YEAR', 'CALC_MONTH', 'CREATED_AT'], 'integer'],
+            [['ID', 'USER_ID', 'LAST_DEC_LV', 'BONUS_TYPE'], 'string', 'max' => 32],
+            [['P_CALC_MONTH'], 'safe'],
+            [['LOGS'], 'string', 'max' => 2000],
+            [['ID'], 'unique'],
+        ];
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function attributeLabels()
+    {
+        return [
+            'ID' => 'ID',
+            'USER_ID' => '会员ID',
+            'LAST_DEC_LV' => '结算时会员级别',
+            'LAST_EMP_LV' => '结算时会员聘级',
+            'LAST_STATUS' => '结算时状态',
+            'AMOUNT' => '奖金金额',
+            'PERIOD_NUM' => '结算期数',
+            'CALC_YEAR' => '所在结算年',
+            'CALC_MONTH' => '所在结算月',
+            'P_CALC_MONTH' => '表分区的日期索引',
+            'CREATED_AT' => '创建时间',
+            'LOGS' => '日志',
+        ];
+    }
+}

+ 6 - 9
common/models/DealType.php

@@ -47,15 +47,12 @@ class DealType extends \common\components\ActiveRecord
     CONST DEDUCT_LOGOUT = 'A1F1E76F34EE4981AB3BF4F8D20BB53E';//注销扣除
     CONST RECONSUME_POINTS_EXCHANGE = 'YA627DTHN81OBO7NIQ1OP8N3PGZX5C66';//复消积分兑换
     CONST EXCHANGE_POINTS_EXCHANGE = '316872011148300288';//兑换积分兑换
-    CONST TRAVEL_SEND = '364305038266470400';// 旅游奖奖金发放
-    CONST CAR_SEND = '364305160249413632';// 名车奖奖金发放
-    CONST HOUSE_SEND = '364305230252347392';// 豪宅奖奖金发放
-    CONST TRAVEL_POINTS_EXCHANGE = '365343018452127744'; // 旅游积分兑换
-    CONST CAR_POINTS_EXCHANGE = '365343060634243072'; // 名车积分兑换
-    CONST HOUSE_POINTS_EXCHANGE = '365343108638052352'; // 豪宅积分兑换
-    CONST TRAVEL_POINTS_ADJUST = '365753533326299136'; // 旅游积分余额调整
-    CONST CAR_POINTS_ADJUST = '365753643942678528'; // 名车积分余额调整
-    CONST HOUSE_POINTS_ADJUST = '365753716726435840'; // 豪宅积分余额调整
+    CONST TOURISM_SEND = '364305038266470400';// 旅游奖奖金发放
+    CONST GARAGE_SEND = '364305160249413632';// 车房奖奖金发放
+    CONST TOURISM_POINTS_EXCHANGE = '365343018452127744'; // 旅游积分兑换
+    CONST GARAGE_POINTS_EXCHANGE = '365343060634243072'; // 车房积分兑换
+    CONST TOURISM_POINTS_ADJUST = '365753533326299136'; // 旅游积分余额调整
+    CONST GARAGE_POINTS_ADJUST = '365753643942678528'; // 车房积分余额调整
 
     /**
      * {@inheritdoc}

+ 3 - 3
common/models/FlowZonePoints.php → common/models/FlowGaragePoints.php

@@ -5,7 +5,7 @@ namespace common\models;
 use Yii;
 
 /**
- * This is the model class for table "{{%FLOW_ZONE_POINTS}}".
+ * This is the model class for table "{{%FLOW_GARAGE_POINTS}}".
  *
  * @property string $ID
  * @property string $USER_ID 会员ID
@@ -24,7 +24,7 @@ use Yii;
  * @property int $SORT 排序
  * @property string $TRANSFER_SN 转账流水号
  */
-class FlowZonePoints extends \common\components\ActiveRecord
+class FlowGaragePoints extends \common\components\ActiveRecord
 {
     const INCR_REDUCE = 0;      // 减少
     const INCR_ADD = 1;         // 增加
@@ -36,7 +36,7 @@ class FlowZonePoints extends \common\components\ActiveRecord
      */
     public static function tableName()
     {
-        return '{{%FLOW_ZONE_POINTS}}';
+        return '{{%FLOW_GARAGE_POINTS}}';
     }
 
     /**

+ 81 - 0
common/models/FlowTourismPoints.php

@@ -0,0 +1,81 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "{{%FLOW_TOURISM_POINTS}}".
+ *
+ * @property string $ID
+ * @property string $USER_ID 会员ID
+ * @property string $CALC_ID 奖金结算表ID
+ * @property string $AMOUNT 金额
+ * @property string $TOTAL 当前总金额
+ * @property int $IS_INCR 是否增加
+ * @property string $REMARK 备注
+ * @property string $ADMIN_NAME 操作人名称
+ * @property int $PERIOD_NUM 所在期数
+ * @property int $CALC_MONTH 所在结算月
+ * @property string $P_MONTH 表分区的日期索引
+ * @property int $CREATED_AT 创建时间
+ * @property int $DELETED 是否删除
+ * @property int $DELETED_AT 删除时间
+ * @property int $SORT 排序
+ * @property string $TRANSFER_SN 转账流水号
+ */
+class FlowTourismPoints extends \common\components\ActiveRecord
+{
+    const INCR_REDUCE = 0;      // 减少
+    const INCR_ADD = 1;         // 增加
+    const INCR_FREEZE = 2;      // 冻结
+    const INCR_UNFREEZE = 3;    // 解冻
+
+    /**
+     * @inheritdoc
+     */
+    public static function tableName()
+    {
+        return '{{%FLOW_TOURISM_POINTS}}';
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function rules()
+    {
+        return [
+            [['USER_ID', 'REMARK', 'PERIOD_NUM', 'CALC_MONTH', 'P_MONTH', 'CREATED_AT'], 'required'],
+            [['AMOUNT', 'TOTAL'], 'number'],
+            [['IS_INCR', 'PERIOD_NUM', 'CALC_MONTH', 'CREATED_AT', 'DELETED', 'DELETED_AT', 'SORT'], 'integer'],
+            [['ID', 'USER_ID', 'CALC_ID', 'ADMIN_NAME', 'TRANSFER_SN'], 'string', 'max' => 32],
+            [['REMARK'], 'string', 'max' => 255],
+            [['ID'], 'unique'],
+        ];
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function attributeLabels()
+    {
+        return [
+            'ID' => 'ID',
+            'USER_ID' => '会员ID',
+            'CALC_ID' => '结算表ID',
+            'AMOUNT' => '交易金额',
+            'TOTAL' => '当前总金额',
+            'IS_INCR' => '是否增加',
+            'REMARK' => '备注',
+            'ADMIN_NAME' => '操作人名称',
+            'PERIOD_NUM' => '所在期数',
+            'CALC_MONTH' => '所在结算月',
+            'P_MONTH' => '表分区的日期索引',
+            'CREATED_AT' => '创建时间',
+            'DELETED' => '是否删除',
+            'DELETED_AT' => '删除时间',
+            'SORT' => '排序',
+            'TRANSFER_SN' => '转账流水号',
+        ];
+    }
+}

+ 7 - 22
common/models/ShopGoods.php

@@ -50,17 +50,12 @@ class ShopGoods extends \common\components\ActiveRecord
         4 => [
             'id' => 4,
             'name' => '旅游积分',
-            'label' => 'travel_points',
+            'label' => 'tourism_points',
         ],
         5 => [
             'id' => 5,
-            'name' => '名车积分',
-            'label' => 'car_points',
-        ],
-        6 => [
-            'id' => 6,
-            'name' => '豪宅积分',
-            'label' => 'house_points',
+            'name' => '车房积分',
+            'label' => 'garage_points',
         ],
         7 => [
             'id' => 7,
@@ -115,18 +110,11 @@ class ShopGoods extends \common\components\ActiveRecord
         ],
         [
             'id' => 5,
-            'name' => '车积分商品',
+            'name' => '车积分商品',
             'sell_type' => [
                 self::SALE_TYPE[5]
             ]
         ],
-        [
-            'id' => 6,
-            'name' => '豪宅积分商品',
-            'sell_type' => [
-                self::SALE_TYPE[6]
-            ]
-        ],
     ];
     /**
      * @inheritdoc
@@ -230,14 +218,11 @@ class ShopGoods extends \common\components\ActiveRecord
             'exchange' => [
                 'name' => '积分点数'
             ],
-            'travel_points'=>[
+            'tourism_points'=>[
                 'name'=>'旅游积分'
             ],
-            'car_points'=>[
-                'name'=>'名车积分'
-            ],
-            'house_points' => [
-                'name' => '豪宅积分'
+            'garage_points' => [
+                'name' => '车房积分'
             ],
             'pay_stack' => [
                 'name' => 'PayStack'

+ 13 - 7
common/models/UserBonus.php

@@ -15,6 +15,8 @@ use common\libs\logging\operate\valueType\Config as ValueTypeConfig;
  * @property string $BONUS_FREEZE 奖金冻结部分
  * @property string $CF 车房养老奖
  * @property string $LX 领袖分红奖
+ * @property string $TOURISM_POINTS 旅游积分
+ * @property string $GARAGE_POINTS 车房积分
  * @property string $QY_TOTAL 区域津贴累计
  * @property string $YC_TOTAL 育成津贴累计
  * @property string $VIP_TOTAL VIP奖金累计
@@ -28,6 +30,8 @@ use common\libs\logging\operate\valueType\Config as ValueTypeConfig;
  * @property string $LX_TOTAL 领袖分红累计
  * @property string $DEDUCT_ZR_TOTAL 责任业绩扣除累计
  * @property string $FL_TOTAL 形象店货补累计
+ * @property string $TOURISM_POINTS_TOTAL 旅游积分累积
+ * @property string $GARAGE_POINTS_TOTAL 车房积分累积
  * @property int $VER 乐观锁标识
  * @property int $CREATED_AT 创建时间
  * @property int $BD_TOTAL 服务奖累计
@@ -68,7 +72,7 @@ class UserBonus extends \common\components\ActiveRecord
     {
         return [
             [['USER_ID', 'CREATED_AT'], 'required'],
-            [['BS_TOTAL','ORI_BS_TOTAL','BS','BONUS', 'BONUS_FREEZE', 'CF', 'LX', 'QY_TOTAL', 'YC_TOTAL', 'VIP_TOTAL', 'FX_TOTAL', 'LS_TOTAL', 'FW_TOTAL', 'BT_TOTAL', 'BT_PROD_TOTAL', 'BT_TOOL_TOTAL', 'CF_TOTAL', 'LX_TOTAL', 'DEDUCT_ZR_TOTAL', 'FL_TOTAL', 'BD_TOTAL','TG_TOTAL','YJ_TOTAL','GX_TOTAL','GL_TOTAL', 'ORI_QY_TOTAL','ORI_YC_TOTAL','ORI_YC_TOTAL','ORI_BD_TOTAL','ORI_TG_TOTAL','ORI_YJ_TOTAL','ORI_GX_TOTAL','ORI_GL_TOTAL','RECONSUME_POINTS','MANAGE_TAX', 'RECONSUME_POINTS_EXPIRED', 'RECONSUME_POINTS_TOTAL', 'BONUS_TOTAL', 'TRAVEL_POINTS', 'CAR_POINTS', 'HOUSE_POINTS'], 'number'],
+            [['BS_TOTAL','ORI_BS_TOTAL','BS','BONUS', 'BONUS_FREEZE', 'CF', 'LX', 'QY_TOTAL', 'YC_TOTAL', 'VIP_TOTAL', 'FX_TOTAL', 'LS_TOTAL', 'FW_TOTAL', 'BT_TOTAL', 'BT_PROD_TOTAL', 'BT_TOOL_TOTAL', 'CF_TOTAL', 'LX_TOTAL', 'DEDUCT_ZR_TOTAL', 'FL_TOTAL', 'BD_TOTAL','TG_TOTAL','YJ_TOTAL','GX_TOTAL','GL_TOTAL', 'ORI_QY_TOTAL','ORI_YC_TOTAL','ORI_YC_TOTAL','ORI_BD_TOTAL','ORI_TG_TOTAL','ORI_YJ_TOTAL','ORI_GX_TOTAL','ORI_GL_TOTAL','RECONSUME_POINTS','MANAGE_TAX', 'RECONSUME_POINTS_EXPIRED', 'RECONSUME_POINTS_TOTAL', 'BONUS_TOTAL', 'TOURISM_POINTS', 'GARAGE_POINTS'], 'number'],
             [['VER', 'CREATED_AT'], 'integer'],
             [['ID','USER_ID'], 'string', 'max' => 32],
             [['USER_ID'], 'unique'],
@@ -123,12 +127,10 @@ class UserBonus extends \common\components\ActiveRecord
             'BS' => '蓝星奖(即新的管理奖)',
             'BS_TOTAL' => '蓝星(管理)累计',
             'ORI_BS_TOTAL' => '蓝星原奖金累计',
-            'TRAVEL' => '旅游积分',
-            'TRAVEL_TOTAL' => '旅游积分累计',
-            'CAR' => '名车积分',
-            'CAR_TOTAL' => '名车积分累计',
-            'HOUSE' => '豪宅积分',
-            'HOUSE_TOTAL' => '豪宅积分累计',
+            'TOURISM' => '旅游积分',
+            'TOURISM_TOTAL' => '旅游积分累计',
+            'GARAGE' => '车房积分',
+            'GARAGE_TOTAL' => '车房积分累计',
         ];
     }
 
@@ -142,6 +144,8 @@ class UserBonus extends \common\components\ActiveRecord
             'BONUS' => '会员账户',
             'CF' => '车房养老奖',
             'LX' => '领袖分红奖',
+            'TOURISM' => '旅游积分',
+            'GARAGE' => '车房积分',
         ];
     }
 
@@ -167,6 +171,8 @@ class UserBonus extends \common\components\ActiveRecord
                 'BONUS' => 0,
                 'CF' => 0,
                 'LX' => 0,
+                'TOURISM' => 0,
+                'GARAGE' => 0,
             ];
         }
         return $data;

+ 13 - 11
common/models/forms/OrderForm.php

@@ -532,9 +532,13 @@ class OrderForm extends Model
             if ($payAmount > Balance::getBalanceExchangePoints($loginUserId)) {
                 return ['code' => 500, 'message' => '兑换积分不足,无法购买商品'];
             }
-        } else if (in_array($payType, ['travel_points', 'car_points', 'house_points'])) {
-            if ($payAmount > Balance::getAccountBalance($loginUserId, $payType)) {
-                return ['code' => 500, 'message' => (Balance::BALANCE_TYPE[$payType]['title'] ?? '积分') . '不足,无法购买商品'];
+        } else if ($payType == 'tourism_points') {
+            if ($payAmount > Balance::getBalanceTourism($loginUserId)) {
+                return ['code' => 500, 'message' => '旅游积分不足,无法购买商品'];
+            }
+        } else if ($payType == 'garage_points') {
+            if ($payAmount > Balance::getBalanceGarage($loginUserId)) {
+                return ['code' => 500, 'message' => '车房积分不足,无法购买商品'];
             }
         } else{
 //            if ($payAmount > Balance::getBalanceReconsumePoints($loginUserId)) {
@@ -570,7 +574,7 @@ class OrderForm extends Model
         }else{
             $warehouse = '01';
         }
-        $_hasPV = in_array($this->payType, ['exchange', 'travel_points', 'car_points', 'house_points']) ? 0 : $this->_decPv;
+        $_hasPV = in_array($this->payType, ['exchange', 'tourism_points', 'garage_points']) ? 0 : $this->_decPv;
 
         $ordNo = $this->_generateSn();
         $orderModel = new Order();
@@ -620,7 +624,7 @@ class OrderForm extends Model
         // 加入商品到订单商品表
         foreach($this->_orderGoods as $key=>$value){
             // 增加判断,如果订单是兑换券购买,则AR_ORDER_GOODS中的REAL_PV真实PV应该是0
-            if (in_array($orderModel->PAY_TYPE, ['exchange', 'travel_points', 'car_points', 'house_points'])) {
+            if (in_array($orderModel->PAY_TYPE, ['exchange', 'tourism_points', 'garage_points'])) {
                 $this->_orderGoods[$key]['REAL_PV'] = 0;
             }
             $this->_orderGoods[$key]['ORDER_SN'] = $orderModel->SN;
@@ -633,12 +637,10 @@ class OrderForm extends Model
             Cash::changeUserCash(\Yii::$app->user->id, 'CASH', -abs($this->_payAmount), ['REMARK' => '会员复销余额支付']);
         } else if ($this->payType=='exchange') {
             Balance::changeUserBonus(\Yii::$app->user->id,'exchange_points', -abs($this->_payAmount),['DEAL_TYPE_ID' => DealType::EXCHANGE_POINTS_EXCHANGE,'REMARK' => '会员兑换积分兑换']);
-        } else if ($this->payType == 'travel_points') {
-            Balance::changeUserBonus(\Yii::$app->user->id, 'travel_points', -abs($this->_payAmount), ['DEAL_TYPE_ID' => DealType::TRAVEL_POINTS_EXCHANGE,'REMARK' => '会员旅游换积分兑换']);
-        } else if ($this->payType == 'car_points') {
-            Balance::changeUserBonus(\Yii::$app->user->id, 'car_points', -abs($this->_payAmount), ['DEAL_TYPE_ID' => DealType::CAR_POINTS_EXCHANGE,'REMARK' => '会员名车积分兑换']);
-        } else if ($this->payType == 'house_points') {
-            Balance::changeUserBonus(\Yii::$app->user->id, 'house_points', -abs($this->_payAmount), ['DEAL_TYPE_ID' => DealType::HOUSE_POINTS_EXCHANGE,'REMARK' => '会员豪宅积分兑换']);
+        } else if ($this->payType == 'tourism_points') {
+            Balance::changeUserBonus(\Yii::$app->user->id, 'tourism_points', -abs($this->_payAmount), ['DEAL_TYPE_ID' => DealType::TOURISM_POINTS_EXCHANGE,'REMARK' => '会员旅游换积分兑换']);
+        } else if ($this->payType == 'garage_points') {
+            Balance::changeUserBonus(\Yii::$app->user->id, 'garage_points', -abs($this->_payAmount), ['DEAL_TYPE_ID' => DealType::GARAGE_POINTS_EXCHANGE,'REMARK' => '会员名车积分兑换']);
         } else if ($this->payType == 'reconsume_points') {
             Balance::changeUserBonus(\Yii::$app->user->id,'reconsume_points', -abs($this->_payAmount),['DEAL_TYPE_ID' => DealType::RECONSUME_POINTS_EXCHANGE,'REMARK' => '会员复销积分兑换']);
         }

+ 1 - 1
common/models/forms/ShopGoodsForm.php

@@ -134,7 +134,7 @@ class ShopGoodsForm extends Model
 
             // 购买方式格式化为','分割的方式
             $this->sellType = implode(',', array_column($sellType, 'id'));
-            // 如果是普通商品,有PV,旅游、名车、豪宅商品没有PV
+            // 如果是普通商品,有PV,旅游积分、车房积分商品没有PV
             if ($this->categoryType != 1) {
                 $this->pricePv = 0;
             }

+ 2 - 2
frontendApi/config/menu.php

@@ -28,8 +28,8 @@ return [
         'show'=>1,
         'child'=>[
             ['name'=>'商品列表', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'index', 'routePath'=>'shop/index', 'show'=>1,],
-            ['name'=>'复消商品', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'reconsume', 'routePath'=>'shop/reconsume', 'show'=>1,'allow'=>'studio'],
-            ['name'=>'报单列表', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'dec-order-list', 'routePath'=>'shop/dec-order-list', 'show'=>1,],
+//            ['name'=>'复消商品', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'reconsume', 'routePath'=>'shop/reconsume', 'show'=>1,'allow'=>'studio'],
+//            ['name'=>'报单列表', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'dec-order-list', 'routePath'=>'shop/dec-order-list', 'show'=>1,],
             ['name'=>'订单列表', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'order-list', 'routePath'=>'shop/order-list', 'show'=>1,],
         ]
     ],

+ 25 - 43
frontendApi/modules/v1/controllers/BonusController.php

@@ -21,9 +21,10 @@ use common\models\CalcBonusFL;
 use common\models\DealType;
 use common\models\FlowBonus;
 use common\models\FlowCF;
+use common\models\FlowGaragePoints;
 use common\models\FlowLX;
 use common\models\FlowReconsumePoints;
-use common\models\FlowZonePoints;
+use common\models\FlowTourismPoints;
 use common\models\FlowWallet;
 use common\models\PerfMonth;
 use common\models\Period;
@@ -45,15 +46,14 @@ class BonusController extends BaseController {
      */
     public function actionIndex() {
         $userId = \Yii::$app->user->id;
-        $data = UserBonus::findUseSlaves()->select('BONUS,RECONSUME_POINTS,EXCHANGE_POINTS,TRAVEL_POINTS,CAR_POINTS,HOUSE_POINTS')->where('USER_ID=:USER_ID', [':USER_ID' => $userId])->asArray()->one();
+        $data = UserBonus::findUseSlaves()->select('BONUS,RECONSUME_POINTS,EXCHANGE_POINTS,TOURISM_POINTS,GARAGE_POINTS')->where('USER_ID=:USER_ID', [':USER_ID' => $userId])->asArray()->one();
         if (!$data) {
             $data = [
                 'BONUS' => 0,
 //                'RECONSUME_POINTS' => 0,
                 'EXCHANGE_POINTS' => 0,
-                'TRAVEL_POINTS' => 0,
-                'CAR_POINTS' => 0,
-                'HOUSE_POINTS'  => 0,
+                'TOURISM_POINTS' => 0,
+                'GARAGE_POINTS' => 0,
             ];
         }
         $data['CASH'] = 0;
@@ -74,9 +74,8 @@ class BonusController extends BaseController {
         $wallet[] = ['walletType' => 'cash', 'walletName' => '会员余额', 'amount' => Tool::formatPrice($data['CASH'])];
 //        $wallet[] = ['walletType' => 'point', 'walletName' => '会员积分', 'amount' => Tool::formatPrice($data['RECONSUME_POINTS'])];
         $wallet[] = ['walletType' => 'exchange', 'walletName' => '兑换点数', 'amount' => Tool::formatPrice($data['EXCHANGE_POINTS'])];
-        $wallet[] = ['walletType' => 'travel_points', 'walletName' => '旅游积分', 'amount' => Tool::formatPrice($data['TRAVEL_POINTS'])];
-        $wallet[] = ['walletType' => 'car_points', 'walletName' => '名车积分', 'amount' => Tool::formatPrice($data['CAR_POINTS'])];
-        $wallet[] = ['walletType' => 'house_points', 'walletName' => '豪宅积分', 'amount' => Tool::formatPrice($data['HOUSE_POINTS'])];
+        $wallet[] = ['walletType' => 'tourism_points', 'walletName' => '旅游积分', 'amount' => Tool::formatPrice($data['TOURISM_POINTS'])];
+        $wallet[] = ['walletType' => 'garage_points', 'walletName' => '车房积分', 'amount' => Tool::formatPrice($data['GARAGE_POINTS'])];
 //        if ($showCFLX) {
 //            $wallet[] = ['walletType' => 'cf', 'walletName' => '福利积分一', 'amount' => Tool::formatPrice($data['CF'])];
 //            $wallet[] = ['walletType' => 'lx', 'walletName' => '福利积分二', 'amount' => Tool::formatPrice($data['LX'])];
@@ -108,7 +107,7 @@ class BonusController extends BaseController {
      */
     public function actionWalletFlow(){
         $walletType = \Yii::$app->request->get('walletType');
-        if(!in_array($walletType,['bonus', 'cash', 'exchange', 'travel_points', 'car_points', 'house_points'])) return static::notice('错误的账户类型',400);
+        if(!in_array($walletType,['bonus', 'cash', 'exchange', 'tourism_points', 'garage_points'])) return static::notice('错误的账户类型',400);
         $dealType = \Yii::$app->request->get('dealType');
         $createAt = \Yii::$app->request->get('createAt');
         $remark = \Yii::$app->request->get('remark');
@@ -160,41 +159,26 @@ class BonusController extends BaseController {
                 'orderBy' => 'CREATED_AT DESC',
             ]);
         }else if ($walletType == 'exchange') {
-            $dealLists = FlowExchangePoints::find()->groupBy('DEAL_TYPE_ID')->select('DEAL_TYPE_ID')->where('USER_ID=:USER_ID',[':USER_ID'=>\Yii::$app->user->id])->asArray()->all();
+            $dealLists = FlowExchangePoints::find()->groupBy('DEAL_TYPE_ID')->select('DEAL_TYPE_ID')->where('USER_ID=:USER_ID', [':USER_ID' => \Yii::$app->user->id])->asArray()->all();
             $data = FlowExchangePoints::lists($condition, $params, [
                 'useSlaves' => true,
                 'select' => 'AMOUNT,TOTAL,IS_INCR,REMARK,REMARK_IS_SHOW,PERIOD_NUM,CALC_MONTH,CREATED_AT,DEAL_TYPE_ID,DEAL_TYPE_IS_PRESET',
                 'orderBy' => 'CREATED_AT DESC',
             ]);
-        } elseif (in_array($walletType, ['travel_points', 'car_points', 'house_points'])) {
-            $dealLists = FlowZonePoints::find()->groupBy('DEAL_TYPE_ID')->select('DEAL_TYPE_ID')->where('USER_ID=:USER_ID AND WALLET_TYPE=:WALLET_TYPE',[':USER_ID'=>\Yii::$app->user->id, ':WALLET_TYPE'=>$walletType])->asArray()->all();
-
-            $condition .= " AND WALLET_TYPE = :WALLET_TYPE";
-            $params[':WALLET_TYPE'] = $walletType;
-            $data = FlowZonePoints::lists($condition, $params, [
+        } else if ($walletType == 'tourism_points') {
+                $dealLists = FlowTourismPoints::find()->groupBy('DEAL_TYPE_ID')->select('DEAL_TYPE_ID')->where('USER_ID=:USER_ID',[':USER_ID'=>\Yii::$app->user->id])->asArray()->all();
+                $data = FlowTourismPoints::lists($condition, $params, [
+                    'useSlaves' => true,
+                    'select' => 'AMOUNT,TOTAL,IS_INCR,REMARK,REMARK_IS_SHOW,PERIOD_NUM,CALC_MONTH,CREATED_AT,DEAL_TYPE_ID,DEAL_TYPE_IS_PRESET',
+                    'orderBy' => 'CREATED_AT DESC',
+                ]);
+        } else if ($walletType == 'garage_points') {
+            $dealLists = FlowGaragePoints::find()->groupBy('DEAL_TYPE_ID')->select('DEAL_TYPE_ID')->where('USER_ID=:USER_ID',[':USER_ID'=>\Yii::$app->user->id])->asArray()->all();
+            $data = FlowGaragePoints::lists($condition, $params, [
                 'useSlaves' => true,
                 'select' => 'AMOUNT,TOTAL,IS_INCR,REMARK,REMARK_IS_SHOW,PERIOD_NUM,CALC_MONTH,CREATED_AT,DEAL_TYPE_ID,DEAL_TYPE_IS_PRESET',
                 'orderBy' => 'CREATED_AT DESC',
             ]);
-
-//            $dealTypeId = '';
-//            switch ($walletType) {
-//                case 'travel_points':
-//                    $dealTypeId = DealType::TRAVEL_SEND;
-//                    break;
-//                case 'car_points':
-//                    $dealTypeId = DealType::CAR_SEND;
-//                    break;
-//                case 'house_points':
-//                    $dealTypeId = DealType::HOUSE_SEND;
-//                    break;
-//            }
-//            $condition .= ' AND DEAL_TYPE_ID=:DEAL_TYPE_ID';
-//            $params[':DEAL_TYPE_ID'] = $dealTypeId;
-//            $data = FlowZonePoints::lists($condition, $params, [
-//                'select' => 'AMOUNT,TOTAL,IS_INCR,REMARK,REMARK_IS_SHOW,PERIOD_NUM,CALC_MONTH,CREATED_AT,DEAL_TYPE_ID,DEAL_TYPE_IS_PRESET',
-//                'orderBy' => 'CREATED_AT DESC',
-//            ]);
         }
 
         if($data) {
@@ -294,10 +278,9 @@ class BonusController extends BaseController {
             $data['ORI_BONUS_BS_MNT'] = ['name' => '管理奖金', 'value' => Tool::formatPrice($calcBonus['ORI_BONUS_BS_MNT'])];
             $data['ORI_BONUS_BS_ABBR'] = ['name' => '绩效奖金', 'value' => Tool::formatPrice($calcBonus['ORI_BONUS_BS_ABBR'])];
 
-            $data['ORI_BONUS_QUARTER'] = ['name' => '季度奖金', 'value' => Tool::formatPrice($calcBonus['ORI_BONUS_QUARTER'])];
-            $data['BONUS_TRAVEL'] = ['name' => '旅游奖', 'value' => Tool::formatPrice($calcBonus['BONUS_TRAVEL'])];
-            $data['BONUS_CAR'] = ['name' => '名车奖', 'value' => Tool::formatPrice($calcBonus['BONUS_CAR'])];
-            $data['BONUS_HOUSE'] = ['name' => '豪宅奖', 'value' => Tool::formatPrice($calcBonus['BONUS_HOUSE'])];
+            $data['ORI_BONUS_QUARTER'] = ['name' => '季度奖金', 'value' => Tool::formatPrice($calcBonus['ORI_BONUS_QUARTER'] ?? 0.00)];
+            $data['BONUS_TOURISM'] = ['name' => '旅游奖', 'value' => Tool::formatPrice($calcBonus['BONUS_TOURISM'])];
+            $data['BONUS_GARAGE'] = ['name' => '车房奖', 'value' => Tool::formatPrice($calcBonus['BONUS_GARAGE'])];
             $data['BONUS_TOTAL'] = ['name' => '合计', 'value' => Tool::formatPrice($calcBonus['BONUS_TOTAL'])];
 //            $data[] = ['name' => '管理费', 'value' => Tool::formatPrice($calcBonus['MANAGE_TAX'])];
             $data['BONUS_REAL'] = ['name' => '实发奖金', 'value' => Tool::formatPrice($calcBonus['BONUS_REAL'])];
@@ -373,7 +356,7 @@ class BonusController extends BaseController {
         $calcBonus = CalcBonus::find()->where('USER_ID=:USER_ID AND IS_SENT=1', [':USER_ID' => \Yii::$app->user->id])
         ->select('PERIOD_NUM,ORI_BONUS_QY,ORI_BONUS_YC,ORI_BONUS_VIP,ORI_BONUS_STANDARD,ORI_BONUS_BD,ORI_BONUS_TG,
         ORI_BONUS_XF,BONUS_TOTAL,MANAGE_TAX,BONUS_REAL,BONUS_INCOME,ORI_BONUS_YJ,ORI_BONUS_GX,ORI_BONUS_GL,RECONSUME_POINTS,
-        LAST_DEC_LV,LAST_EMP_LV,EXCHANGE_POINTS,ORI_BONUS_BS,ORI_BONUS_BS_MNT,ORI_BONUS_BS_ABBR,BONUS_TRAVEL,BONUS_CAR,BONUS_HOUSE')
+        LAST_DEC_LV,LAST_EMP_LV,EXCHANGE_POINTS,ORI_BONUS_BS,ORI_BONUS_BS_MNT,ORI_BONUS_BS_ABBR,BONUS_TOURISM,BONUS_GARAGE')
         ->limit($showBonusPeriodNum)
         ->orderBy('PERIOD_NUM DESC')
         ->asArray()
@@ -412,9 +395,8 @@ class BonusController extends BaseController {
                 $calcBonus[$key]['ORI_BONUS_BS_ABBR'] = ['name' => '绩效奖金', 'value' => Tool::formatPrice($calcBonus[$key]['ORI_BONUS_BS_ABBR'])];
 
                 $calcBonus[$key]['ORI_BONUS_QUARTER'] = ['name' => '季度奖金', 'value' => Tool::formatPrice($calcBonus[$key]['ORI_BONUS_QUARTER'] ?? 0)];
-                $calcBonus[$key]['BONUS_TRAVEL'] = ['name' => '旅游奖', 'value' => Tool::formatPrice($calcBonus[$key]['BONUS_TRAVEL'])];
-                $calcBonus[$key]['BONUS_CAR'] = ['name' => '名车奖', 'value' => Tool::formatPrice($calcBonus[$key]['BONUS_CAR'])];
-                $calcBonus[$key]['BONUS_HOUSE'] = ['name' => '豪宅奖', 'value' => Tool::formatPrice($calcBonus[$key]['BONUS_HOUSE'])];
+                $calcBonus[$key]['BONUS_TOURISM'] = ['name' => '旅游奖', 'value' => Tool::formatPrice($calcBonus[$key]['BONUS_TOURISM'])];
+                $calcBonus[$key]['BONUS_GARAGE'] = ['name' => '车房奖', 'value' => Tool::formatPrice($calcBonus[$key]['BONUS_GARAGE'])];
                 // 总奖金
                 $calcBonus[$key]['BONUS_TOTAL'] = ['name' => '合计', 'value' => Tool::formatPrice($calcBonus[$key]['BONUS_TOTAL'])];
 //                $calcBonus[$key]['RECONSUME_POINTS'] = ['name' => '复销积分', 'value' => Tool::formatPrice($calcBonus[$key]['RECONSUME_POINTS'])];

+ 5 - 11
frontendApi/modules/v1/controllers/ShopController.php

@@ -100,16 +100,14 @@ class ShopController extends BaseController {
             'points' => 0,
             'cash' => 0,
             'exchange' => 0,
-            'travel_points' => 0,
-            'car_points' => 0,
-            'house_points' => 0,
+            'tourism_points' => 0,
+            'garage_points' => 0,
         ];
         if ($userBonusResult = UserBonus::findOneAsArray(['USER_ID' => $userId])) {
             $userBalance['points'] = $userBonusResult['RECONSUME_POINTS'];
             $userBalance['exchange'] = $userBonusResult['EXCHANGE_POINTS'];
-            $userBalance['travel_points'] = $userBonusResult['TRAVEL_POINTS'];
-            $userBalance['car_points'] = $userBonusResult['CAR_POINTS'];
-            $userBalance['house_points'] = $userBonusResult['HOUSE_POINTS'];
+            $userBalance['tourism_points'] = $userBonusResult['TOURISM_POINTS'];
+            $userBalance['garage_points'] = $userBonusResult['GARAGE_POINTS'];
         }
         if ($userCashResult = UserWallet::findOneAsArray(['USER_ID' => $userId])) {
             $userBalance['cash'] = $userCashResult['CASH'];
@@ -339,11 +337,7 @@ class ShopController extends BaseController {
             ],
             [
                 'name' => '5',
-                'label' => '名车积分商品',
-            ],
-            [
-                'name' => '6',
-                'label' => '豪宅积分商品',
+                'label' => '车房积分商品',
             ],
         ];
         return static::notice($data);

+ 24 - 24
frontendEle/src/router/index.js

@@ -102,30 +102,30 @@ export const constantRouterMap = [
                     ],
                 },
             },
-            {
-                path: '/shop/reconsume',
-                component: _import('shop/reconsume'),
-                name: 'shop_reconsume',
-                meta: {
-                    title: '复消商品',
-                    breadcrumb: [
-                        {title: '首页', path: '/dashboard/index'},
-                        {title: '商城管理', path: '/shop/dec-order-list'},
-                    ],
-                },
-            },
-            {
-                path: '/shop/reconsume-order',
-                component: _import('shop/reconsume-order'),
-                name: 'reconsume-order',
-                meta: {
-                    title: '复消商品结算',
-                    breadcrumb: [
-                        {title: '首页', path: '/dashboard/index'},
-                        {title: '商城管理', path: '/shop/dec-order-list'}
-                    ],
-                },
-            },
+            // {
+            //     path: '/shop/reconsume',
+            //     component: _import('shop/reconsume'),
+            //     name: 'shop_reconsume',
+            //     meta: {
+            //         title: '复消商品',
+            //         breadcrumb: [
+            //             {title: '首页', path: '/dashboard/index'},
+            //             {title: '商城管理', path: '/shop/dec-order-list'},
+            //         ],
+            //     },
+            // },
+            // {
+            //     path: '/shop/reconsume-order',
+            //     component: _import('shop/reconsume-order'),
+            //     name: 'reconsume-order',
+            //     meta: {
+            //         title: '复消商品结算',
+            //         breadcrumb: [
+            //             {title: '首页', path: '/dashboard/index'},
+            //             {title: '商城管理', path: '/shop/dec-order-list'}
+            //         ],
+            //     },
+            // },
         ],
     },
   {

+ 4 - 7
frontendEle/src/views/bonus/other.vue

@@ -14,11 +14,9 @@
         </el-table-column>
         <el-table-column label="季度分红" prop="ORI_BONUS_QUARTER.value">
         </el-table-column>
-        <el-table-column label="旅游奖" prop="BONUS_TRAVEL.value">
+        <el-table-column label="旅游积分" prop="BONUS_TOURISM.value">
         </el-table-column>
-        <el-table-column label="名车奖" prop="BONUS_CAR.value">
-        </el-table-column>
-        <el-table-column label="豪宅奖" prop="BONUS_HOUSE.value">
+        <el-table-column label="车房积分" prop="BONUS_GARAGE.value">
         </el-table-column>
         <el-table-column label="合计" prop="BONUS_TOTAL.value">
         </el-table-column>
@@ -42,9 +40,8 @@
           <el-descriptions-item class="bonus-item" label="管理奖金">{{newData.ORI_BONUS_BS_MNT.value}}</el-descriptions-item>
           <el-descriptions-item class="bonus-item" label="绩效奖金">{{newData.ORI_BONUS_BS_ABBR.value}}</el-descriptions-item>
           <el-descriptions-item class="bonus-item" label="季度分红">{{newData.ORI_BONUS_QUARTER.value}}</el-descriptions-item>
-          <el-descriptions-item class="bonus-item" label="旅游奖">{{newData.BONUS_TRAVEL.value}}</el-descriptions-item>
-          <el-descriptions-item class="bonus-item" label="名车奖">{{newData.BONUS_CAR.value}}</el-descriptions-item>
-          <el-descriptions-item class="bonus-item" label="豪宅奖">{{newData.BONUS_HOUSE.value}}</el-descriptions-item>
+          <el-descriptions-item class="bonus-item" label="旅游积分">{{newData.BONUS_TOURISM.value}}</el-descriptions-item>
+          <el-descriptions-item class="bonus-item" label="车房积分">{{newData.BONUS_GARAGE.value}}</el-descriptions-item>
           <el-descriptions-item class="bonus-item" label="合计">{{newData.BONUS_TOTAL.value}}</el-descriptions-item>
           <el-descriptions-item class="bonus-item" label="实发奖金">{{newData.BONUS_REAL.value}}</el-descriptions-item>
           <el-descriptions-item class="bonus-item" label="一市场新增">{{newData.PV_1L.value}}</el-descriptions-item>

+ 8 - 17
frontendEle/src/views/shop/order.vue

@@ -104,21 +104,14 @@
                         <div v-if="category_type === 4">
                             <div class="sum_box">
                                 <div>旅游积分</div>
-                                <div>{{ balance.travel_points }}</div>
+                                <div>{{ balance.tourism_points }}</div>
                             </div>
                         </div>
 
                         <div v-if="category_type === 5">
                             <div class="sum_box">
-                                <div>名车积分</div>
-                                <div>{{ balance.car_points }}</div>
-                            </div>
-                        </div>
-
-                        <div v-if="category_type === 6">
-                            <div class="sum_box">
-                                <div>豪宅积分</div>
-                                <div>{{ balance.house_points }}</div>
+                                <div>车房积分</div>
+                                <div>{{ balance.garage_points }}</div>
                             </div>
                         </div>
                     </div>
@@ -302,18 +295,16 @@
                     } else if (this.payType === 'exchange') {
                         amountBalance = this.balance.exchange
                     }
-                    // amountBalance = (this.payType === 'cash') ? this.balance.cash : this.balance.exchange
                 } else if (this.category_type === 4) {
-                    amountBalance = this.balance.travel_points
+                    amountBalance = this.balance.tourism_points
                 } else if (this.category_type === 5) {
-                    amountBalance = this.balance.car_points
-                } else if (this.category_type === 6) {
-                    amountBalance = this.balance.house_points
+                    amountBalance = this.balance.garage_points
                 }
 
                 // 提示信息
                 let tips = '余额'
                 if (this.payType !== 'cash' && this.payType !== 'pay_stack') {
+                    console.log(this.payList, this.payType)
                     let payObj = this.payList.find((item) => {
                         return item.label === this.payType
                     })
@@ -363,7 +354,7 @@
                         })
                     } else {
                         // 非PayStack支付
-                        return network.postData(serviceApi, params).then((response) => {
+                        return network.postData('shop/sure-order', params).then(() => {
                             this.submitButtonStat = false
 
                                 // 非PayStack支付
@@ -440,7 +431,7 @@
                     }
 
                     // 支付方式的第一项默认选中
-                    this.payType = this.payList[0]
+                    this.payType = Object.values(this.payList)[0]['label']
                 })
             },
             // 切换支付方式