zxiansheng před 4 roky
rodič
revize
6dd22d6247

+ 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);

+ 22 - 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) {
                     // 给上级会员追加业绩到缓存中

+ 5 - 0
loopNetworkParentDo_error.txt

@@ -0,0 +1,5 @@
+array (
+  'USER_ID' => '76193994119450624',
+  '_periodNum' => 189,
+  'error' => 'Trying to access array offset on value of type null',
+)