rabin 3 years ago
parent
commit
c53655185e
1 changed files with 18 additions and 5 deletions
  1. 18 5
      service/agent/lib/Import.php

+ 18 - 5
service/agent/lib/Import.php

@@ -10,6 +10,9 @@ class Import
     # 图片存放地址
     private $img_host = 'https://cryl.yijiuguanfang.com/attachment/';
 
+    # 导入开关
+    private $state = 1;
+
     public function __construct()
     {
         $this->db = Dever::db('agent/test:old');
@@ -48,6 +51,7 @@ class Import
 
     public function get_api()
     {
+        $this->state = Dever::input('state', 1);
         $this->date = Dever::maketime('2021-09-01 00:00:00');
         Dever::config('base')->hook = true;
         $host = 'https://cryl.yijiuguanfang.com/attachment/';
@@ -285,11 +289,16 @@ class Import
                             Dever::load('invite/lib/relation')->add($data['parent_mid'], $data['mid'], 1);
                             # 为上级增加增加业绩
                             Dever::load('bill/lib/sell')->up($data['parent_mid'], 1, $data['f_price'], $data['role'], $order_id, '邀请' . $data['name'] . '['.$data['mobile'].']新增直推业绩', 3, $data['cdate']);
-                            //Dever::load('bill/lib/sell')->up($data['parent_mid'], 2, $data['f_price'], $data['role'], $order_id, '邀请' . $data['name'] . '['.$data['mobile'].']新增团队业绩', 3, $data['cdate']);
+
+                            if ($this->state == 2) {
+                                Dever::load('bill/lib/sell')->up($data['parent_mid'], 2, $data['f_price'], $data['role'], $order_id, '邀请' . $data['name'] . '['.$data['mobile'].']新增团队业绩', 3, $data['cdate']);
+                            }
                         }
 
-                        if (!$update) {
-                            Dever::load('bill/lib/sell')->up($data['mid'], 2, $data['group_sell'], $data['role'], $order_id, '新增团队业绩', 3, time());
+                        if ($this->state == 1) {
+                            if (!$update) {
+                                Dever::load('bill/lib/sell')->up($data['mid'], 2, $data['group_sell'], $data['role'], $order_id, '新增团队业绩', 3, time());
+                            }
                         }
                     }
                     echo $v['id'];
@@ -374,7 +383,9 @@ class Import
                 $num = Dever::load('invite/api')->getChildNum($v['id'], 1);
                 if ($num != $v['old_agentdownnum']) {
                     # 记录日志 无需记录 数据无误
-                    //$this->log($v['id'], 2, $v['old_agentdownnum'], $num);
+                    if ($this->state == 2) {
+                        $this->log($v['id'], 2, $v['old_agentdownnum'], $num);
+                    }
                 }
 
                 # 获取直推业绩
@@ -388,7 +399,9 @@ class Import
                     $update['group_sell'] = $sell['num'];
                     if ($update['group_sell'] != $v['old_group_sell']) {
                         # 记录日志 无需记录
-                        //$this->log($v['id'], 3, $v['old_group_sell'], $update['group_sell']);
+                        if ($this->state == 2) {
+                            $this->log($v['id'], 3, $v['old_group_sell'], $update['group_sell']);
+                        }
                     }
 
                     if ($v['level_id'] > 0) {