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

Merge branch 'feature/1035-hidden-network' into dev

# Conflicts:
#	common/components/SwooleAsyncTimer.php
#	common/helpers/DingTalk.php
#	console/controllers/ToolController.php
#	vendor/yiisoft/yii2/web/ErrorHandler.php
theo 3 лет назад
Родитель
Сommit
f86971ff40

+ 2 - 2
backendApi/config/params.php

@@ -1,6 +1,6 @@
 <?php
 return [
     'adminEmail' => 'admin@example.com',
-    'noCheckTokenActions' => ['v1/oauth/login', 'v1/oauth/no-login-modify-password', 'v1/oauth/refresh-access-token', 'v1/oauth/refresh-refresh-token', 'v1/oauth/refresh-token', 'v1/site/days-diff', 'v1/site/page-data', 'v1/site/captcha'],
-    'noCheckPermissionActions' => ['oauth/login', 'oauth/no-login-modify-password', 'oauth/refresh-access-token', 'oauth/refresh-refresh-token', 'oauth/refresh-token', 'oauth/info', 'site/base-info', 'site/days-diff', 'site/page-data', 'site/captcha', 'user/full-info', 'user/filter-user', 'user/generate-user-name', 'reconsume/cant-deduct-date', 'user/get-sub-com', 'user/chk-relation', 'user/get-period-num', 'user/company-bank-get', 'user/main-divide', 'user/chk-del-user', 'reconsume/deduct-audit-add', 'finance/perf-apply-get','file/upload-excel', 'user/move-net-type', 'user/move-get', 'user/reg-info-audit-get', 'user/status-audit-get', 'user/status-audit-get-statuses', 'user/close-login-get', 'user/close-dec-get', 'atlas/main-user-info', 'reconsume/change-audit-get', 'reconsume/cant-deduct-month', 'finance/change-balance-type', 'finance/balance-audit-get', 'file/token', 'finance/perf-audit-get', 'finance/invoice-audit-get', 'finance/withdraw-get', 'finance/deal-type-get', 'ad/upload', 'config/reg-type-get', 'config/pact-get', 'user/reg-info-audit-add-opt', 'reconsume/get-flow-deal-type', 'user/status-close-get', 'finance/mult-point'],
+    'noCheckTokenActions' => ['v1/oauth/login', 'v1/oauth/no-login-modify-password', 'v1/oauth/refresh-access-token', 'v1/oauth/refresh-refresh-token', 'v1/oauth/refresh-token', 'v1/site/days-diff', 'v1/site/page-data', 'v1/site/captcha', 'v1/site/send-notice'],
+    'noCheckPermissionActions' => ['oauth/login', 'oauth/no-login-modify-password', 'oauth/refresh-access-token', 'oauth/refresh-refresh-token', 'oauth/refresh-token', 'oauth/info', 'site/base-info', 'site/days-diff', 'site/page-data', 'site/captcha', 'site/send-notice', 'user/full-info', 'user/filter-user', 'user/generate-user-name', 'reconsume/cant-deduct-date', 'user/get-sub-com', 'user/chk-relation', 'user/get-period-num', 'user/company-bank-get', 'user/main-divide', 'user/chk-del-user', 'reconsume/deduct-audit-add', 'finance/perf-apply-get','file/upload-excel', 'user/move-net-type', 'user/move-get', 'user/reg-info-audit-get', 'user/status-audit-get', 'user/status-audit-get-statuses', 'user/close-login-get', 'user/close-dec-get', 'atlas/main-user-info', 'reconsume/change-audit-get', 'reconsume/cant-deduct-month', 'finance/change-balance-type', 'finance/balance-audit-get', 'file/token', 'finance/perf-audit-get', 'finance/invoice-audit-get', 'finance/withdraw-get', 'finance/deal-type-get', 'ad/upload', 'config/reg-type-get', 'config/pact-get', 'user/reg-info-audit-add-opt', 'reconsume/get-flow-deal-type', 'user/status-close-get', 'finance/mult-point'],
 ];

+ 1 - 0
backendApi/config/urlManagerRules.php

@@ -17,6 +17,7 @@ return [
             'GET days-diff' => 'days-diff',
             'GET page-data' => 'page-data',
             'GET captcha' => 'captcha',
+            'GET send-notice' => 'send-notice',
         ],
     ],
     [

+ 13 - 0
backendApi/modules/v1/controllers/SiteController.php

@@ -147,4 +147,17 @@ class SiteController extends BaseController
         return $menuResult;
     }
 
+    /**
+     * 发送钉钉测试信息
+     * @return mixed
+     * @throws \yii\web\HttpException
+     */
+    public function actionSendNotice()
+    {
+        $data = [
+            'code' => 400,
+            'message' => 'autoSendDingTalk',
+        ];
+        return static::notice(['data' => $data['bug监控正常运行,没有发现异常.']]);
+    }
 }

+ 2 - 2
common/components/SwooleAsyncTimer.php

@@ -72,9 +72,9 @@ class SwooleAsyncTimer extends SwooleAsyncTimerComponent implements SocketInterf
             // 初始化备份历史奖金数据表
 //            TaskFunc::initAutoBakBalance();
             // 初始化自动发送钉钉推送消息
-            if (YII_ENV == YII_ENV_PROD) {
+//            if (YII_ENV == YII_ENV_PROD) {
 //                TaskFunc::initAutoSendDingTalk();
-            }
+//            }
         }
     }
 

+ 1 - 1
common/helpers/DingTalk.php

@@ -51,4 +51,4 @@ class DingTalk
 //            }
 //        }
     }
-}
+}

+ 28 - 28
common/libs/taskQueue/TaskFunc.php

@@ -48,36 +48,36 @@ class TaskFunc
     /**
      * 初始化自动发送钉钉提醒任务
      */
-    public static function initAutoSendDingTalk() {
-        // 查看数据库中是否存在未开始的任务,如果没有就添加一个新任务
-        if(!TaskQueue::find()->where('TYPE=:TYPE AND CONTENT=:CONTENT AND STARTED_AT>:STARTED_AT', [':TYPE'=>Queue::TYPE_FUNC, ':CONTENT'=>TaskFunc::class.'::autoSendDingTalkTable', ':STARTED_AT'=>Date::nowTime()])->asArray()->exists()){
-            // 获取站点配置中的备份时间
-            $config = Cache::getSystemConfig();
-            $sendDingTalkTime = $config['sendDingTalkTime']['VALUE'];
-            Queue::instance()->addTask(Queue::TYPE_FUNC, TaskFunc::class.'::autoSendDingTalkTable', [], Queue::LOOP_TYPE_DAY, $sendDingTalkTime, 0);
-        }
-    }
+//    public static function initAutoSendDingTalk() {
+//        // 查看数据库中是否存在未开始的任务,如果没有就添加一个新任务
+//        if(!TaskQueue::find()->where('TYPE=:TYPE AND CONTENT=:CONTENT AND STARTED_AT>:STARTED_AT', [':TYPE'=>Queue::TYPE_FUNC, ':CONTENT'=>TaskFunc::class.'::autoSendDingTalkTable', ':STARTED_AT'=>Date::nowTime()])->asArray()->exists()){
+//            // 获取站点配置中的备份时间
+//            $config = Cache::getSystemConfig();
+//            $sendDingTalkTime = $config['sendDingTalkTime']['VALUE'];
+//            Queue::instance()->addTask(Queue::TYPE_FUNC, TaskFunc::class.'::autoSendDingTalkTable', [], Queue::LOOP_TYPE_DAY, $sendDingTalkTime, 0);
+//        }
+//    }
 
     /**
      * 自动送钉钉提醒
      */
-    public static function autoSendDingTalkTable() {
-        $ip = 'https://fapi.ekhkad.com';
-//        $ip = 'http://16.163.228.151:8013';
-        $curl = curl_init();
-        curl_setopt($curl, CURLOPT_URL, $ip . '/v1/site/send-notice');
-        curl_setopt($curl, CURLOPT_TIMEOUT, 5000);
-        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
-        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
-        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
-        $res = curl_exec($curl);
-        if ($res) {
-            curl_close($curl);
-            LoggerTool::info($res);
-        } else {
-            $error = curl_errno($curl);
-            curl_close($curl);
-            LoggerTool::error($error);
-        }
-    }
+//    public static function autoSendDingTalkTable() {
+//        $ip = 'https://fapi.ekhkad.com';
+////        $ip = 'http://16.163.228.151:8013';
+//        $curl = curl_init();
+//        curl_setopt($curl, CURLOPT_URL, $ip . '/v1/site/send-notice');
+//        curl_setopt($curl, CURLOPT_TIMEOUT, 5000);
+//        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
+//        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
+//        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
+//        $res = curl_exec($curl);
+//        if ($res) {
+//            curl_close($curl);
+//            LoggerTool::info($res);
+//        } else {
+//            $error = curl_errno($curl);
+//            curl_close($curl);
+//            LoggerTool::error($error);
+//        }
+//    }
 }

+ 8 - 4
common/models/UserNetwork.php

@@ -256,7 +256,7 @@ class UserNetwork extends \common\components\ActiveRecord
      * @throws \yii\base\Exception
      * @throws \yii\db\Exception
      */
-    public static function getChildrenWithDeepAndLayer($userId, $deep, $loopedDeep = 1, $periodNum=null){
+    public static function getChildrenWithDeepAndLayer($userId, $deep, $loopedDeep = 1, $periodNum=null, $hiddenUser=[]){
         $allData = self::getChildrenFromPeriod($userId, $periodNum);
         if($allData){
             $decLevelConfig = Cache::getDecLevelConfig();
@@ -273,10 +273,14 @@ class UserNetwork extends \common\components\ActiveRecord
 //                    'MOBILE' => $baseInfo['MOBILE'],
                     'PERIOD_AT' => $baseInfo['PERIOD_AT'],
                 ]);
+                if(in_array($data['USER_ID'], $hiddenUser)){
+                    unset($allData[$key]);
+                    continue;
+                }
                 // 获取字节点数量
                 $childNum = self::firstFloorChildNumFromPeriod($data['USER_ID'], $periodNum);
                 if($childNum > 0 && $loopedDeep < $deep){
-                    $child = self::getChildrenWithDeepAndLayer($data['USER_ID'], $deep, $loopedDeep + 1, $periodNum);
+                    $child = self::getChildrenWithDeepAndLayer($data['USER_ID'], $deep, $loopedDeep + 1, $periodNum, $hiddenUser);
                     $leaf = false;
                     $icon = 'el-icon-user-solid';
                 }
@@ -297,7 +301,7 @@ class UserNetwork extends \common\components\ActiveRecord
                 $allData[$key]['displayNone'] = 'display-none';
             }
         }
-        return $allData;
+        return array_values($allData);
     }
 
     /**
@@ -337,7 +341,7 @@ class UserNetwork extends \common\components\ActiveRecord
         $table = self::getTableNameFromPeriod($periodNum);
         $db = $table['db'];
         $tableName = $table['tableName'];
-        return $db->createCommand("SELECT USER_ID,TOP_DEEP,RELATIVE_LOCATION FROM {$tableName} WHERE PARENT_UID=:PARENT_UID AND USER_ID NOT IN (SELECT HIDDEN_USER_ID FROM AR_USER_NETWORK_HIDDEN WHERE USER_ID=:PARENT_UID)")->bindValues([':PARENT_UID'=>$userId])->queryAll();
+        return $db->createCommand("SELECT USER_ID,TOP_DEEP,RELATIVE_LOCATION FROM {$tableName} WHERE PARENT_UID=:PARENT_UID")->bindValues([':PARENT_UID'=>$userId])->queryAll();
     }
 
     /**

+ 24 - 1
console/controllers/ToolController.php

@@ -178,6 +178,7 @@ class ToolController extends BaseController
     /**
      * 自动送钉钉提醒
      */
+
     public function actionAutoSendDingTalkTable() {
 //        $ip = 'http://16.163.228.151:8013';
 //        $ip = 'https://fapi.ekhkad.com';
@@ -197,4 +198,26 @@ class ToolController extends BaseController
 //            LoggerTool::error($error);
 //        }
     }
-}
+
+    /**
+     * 自动送钉钉提醒
+     */
+    public function actionAutoSendDingTalkBackend() {
+        $ip = 'https://bapi.ekhkad.com';
+        $curl = curl_init();
+        curl_setopt($curl, CURLOPT_URL, $ip . '/v1/site/send-notice');
+        curl_setopt($curl, CURLOPT_TIMEOUT, 5000);
+        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
+        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
+        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
+        $res = curl_exec($curl);
+        if ($res) {
+            curl_close($curl);
+            LoggerTool::info($res);
+        } else {
+            $error = curl_errno($curl);
+            curl_close($curl);
+            LoggerTool::error($error);
+        }
+    }
+}

+ 4 - 2
frontendApi/modules/v1/controllers/AtlasController.php

@@ -12,6 +12,7 @@ use common\helpers\Cache;
 use common\helpers\user\Info;
 use common\models\Period;
 use common\models\UserNetwork;
+use common\models\UserNetworkHidden;
 use Yii;
 use common\models\User;
 
@@ -81,10 +82,11 @@ class AtlasController extends BaseController {
         $userId = Yii::$app->request->get('id', \Yii::$app->user->id);
         $periodNum = Yii::$app->request->get('periodNum', null);
         $deep = Yii::$app->request->get('deep', 5);
+        $hiddenUser = UserNetworkHidden::fetchHiddenUser($userId);
         if ($deep > 20) {
             return static::notice('最多查看会员的前20层子会员', 400);
         }
-        $allData = UserNetwork::getChildrenWithDeepAndLayer($userId, $deep, 1, $periodNum);
+        $allData = UserNetwork::getChildrenWithDeepAndLayer($userId, $deep, 1, $periodNum, $hiddenUser);
         return static::notice(['allData' => $allData, 'periodNum' => $periodNum]);
     }
 
@@ -147,4 +149,4 @@ class AtlasController extends BaseController {
         ]);
     }
 
-}
+}

+ 2 - 2
frontendEle/src/views/dashboard/index.vue

@@ -17,8 +17,8 @@
               </el-col>
               <el-col :xs="24" :sm="24" :md="24" :lg="4" :xl="12">会员级别:{{decLvName}}</el-col>
               <el-col :xs="24" :sm="24" :md="24" :lg="8" :xl="12">当前业绩期:{{periodNum}}</el-col>
-              <el-col :xs="24" :sm="24" :md="24" :lg="8" :xl="12">剩余PV:{{myRemainPv}}</el-col><!--剩余的PV-->
-              <el-col :xs="24" :sm="24" :md="24" :lg="8" :xl="12">活跃日期截止:{{activeEnd}}</el-col><!--活跃日期截止-->
+<!--              <el-col :xs="24" :sm="24" :md="24" :lg="8" :xl="12">剩余PV:{{myRemainPv}}</el-col>&lt;!&ndash;剩余的PV&ndash;&gt;-->
+<!--              <el-col :xs="24" :sm="24" :md="24" :lg="8" :xl="12">活跃日期截止:{{activeEnd}}</el-col>&lt;!&ndash;活跃日期截止&ndash;&gt;-->
             </el-row>
           </el-col>
         </el-row>