rabin 3 years ago
parent
commit
85a638f50f
1 changed files with 28 additions and 0 deletions
  1. 28 0
      service/agent/lib/Tool.php

+ 28 - 0
service/agent/lib/Tool.php

@@ -1010,4 +1010,32 @@ class Tool
 
         return 'ok';
     }
+
+    # 恢复扣除多发的业绩
+    public function kou_yeji_huifu_api()
+    {
+        Dever::config('base')->hook = true;
+
+        $where['state'] = 1;
+        $where['stype'] = 5;
+        $data = Dever::db('bill/sell')->select($where);
+
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $update = array();
+                $update['where_id'] = $v['mid'];
+                $num = -1*$v['num'];
+                if ($v['type'] == 1) {
+                    $update['group_sell'] = $num;
+                } else {
+                    $update['sell'] = $num;
+                }
+                $update['clear'] = true;
+                Dever::db('agent/member')->upGroupSellOne($update);
+                Dever::db('bill/sell')->update(array('where_id' => $v['id'], 'set_state' => 2));
+            }
+        }
+
+        return 'ok';
+    }
 }