rabin 9 月之前
父節點
當前提交
b6203d5d67

+ 42 - 4
src/dai/seller/api/Task.php

@@ -195,7 +195,7 @@ class Task
             if ($data && isset($data[0]['sum'])) {
                 //$sum = $data[0]['sum'] - $v['credit'];
                 $sum = $data[0]['sum'];
-                Dever::db('info', 'seller')->update($v['id'], array('cash' => $sum));
+                //Dever::db('info', 'seller')->update($v['id'], array('cash' => $sum));
             }
         }
     }
@@ -241,11 +241,49 @@ class Task
     # 插入测试数据
     public function test()
     {
-        $order = Dever::db('order_bak', 'seller')->load([]);
+        $where = array();
+        //$where['id'] = '65c345d7d46ba46b32041d32';
+        $where['status'] = 10;
+        $set = array();
+        //$where['sku_id'] = 18;
+        //$set['limit'] = 10;
+        //$set['order'] = 'total desc';
+        //$set['col'] = 'id,cash,seller_id';
+        //$set['group'] = 'cash';
+        //$set['col'] = 'sum(cash)';
+        //$info = Dever::db('order_log1', 'seller')->count($where, $set);
+        //print_r($info);die;
+        $order = Dever::db('order', 'seller')->load([]);
         foreach ($order as $k => $v) {
             //$v['cdate'] = time();
-            Dever::db('order_log1', 'seller')->insert($v);
+            //unset($v['id']);
+            $id = Dever::db('order_log1', 'seller')->insert($v);
+            //print_r($id);die;
+        }
+        $this->test();
+    }
+
+    # 历史数据整理
+    public function history_order()
+    {
+        $order = Dever::db('order', 'seller')->load([]);
+        foreach ($order as $k => $v) {
+            $order_log = Dever::db('order_log1', 'seller')->find(array('order_num' => $v['order_num']));
+            if (!$order_log) {
+                Dever::db('order_log1', 'seller')->insert($v);
+            }
+        }
+    }
+    public function history()
+    {
+        $order = Dever::db('log', 'seller')->load([]);
+        foreach ($order as $k => $v) {
+            $log = Dever::db('log1', 'seller')->find(array('sid' => $v['id']));
+            if (!$log) {
+                $v['sid'] = $v['id'];
+                unset($v['id']);
+                Dever::db('log1', 'seller')->insert($v);
+            }
         }
-        //$this->test();
     }
 }

+ 1 - 0
src/dai/seller/lib/Info.php

@@ -30,6 +30,7 @@ class Info
         //$data['yue'] = $this->yue($seller_id) - $cash;
         //Dever::db('log', 'seller')->up($where, $data);
         Dever::db('log', 'seller')->insert($data);
+        Dever::db('log1', 'seller')->insert($data);
     }
 
     # 获取余额

+ 5 - 0
src/dai/seller/lib/Order.php

@@ -258,6 +258,11 @@ class Order
         if (!$order_log) {
             Dever::db('order_log', 'seller')->insert($info);
         }
+
+        $order_log = Dever::db('order_log1', 'seller')->find(array('order_num' => $info['order_num']));
+        if (!$order_log) {
+            Dever::db('order_log1', 'seller')->insert($info);
+        }
     }
 
     # 扣费

+ 4 - 0
src/dai/seller/table/log1.php

@@ -0,0 +1,4 @@
+<?php
+$config = include('log.php');
+$config['store'] = 'log1';
+return $config;

+ 2 - 1
src/dai/seller/table/manage/order_log_list.php

@@ -3,7 +3,8 @@ $status = Dever::input('search')['status'] ?? array('>=', 10);
 return array
 (
     //'source' => 'seller/order_log',
-    'source' => 'seller/order_bak',
+    //'source' => 'seller/order_bak',
+    'source' => 'seller/order_log1',
     'list' => array
     (
         //'expand' => 'seller/manage.showOrderExpand',