Преглед изворни кода

Merge branch 'master' of http://git.dever.cc/dever-product/churen

Your Name пре 3 година
родитељ
комит
d3d47d4771
3 измењених фајлова са 68 додато и 4 уклоњено
  1. 2 2
      app/shop/database/buy_order.php
  2. 64 0
      app/shop/database/buy_order_goods.php
  3. 2 2
      app/shop/lib/Cron.php

+ 2 - 2
app/shop/database/buy_order.php

@@ -813,7 +813,7 @@ $config = array
                 'state' => 1,
             ),
             'type' => 'one',
-            'col' => 'sum(price+record_cash-refund_cash) as total',
+            'col' => 'sum(price+record_cash) as total',
         ),
 
         # 获取总金额
@@ -834,7 +834,7 @@ $config = array
                 'state' => 1,
             ),
             'type' => 'one',
-            'col' => 'sum(p_price-refund_p_cash) as total',
+            'col' => 'sum(p_price) as total',
         ),
 
         # 获取商品数量

+ 64 - 0
app/shop/database/buy_order_goods.php

@@ -241,5 +241,69 @@ return array
             'type' => 'one',
             'col' => 'id,sum(t_2.num) as total',
         ),
+
+        # 获取总金额
+        'getCashNum' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'start' => array('yes-t_2.cdate', '>='),
+                'end' => array('yes-t_2.cdate', '<='),
+                'start_o' => array('yes-t_2.operdate', '>='),
+                'end_o' => array('yes-t_2.operdate', '<='),
+                'type' => array('yes-t_2.type'),
+                'type_id' => array('yes-t_2.type_id'),
+                'source_type' => array('yes-t_2.source_type'),
+                'source_id' => array('yes-t_2.source_id'),
+                'status' => array('yes-t_2.status', 'in'),
+                'state' => array('yes-t_2.state', 1),
+                'state_1' => array('yes-t_1.state', 1),
+            ),
+            # 联表
+            'join' => array
+            (
+                array
+                (
+                    'table' => 'shop/buy_order',
+                    'type' => 'left join',
+                    'on' => array('order_id','id'),
+                ),
+            ),
+            'type' => 'one',
+            'col' => 'id,sum(t_1.price*t_1.num) as total',
+        ),
+
+        # 获取总金额
+        'getPCashNum' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'start' => array('yes-t_2.cdate', '>='),
+                'end' => array('yes-t_2.cdate', '<='),
+                'start_o' => array('yes-t_2.operdate', '>='),
+                'end_o' => array('yes-t_2.operdate', '<='),
+                'type' => array('yes-t_2.type'),
+                'type_id' => array('yes-t_2.type_id'),
+                'source_type' => array('yes-t_2.source_type'),
+                'source_id' => array('yes-t_2.source_id'),
+                'status' => array('yes-t_2.status', 'in'),
+                'state' => array('yes-t_2.state', 1),
+                'state_1' => array('yes-t_1.state', 1),
+            ),
+            # 联表
+            'join' => array
+            (
+                array
+                (
+                    'table' => 'shop/buy_order',
+                    'type' => 'left join',
+                    'on' => array('order_id','id'),
+                ),
+            ),
+            'type' => 'one',
+            'col' => 'id,sum(t_1.p_price*t_1.num) as total',
+        ),
     ),
 );

+ 2 - 2
app/shop/lib/Cron.php

@@ -316,9 +316,9 @@ class Cron
                 $data['shop_id'] = $v['id'];
                 $data['day'] = $where['start'];
                 $info = Dever::db('shop/buy_stat')->find($data);
-                $cash = Dever::db('shop/buy_order')->getCashNum($where);
+                $cash = Dever::db('shop/buy_order_goods')->getCashNum($where);
                 $data['cash'] = round($cash['total'], 2);
-                $cash = Dever::db('shop/buy_order')->getPCashNum($where);
+                $cash = Dever::db('shop/buy_order_goods')->getPCashNum($where);
                 $data['p_cash'] = round($cash['total'], 2);
 
                 $data['order'] = Dever::db('shop/buy_order')->getOrderNum($where);