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

去掉调试,删除表转大写

root 4 лет назад
Родитель
Сommit
f2b37f57c2

+ 1 - 1
common/components/ActiveRecord.php

@@ -432,7 +432,7 @@ class ActiveRecord extends \yii\db\ActiveRecord {
      */
     public static function pageDeleteAll($where='') {
         $limit = 10000;
-        $sql = sprintf('DELETE FROM %s WHERE %s LIMIT %d', self::tableName(), $where, $limit);
+        $sql = sprintf('DELETE FROM %s WHERE %s LIMIT %d', strtoupper(self::tableName()), $where, $limit);
         $affectRow = self::getDb()->createCommand($sql)->execute();
         if( $affectRow == $limit ) {
             unset($limit, $sql, $affectRow);

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

@@ -211,11 +211,6 @@ class CalcCache {
     public static function addUsers($periodNum, $offset = 0, $limit = self::LIMIT) {
 //        echo sprintf("时间:[%s]缓存用户,当前offset为:【%s】" . PHP_EOL, date('Y-m-d H:i:s', time()) , $offset);
         // 修复USER_INFO表里面已经没有PERIOD_NUM了
-        file_put_contents('awws.txt', var_export([
-            'periodNum' => $periodNum,
-            'offset' => $offset,
-            'limit' => $limit
-        ],true));
         $allData = UserInfo::findUseDbCalc()->from(UserInfo::tableName(). 'AS UI')->select('UI.USER_ID,U.STATUS')->leftJoin(User::tableName() . 'AS U', 'U.ID=UI.USER_ID')->where('1=1')->orderBy('UI.RELATION_DEEP DESC,UI.ID DESC')->offset($offset)->limit($limit)->asArray()->all();
         //$allData = User::findUseDbShopCalc()->select('ID AS USER_ID')->where('PERIOD_AT<=:PERIOD_AT AND IS_UNION=0 AND DELETED=0', [':PERIOD_AT' => $periodNum])->offset($offset)->limit($limit)->asArray()->all();
         if ($allData) {

+ 23 - 14
common/helpers/bonus/PerfCalc.php

@@ -544,20 +544,28 @@ class PerfCalc {
                 // 把该会员加入到能拿到业绩的会员缓存中
                 CalcCache::addHasPerfUsers($data['USER_ID'], $this->_periodNum);
                 // 给上追加业绩
-                $this->loopNetworkParentDo($data['USER_ID'], function ($parent) use (&$data, $payPv) {
-                    // 给上级会员追加业绩到缓存中
-//                    CalcCache::addUserPerf($parent['PARENT_UID'], $this->_periodNum, [
-//                        'PV_'.$parent['LOCATION'].'L' => $data['DEC_PV'],
-//                    ]);
-                    // 给上级会员追加本期业绩到缓存中
-                    CalcCache::nowPeriodPerf($parent['PARENT_UID'], $this->_periodNum, [
-                        'PV_' . $parent['LOCATION'] . 'L' => $payPv,
-                        'PV_' . $parent['LOCATION'] . 'L_TOUCH' => $payPv,
-                        'PV_' . $parent['LOCATION'] . 'L_FX' => $payPv,
-                    ]);
-                    // 把该会员加入到能拿到业绩的会员缓存中
-                    CalcCache::addHasPerfUsers($parent['PARENT_UID'], $this->_periodNum);
-                });
+                try {
+                    $this->loopNetworkParentDo($data['USER_ID'], function ($parent) use (&$data, $payPv) {
+                        // 给上级会员追加业绩到缓存中
+    //                    CalcCache::addUserPerf($parent['PARENT_UID'], $this->_periodNum, [
+    //                        'PV_'.$parent['LOCATION'].'L' => $data['DEC_PV'],
+    //                    ]);
+                        // 给上级会员追加本期业绩到缓存中
+                        CalcCache::nowPeriodPerf($parent['PARENT_UID'], $this->_periodNum, [
+                            'PV_' . $parent['LOCATION'] . 'L' => $payPv,
+                            'PV_' . $parent['LOCATION'] . 'L_TOUCH' => $payPv,
+                            'PV_' . $parent['LOCATION'] . 'L_FX' => $payPv,
+                        ]);
+                        // 把该会员加入到能拿到业绩的会员缓存中
+                        CalcCache::addHasPerfUsers($parent['PARENT_UID'], $this->_periodNum);
+                    });
+                } catch(\Exception $e) {
+                    file_put_contents('loopNetworkParentDo_error.txt', var_export([
+                        'USER_ID' => $data['USER_ID'],
+                        '_periodNum' => $this->_periodNum,
+                        'error' => $e->getMessage()
+                    ],true));
+                }
                 //给推荐关系累计增加业绩
                 $this->loopRelationParentDo($data['USER_ID'], function ($parent) use ($data, $payPv) {
                     // 给上级会员追加业绩到缓存中
@@ -1230,6 +1238,7 @@ class PerfCalc {
                     continue;
                 }
                 unset($data, $funcResult);
+                
             }
             unset($allData);
             return $this->loopNetworkParentDo($userId, $callbackFunc, $offset + $this->_limit);