Jelajahi Sumber

增加会员网络因为数据问题,导致无法进行流程兼容

zxiansheng 4 tahun lalu
induk
melakukan
f2abff3b5f
2 mengubah file dengan 17 tambahan dan 10 penghapusan
  1. 1 0
      2022-01-17_usernetwork.php_error.log
  2. 16 10
      common/models/UserNetwork.php

+ 1 - 0
2022-01-17_usernetwork.php_error.log

@@ -0,0 +1 @@
+____86803120205729792________86803120205729792____

+ 16 - 10
common/models/UserNetwork.php

@@ -7,6 +7,7 @@ use common\helpers\Cache;
 use common\helpers\NetPoint;
 use common\helpers\user\Info;
 use common\helpers\user\Perf;
+use Exception;
 use Yii;
 use yii\data\Pagination;
 use yii\helpers\Json;
@@ -104,16 +105,21 @@ class UserNetwork extends \common\components\ActiveRecord
         unset($parentUidsArr);
         $parentList = [];
         foreach ($pageParentUids as $parentUid) {
-            $parentNetInfo = static::find($isSlaves, $db)->select(['TOP_DEEP', 'LOCATION_TAG'])->where('USER_ID=:USER_ID', ['USER_ID'=>$parentUid])->asArray()->one();
-            $parentList[] = [
-                'USER_ID' => $userId,
-                'TOP_DEEP' => $userNetInfo['TOP_DEEP'],
-                'PARENT_UID' => $parentUid,
-                'PARENT_DEEP' => $parentNetInfo['TOP_DEEP'],
-//                'LOCATION_TAG' => $userNetInfo['LOCATION_TAG'],
-//                'PARENT_LOCATION_TAG' => $parentNetInfo['LOCATION_TAG'],
-                'LOCATION' => substr($userNetInfo['LOCATION_TAG'], strlen($parentNetInfo['LOCATION_TAG']), 1),
-            ];
+            try {
+                $parentNetInfo = static::find($isSlaves, $db)->select(['TOP_DEEP', 'LOCATION_TAG'])->where('USER_ID=:USER_ID', ['USER_ID'=>$parentUid])->asArray()->one();
+                $parentList[] = [
+                    'USER_ID' => $userId,
+                    'TOP_DEEP' => $userNetInfo['TOP_DEEP'],
+                    'PARENT_UID' => $parentUid,
+                    'PARENT_DEEP' => $parentNetInfo['TOP_DEEP'],
+    //                'LOCATION_TAG' => $userNetInfo['LOCATION_TAG'],
+    //                'PARENT_LOCATION_TAG' => $parentNetInfo['LOCATION_TAG'],
+                    'LOCATION' => substr($userNetInfo['LOCATION_TAG'], strlen($parentNetInfo['LOCATION_TAG']), 1),
+                ];
+            } catch (Exception $e) {
+                $file_name = date('Y-m-d', time()).'_usernetwork.php_error.log';
+                file_put_contents($file_name, '____'.$parentUid.'____', FILE_APPEND);
+            }
 
             unset($parentUid, $parentNetInfo);
         }