root пре 3 година
родитељ
комит
64d4fa534c

+ 4 - 1
common/helpers/bonus/CalcCache.php

@@ -557,7 +557,7 @@ class CalcCache {
                 throw new \Exception('用户信息表数据不存在,userId:'.$userId);
             }
             $userShopInfo = User::find()
-            ->select('LAST_DEC_LV,REAL_NAME,DEC_LV,EMP_LV,CROWN_LV,IS_DEC,STATUS,IS_STUDIO,DEC_ID')
+            ->select('LAST_DEC_LV,REAL_NAME,DEC_LV,EMP_LV,CROWN_LV,IS_DEC,STATUS,IS_STUDIO,DEC_ID,DEC_ROLE_ID')
             ->where('ID=:ID', [':ID' => $userId])
             ->asArray()
             ->one();
@@ -575,6 +575,7 @@ class CalcCache {
             $userInfo['IS_DEC'] = $userShopInfo['IS_DEC'];
             $userInfo['STATUS'] = $userShopInfo['STATUS'];
             $userInfo['DEC_ID'] = $userShopInfo['DEC_ID'];
+            $userInfo['DEC_ROLE_ID'] = $userShopInfo['DEC_ROLE_ID'];
             unset($userShopInfo);
             if (!$userInfo['DEC_LV']) {
                 $userInfo['DEC_LV'] = DeclarationLevel::getDefaultLevelId();
@@ -983,7 +984,9 @@ class CalcCache {
             'BONUS_QY' => 0,
             'BONUS_BS' => 0,
             'BONUS_QUARTER' => 0,
+            'BONUS_BD' => 0,
             'ORI_BONUS_BS' => 0,
+            'ORI_BONUS_BD' => 0,
             'ORI_BONUS_QUARTER' => 0,
             'ORI_BONUS_TG' => 0,
             'ORI_BONUS_QY' => 0,

+ 135 - 142
common/helpers/bonus/CalcServeBonusCalc.php

@@ -28,6 +28,7 @@ use common\models\PerfPeriod;
 use common\models\Period;
 use common\models\ServeProcess;
 use common\models\StarCrownLevel;
+use Exception;
 use yii\base\BaseObject;
 use yii\base\StaticInstanceTrait;
 use yii\db\Query;
@@ -113,7 +114,6 @@ class CalcServeBonusCalc extends BaseObject {
      */
     public function calcStep() {
         try {
-            
             $this->_errors = [];
             $this->setPeriodNum(0);
             $this->_handleUserId = '';
@@ -213,7 +213,7 @@ class CalcServeBonusCalc extends BaseObject {
             // 将用户写入缓存
             if($this->_sysConfig['openQuarter']['VALUE']) {
                 $this->calcQuarterUser();
-                ServeProcess::recordProcess($t23, time(), $this->_periodNum, '计算季度奖-存入奖金会员', 'bonus');
+                ServeProcess::recordProcess($t24, time(), $this->_periodNum, '计算季度奖-存入奖金会员', 'bonus');
             }
             $this->_updatePercent(65);
             $t25 = microtime(true);
@@ -226,7 +226,6 @@ class CalcServeBonusCalc extends BaseObject {
             ServeProcess::recordProcess($t25, $t30, $this->_periodNum, '奖金写库', 'bonus');
             echo('奖金写库操作完成,耗时:' . round($t30 - $t25, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
 
-            Period::updateCalcProcess(3, $this->_periodNum);
             ServeProcess::recordProcess($t30, time(), $this->_periodNum, '标记为计算完成', 'bonus');
             $this->_updatePercent(100);
             $t35 = microtime(true);
@@ -270,7 +269,7 @@ class CalcServeBonusCalc extends BaseObject {
         $this->_starCrownLevelConfig = Cache::getStarCrownLevelConfig();
         $this->_decRoleConfig = CalcCache::getDecRoleConfig($this->_periodNum);
         $this->_periodId = $periodDataArr['ID'];
-        $this->_isPerpare = $periodDataArr['ID'];
+        $this->_isPerpare = $periodDataArr['IS_PREPARE'];
         $this->_isCalcMonth = $periodObj->isCalcMonth($this->_periodNum);
         $this->_calcYear = $periodObj->getYear($this->_periodNum);
         $this->_calcMonth = $periodObj->getMonth($this->_periodNum);
@@ -402,7 +401,6 @@ class CalcServeBonusCalc extends BaseObject {
                 // 从缓存中获取会员的业绩信息
                 $perfData = CalcCache::nowPeriodPerf($userId, $periodNum);
                 if( !$perfData ) continue;
-
                 $decRoleBonusFrom = explode(',', $this->_sysConfig['decRoleBonusFrom']['VALUE']);
                 $validPvPcs = 0;
                 foreach ($decRoleBonusFrom as $orderType) {
@@ -419,7 +417,7 @@ class CalcServeBonusCalc extends BaseObject {
                 if ( $validPvPcs <= 0 ) continue;
 
                 $this->loopRelationParentDo($userId, function ($parent) use($userId, $validPvPcs){
-
+                    try {
                     //判断parent的报单中心级别 和 服务奖比例
                     $bonusUserId = $parent['PARENT_UID'];
                     //计算级别之后更新过userInfo的缓存,缓存中级别发生了变化
@@ -444,7 +442,9 @@ class CalcServeBonusCalc extends BaseObject {
                     //记录奖金和奖金来源到缓存 并实现在缓存中奖金累加
                     CalcCache::saveFwBonusList($bonusUserId, $this->_periodNum, $fwBonus, ['fromUid'=>$userId, 'fromPvPcs'=>$validPvPcs]);
                     CalcCache::addHasFwBonusUsers($bonusUserId, $this->_periodNum);
-
+                    } catch(Exception $e) {
+                        var_dump($e->getMessage(), '------------');
+                    }
                     unset($bonusUserId, $bonusUserInfo, $isDec, $decRoleId, $parentDecRoleLevel, $parentFwBonusPercent, $cacheMaxPercent, $diffPercent, $fwBonus);
                 });
 
@@ -475,10 +475,10 @@ class CalcServeBonusCalc extends BaseObject {
                 $fwBonus = $fwBonusData['fwBonus'] ?? 0;
                 if( $fwBonus <=0  ) continue;
                 //总金额限制
+                try {
                 $userBaseInfo = CalcCache::getUserInfo($userId, $this->_periodNum);
-
                 CalcCache::bonus($userId, $this->_periodNum, 'BONUS_BD', $fwBonus);
-
+                 
                 $decRoleId = $userBaseInfo['DEC_ROLE_ID'];
                 $insertBonusData[] = [
                     'ID' => SnowFake::instance()->generateId(),
@@ -502,6 +502,9 @@ class CalcServeBonusCalc extends BaseObject {
                         'decRoleId' => $decRoleId,
                     ])
                 ];
+                } catch(Exception $e) {
+                    var_dump('---->>>', $e->getMessage());exit;
+                }
 
                 unset($userId, $fwBonusData, $userBaseInfo, $decRoleId, $fwBonus);
             }
@@ -990,24 +993,28 @@ class CalcServeBonusCalc extends BaseObject {
             // 不是结算月,则不进行计算
             return false;
         }
-        $allData = CalcBonusQuarter::finduseDbCalc()
-                ->where('PERIOD_NUM=:PERIOD_NUM', [':PERIOD_NUM' => $this->_periodNum])
-                ->groupBy('USER_ID')
-                ->offset($offset)
-                ->limit($this->_limit)
-                ->asArray()
-                ->all();
-        if ($allData){
-            // 达标条件:会员级别:钻卡
-            $config = json_decode($this->_sysConfig['openQuarter']['OPTIONS'], true);
-            $minDecLevel = $config['declarationLevel'] ?? [];
-            foreach ($allData as $user) {
-                // 管理奖钻卡发放
-                if ($user['LAST_DEC_LV'] == $minDecLevel) {
-                    CalcCache::bonus($user['USER_ID'], $this->_periodNum, 'BONUS_QUARTER', $user['ORI_BONUS']);
+        try{
+            $allData = CalcBonusQuarter::finduseDbCalc()
+                    ->where('PERIOD_NUM=:PERIOD_NUM', [':PERIOD_NUM' => $this->_periodNum])
+                    ->groupBy('USER_ID')
+                    ->offset($offset)
+                    ->limit($this->_limit)
+                    ->asArray()
+                    ->all();
+            if ($allData){
+                // 达标条件:会员级别:钻卡
+                $config = json_decode($this->_sysConfig['openQuarter']['OPTIONS'], true);
+                $minDecLevel = $config['declarationLevel'] ?? [];
+                foreach ($allData as $user) {
+                    // 管理奖钻卡发放
+                    if ($user['LAST_DEC_LV'] == $minDecLevel) {
+                        CalcCache::bonus($user['USER_ID'], $this->_periodNum, 'BONUS_QUARTER', $user['ORI_BONUS']);
+                    }
                 }
+                return $this->calcQuarterUser($offset + $this->_limit);
             }
-            return $this->calcQuarterUser($offset + $this->_limit);
+        } catch(Exception $e) {
+            var_dump($e->getMessage(),'--------------------');
         }
         unset($allData);
         return true;
@@ -1196,32 +1203,13 @@ class CalcServeBonusCalc extends BaseObject {
         //判断是否达到了本月扣除复消的上限
         $cacheData = CalcCache::monthLastPeriodReconsumePoints($userId, $this->_periodNum, $this->_calcYearMonth);
         $bonusCache = CalcCache::bonus($userId, $this->_periodNum);
-        $reConsumePointsTotal = $bonusCache['RECONSUME_POINTS'] + $cacheData['RECONSUME_POINTS_SUM'];
-        $reConsumePointsCap = $this->_sysConfig['reConsumePointsMonthCap']['VALUE'];
-        unset($cacheData, $bonusCache);
-        $reConsumePoints = 0;
-        if( $reConsumePointsTotal < $reConsumePointsCap ) {
-            $reConsumePoints = $bonus * $this->_sysConfig['reConsumePointsPercent']['VALUE'] / 100;
-
-            $reConsumePoints = min($reConsumePoints, $reConsumePointsCap-$reConsumePointsTotal);
+        $lastPeriodPoints = '0.00';
+        if (!empty($cacheData)) {
+            $lastPeriodPoints =  $cacheData['RECONSUME_POINTS_SUM'];
         }
-        unset($reConsumePointsTotal, $reConsumePointsCap);
-
-        return $reConsumePoints;
-    }
-
-    /**
-     * 扣除复消积分和管理费
-     */
-    public function deduct($userId, $bonus) {
-        //判断是否达到了本月扣除复消的上限
-        $cacheData = CalcCache::monthLastPeriodReconsumePoints($userId, $this->_periodNum, $this->_calcYearMonth);
-        $bonusCache = CalcCache::bonus($userId, $this->_periodNum);
-
-        $reConsumePointsTotal = $bonusCache['RECONSUME_POINTS'] + $cacheData['RECONSUME_POINTS_SUM'];
+        $reConsumePointsTotal = $bonusCache['RECONSUME_POINTS'] + $lastPeriodPoints;
         $reConsumePointsCap = $this->_sysConfig['reConsumePointsMonthCap']['VALUE'];
-        unset($cacheData, $bonusCache);
-
+        unset($cacheData, $bonusCache, $lastPeriodPoints);
         $reConsumePoints = 0;
         if( $reConsumePointsTotal < $reConsumePointsCap ) {
             $reConsumePoints = $bonus * $this->_sysConfig['reConsumePointsPercent']['VALUE'] / 100;
@@ -1230,13 +1218,7 @@ class CalcServeBonusCalc extends BaseObject {
         }
         unset($reConsumePointsTotal, $reConsumePointsCap);
 
-        $manageTax = $bonus * $this->_sysConfig['manageTaxPercent']['VALUE'] / 100;
-        $surplus = $bonus - $reConsumePoints - $manageTax;
-        return [
-            'reConsumePoints' => Tool::formatPrice($reConsumePoints),//复效积分
-            'manageTax' => Tool::formatPrice($manageTax),//管理费
-            'surplus' => Tool::formatPrice($surplus),//真实奖金
-        ];
+        return $reConsumePoints;
     }
 
     /**
@@ -1256,21 +1238,26 @@ class CalcServeBonusCalc extends BaseObject {
         echo sprintf("时间:[%s]缓存奖金数据入库,当前offset为:【%s】" . PHP_EOL, date('Y-m-d H:i:s', time()) , $offset);
         // 从缓存列表里面从底层往上倒序获取会员
         $allData = CalcCache::getHasBonusUsers($this->_periodNum, $offset, $this->_limit);
-        if($allData){
-            $insertDataBonus = [];
-            foreach($allData as $userId){
-                $tempBonusData = $this->bonusData($userId);
-                if(!empty($tempBonusData['result'])){
-                    $insertDataBonus[] = $tempBonusData['result'];
+        
+            if($allData){
+                $insertDataBonus = [];
+                foreach($allData as $userId){
+                    try {
+                    $tempBonusData = $this->bonusData($userId);
+                    if(!empty($tempBonusData['result'])){
+                        $insertDataBonus[] = $tempBonusData['result'];
+                    }
+                    }catch(Exception $e) {
+                        var_dump($e->getMessage(),'ssssssssssssssss',$userId);
+                    }
+                    unset($userId, $tempBonusData);
                 }
+                CalcBonus::batchInsert($insertDataBonus);
 
-                unset($userId, $tempBonusData);
+                unset($insertDataBonus, $allData);
+                return $this->loopBonusUsers($offset + $this->_limit);
             }
-            CalcBonus::batchInsert($insertDataBonus);
-
-            unset($insertDataBonus, $allData);
-            return $this->loopBonusUsers($offset + $this->_limit);
-        }
+         
         return true;
     }
 
@@ -1279,83 +1266,89 @@ class CalcServeBonusCalc extends BaseObject {
      */
     public function bonusData($userId) {
         // 车奖和房奖是积分,不参加到奖金累计中.季度奖季度发放,无最低消费限制
-        $bonus = CalcCache::bonus($userId, $this->_periodNum);
-        $baseInfo = CalcCache::getUserInfo($userId, $this->_periodNum);
-        $perfData = CalcCache::nowPeriodPerf($userId, $this->_periodNum);
-        $tourismBonus = CalcCache::tourismBonus($userId, $this->_periodNum);
-        $garageBonus = CalcCache::garageBonus($userId, $this->_periodNum);
-        $villaBonus = CalcCache::villaBonus($userId, $this->_periodNum);
-        $pervSurplusPerf = CalcCache::surplusPerf($userId, $this->_periodNum);
-        $starCrownLv = CalcCache::getUserStarCrown($userId, $this->_periodNum);// 星级
-        $bonusReal = '0.000'; // 总实发   
-        $deductManageTaxItems = Config::DEDUCT_MANAGE_TAX; // 扣除管理费的列表  
-        $deductReconsumePointsItems = Config::DEDUCT_RECONSUME_POINTS;// 扣除复消积分的列表
-        $totalReconsumePointSum = $totalManageSum = '0.000'; // 需要扣除的奖金项,扣除完之后的实发金额
-        $deductManageTax = '0.000'; //  扣除的管理费
-        $deductReconsumePoints = '0.000'; //  扣除的复消积分 
-        foreach($deductManageTaxItems as $v) {
-            $totalManageSum+= $bonus[$v]; // 需要扣除管理费的累计之和
-        }
-        foreach($deductReconsumePointsItems as $v) {
-            $totalReconsumePointSum+= $bonus[$v]; // 需要扣除管理费的累计之和
-        }
-        // 扣除管理费
-        if ($totalManageSum > 0) {
-            $deductManageTax = $this->deductManageTax($totalManageSum);
-        }
+        try{
+            $bonus = CalcCache::bonus($userId, $this->_periodNum);
+            $baseInfo = CalcCache::getUserInfo($userId, $this->_periodNum);
+            $perfData = CalcCache::nowPeriodPerf($userId, $this->_periodNum);
+            $tourismBonus = CalcCache::tourismBonus($userId, $this->_periodNum);
+            $garageBonus = CalcCache::garageBonus($userId, $this->_periodNum);
+            $villaBonus = CalcCache::villaBonus($userId, $this->_periodNum);
+            $pervSurplusPerf = CalcCache::surplusPerf($userId, $this->_periodNum);
+            $starCrownLv = CalcCache::getUserStarCrown($userId, $this->_periodNum);// 星级
+            $bonusReal = '0.000'; // 总实发   
+            $deductManageTaxItems = Config::DEDUCT_MANAGE_TAX; // 扣除管理费的列表  
+            $deductReconsumePointsItems = Config::DEDUCT_RECONSUME_POINTS;// 扣除复消积分的列表
+            $totalReconsumePointSum = $totalManageSum = '0.000'; // 需要扣除的奖金项,扣除完之后的实发金额
+            $deductManageTax = '0.000'; //  扣除的管理费
+            $deductReconsumePoints = '0.000'; //  扣除的复消积分 
+            foreach($deductManageTaxItems as $v) {
+                $totalManageSum+= $bonus[$v]; // 需要扣除管理费的累计之和
+            }
+            foreach($deductReconsumePointsItems as $v) {
+                $totalReconsumePointSum+= $bonus[$v]; // 需要扣除复消积分的累计之和 
+            }
 
-        // 扣除复消积分
-        if ($totalReconsumePointSum > 0) {
-            $deductReconsumePoints = $this->deductReconsumePonits($userId, $totalReconsumePointSum);
+            // 扣除管理费
+            if ($totalManageSum > 0) {
+                $deductManageTax = $this->deductManageTax($totalManageSum);
+            }
+            // 扣除复消积分
+            if ($totalReconsumePointSum > 0) {
+                $deductReconsumePoints = $this->deductReconsumePonits($userId, $totalReconsumePointSum);
+            }
+            // 总实发=总原奖金-扣除的总管理费-总复消积分
+            $bonusReal = $bonus['BONUS_TOTAL'] - $deductManageTax - $deductReconsumePoints;
+            // NG系统,不发放兑换积分
+            // 因为是最后统一发奖金,每个奖金得实发是和原奖金一样得.只不过要扣除管理费和复消积分.
+            // 当然,ng现在不扣除管理费和复消积分.所以都是0
+            $result = [
+                'USER_ID' => $userId,
+                'LAST_USER_NAME' => $baseInfo['USER_NAME'],
+                'LAST_REAL_NAME' => $baseInfo['REAL_NAME'],
+                'LAST_DEC_LV' => $baseInfo['DEC_LV'],
+                'LAST_EMP_LV' => $baseInfo['LAST_EMP_LV'],
+                'LAST_CROWN_LV' => $starCrownLv ?? StarCrownLevel::getDefaultLevelId(),
+                'RECONSUME_POINTS' => $deductReconsumePoints,
+                'MANAGE_TAX' => $deductManageTax,    // 管理费
+                'BONUS_REAL'=>  $bonusReal,
+                'BONUS_TOTAL'=>$bonus['BONUS_TOTAL'],
+                'ORI_BONUS_BD' => $bonus['ORI_BONUS_BD'],
+                'ORI_BONUS_TG' => $bonus['ORI_BONUS_TG'],
+                'ORI_BONUS_BS' => $bonus['ORI_BONUS_BS'], // 蓝星管理奖金原奖金
+                'ORI_BONUS_QY' => $bonus['ORI_BONUS_QY'],
+                'ORI_CAPPED_BONUS_QY' => $bonus['ORI_CAPPED_BONUS_QY'], // 团队奖封顶前的奖金
+                'ORI_BONUS_QUARTER' => $bonus['ORI_BONUS_QUARTER'],
+                'ORI_BONUS_TOURISM' => $tourismBonus, // 旅游奖
+                'ORI_BONUS_VILLA' => $villaBonus, // 房奖
+                'ORI_BONUS_GARAGE' => $garageBonus, // 车奖
+                'PV_1L' => $perfData['PV_1L_TOUCH'],//TOUCH为碰业绩
+                'QY_1L' => $perfData['PV_1L_TOUCH'] + $pervSurplusPerf['SURPLUS_1L'],
+                'SURPLUS_1L' => $perfData['SURPLUS_1L'],
+                'PV_2L' => $perfData['PV_2L_TOUCH'],
+                'QY_2L' => $perfData['PV_2L_TOUCH'] + $pervSurplusPerf['SURPLUS_2L'],
+                'SURPLUS_2L' => $perfData['SURPLUS_2L'],
+                'PV_3L' => $perfData['PV_3L_TOUCH'],
+                'QY_3L' => $perfData['PV_3L_TOUCH'] + $pervSurplusPerf['SURPLUS_3L'],
+                'SURPLUS_3L' => $perfData['SURPLUS_3L'],
+                'PV_4L' => $perfData['PV_4L_TOUCH'],
+                'QY_4L' => $perfData['PV_4L_TOUCH'] + $pervSurplusPerf['SURPLUS_4L'],
+                'SURPLUS_4L' => $perfData['SURPLUS_4L'],
+                'PV_5L' => $perfData['PV_5L_TOUCH'],
+                'QY_5L' => $perfData['PV_5L_TOUCH'] + $pervSurplusPerf['SURPLUS_5L'],
+                'SURPLUS_5L' => $perfData['SURPLUS_5L'],
+                'PV_PCS' => $perfData['PV_PCS'],
+                'PV_TOUCH' => Tool::formatPrice($perfData['PV_1L_TOUCH'] + $perfData['PV_2L_TOUCH'] + $perfData['PV_3L_TOUCH'] + $perfData['PV_4L_TOUCH'] + $perfData['PV_5L_TOUCH']),
+                'PERIOD_NUM' => $this->_periodNum,
+                'CALC_YEAR' => $this->_calcYear,
+                'CALC_MONTH' => $this->_calcYearMonth,
+                'CREATED_AT' => Date::nowTime(),
+            ];
+            
+        } catch(Exception $e) {
+            var_dump($e->getMessage(),'-----------------------------------------------',$userId);
         }
-        // 总实发=总原奖金-扣除的总管理费-总复消积分
-        $bonusReal = $bonus['BONUS_TOTAL'] - $deductManageTax - $deductReconsumePoints;
-        // NG系统,不发放兑换积分
-        $result = [
-            'USER_ID' => $userId,
-            'LAST_USER_NAME' => $baseInfo['USER_NAME'],
-            'LAST_REAL_NAME' => $baseInfo['REAL_NAME'],
-            'LAST_DEC_LV' => $baseInfo['DEC_LV'],
-            'LAST_EMP_LV' => $baseInfo['LAST_EMP_LV'],
-            'LAST_CROWN_LV' => $starCrownLv ?? StarCrownLevel::getDefaultLevelId(),
-            'RECONSUME_POINTS' => $deductReconsumePoints,
-            'MANAGE_TAX' => $deductManageTax,    // 管理费
-            'BONUS_REAL'=>  $bonusReal,
-            'BONUS_TOTAL'=>$bonus['BONUS_TOTAL'],
-            'ORI_BONUS_BD' => $bonus['ORI_BONUS_BD'],
-            'ORI_BONUS_TG' => $bonus['ORI_BONUS_TG'],
-            'ORI_BONUS_BS' => $bonus['ORI_BONUS_BS'], // 蓝星管理奖金原奖金
-            'ORI_BONUS_QY' => $bonus['ORI_BONUS_QY'],
-            'ORI_CAPPED_BONUS_QY' => $bonus['ORI_CAPPED_BONUS_QY'], // 团队奖封顶前的奖金
-            'ORI_BONUS_QUARTER' => $bonus['ORI_BONUS_QUARTER'],
-            'ORI_BONUS_TOURISM' => $tourismBonus, // 旅游奖
-            'ORI_BONUS_VILLA' => $villaBonus, // 房奖
-            'ORI_BONUS_GARAGE' => $garageBonus, // 车奖
-            'PV_1L' => $perfData['PV_1L_TOUCH'],//TOUCH为碰业绩
-            'QY_1L' => $perfData['PV_1L_TOUCH'] + $pervSurplusPerf['SURPLUS_1L'],
-            'SURPLUS_1L' => $perfData['SURPLUS_1L'],
-            'PV_2L' => $perfData['PV_2L_TOUCH'],
-            'QY_2L' => $perfData['PV_2L_TOUCH'] + $pervSurplusPerf['SURPLUS_2L'],
-            'SURPLUS_2L' => $perfData['SURPLUS_2L'],
-            'PV_3L' => $perfData['PV_3L_TOUCH'],
-            'QY_3L' => $perfData['PV_3L_TOUCH'] + $pervSurplusPerf['SURPLUS_3L'],
-            'SURPLUS_3L' => $perfData['SURPLUS_3L'],
-            'PV_4L' => $perfData['PV_4L_TOUCH'],
-            'QY_4L' => $perfData['PV_4L_TOUCH'] + $pervSurplusPerf['SURPLUS_4L'],
-            'SURPLUS_4L' => $perfData['SURPLUS_4L'],
-            'PV_5L' => $perfData['PV_5L_TOUCH'],
-            'QY_5L' => $perfData['PV_5L_TOUCH'] + $pervSurplusPerf['SURPLUS_5L'],
-            'SURPLUS_5L' => $perfData['SURPLUS_5L'],
-            'PV_PCS' => $perfData['PV_PCS'],
-            'PV_TOUCH' => Tool::formatPrice($perfData['PV_1L_TOUCH'] + $perfData['PV_2L_TOUCH'] + $perfData['PV_3L_TOUCH'] + $perfData['PV_4L_TOUCH'] + $perfData['PV_5L_TOUCH'] + $perfData['PV_LS_TOUCH']),
-            'PERIOD_NUM' => $this->_periodNum,
-            'CALC_YEAR' => $this->_calcYear,
-            'CALC_MONTH' => $this->_calcYearMonth,
-            'CREATED_AT' => Date::nowTime(),
-        ];
         $resend = [];
-
-        unset($bonus, $realBonusGl, $bonusReal);
+        unset($bonus, $bonusReal);
         return ['result'=>$result,'resend'=>$resend];
     }
 

+ 8 - 8
common/models/Config.php

@@ -36,15 +36,15 @@ class Config extends \common\components\ActiveRecord
     const INPUT_TYPE_SWITCH = 8;            // 开关切换
     const INPUT_TYPE_TEXTAREA = 9;            // 多行文本
     const INPUT_TYPE_TABLE = 10;            // 表格
-    CONST DEDUCT_MANAGE_TAX = [
-        'BONUS_BS', // 蓝星管理奖
-        'BONUS_QY', // 团队奖
-        'BONUS_QUARTER' // 季度奖
+    const DEDUCT_MANAGE_TAX = [
+        'ORI_BONUS_BS', // 蓝星管理奖
+        'ORI_BONUS_QY', // 团队奖
+        'ORI_BONUS_QUARTER' // 季度奖
     ]; // 扣除管理费的奖金项
-    CONST DEDUCT_RECONSUME_POINTS = [
-        'BONUS_BS', // 蓝星管理奖
-        'BONUS_QY', // 团队奖
-        'BONUS_QUARTER' // 季度奖
+    const DEDUCT_RECONSUME_POINTS = [
+        'ORI_BONUS_BS', // 蓝星管理奖
+        'ORI_BONUS_QY', // 团队奖
+        'ORI_BONUS_QUARTER' // 季度奖
     ]; // 扣除复消积分的奖金项
 
     /**

+ 14 - 9
common/models/ServeProcess.php

@@ -3,6 +3,7 @@
 namespace common\models;
 
 use common\helpers\snowflake\SnowFake;
+use Exception;
 use Yii;
 
 /**
@@ -109,15 +110,19 @@ class ServeProcess extends \common\components\ActiveRecord
 
     // 记录流程
     public static function recordProcess($start, $end, $periodNum, $desc, $type='perf') {
-        $logData[] = [
-            'ID' => SnowFake::instance()->generateId(),
-            'PERIOD_NUM' => $periodNum ?: 0,
-            'TASK_TYPE' => $type,
-            'START_AT' => date('Y-m-d H:i:s', $start),
-            'END_AT' => date('Y-m-d H:i:s', $end),
-            'TASK_DESCRIBE' => $desc,
-        ];
+        try {
+            $logData[] = [
+                'ID' => SnowFake::instance()->generateId(),
+                'PERIOD_NUM' => $periodNum ?: 0,
+                'TASK_TYPE' => $type,
+                'START_AT' => date('Y-m-d H:i:s', $start),
+                'END_AT' => date('Y-m-d H:i:s', $end),
+                'TASK_DESCRIBE' => $desc,
+            ];
 
-        ServeProcess::batchInsert($logData);
+            ServeProcess::batchInsert($logData);
+        } catch (Exception $e) {
+            var_dump($e->getMessage());
+        }
     }
 }