rabin 2 years ago
parent
commit
5ba36d878e
2 changed files with 6 additions and 4 deletions
  1. 1 1
      service/bill/database/goods_stat.php
  2. 5 3
      service/bill/lib/Cron.php

+ 1 - 1
service/bill/database/goods_stat.php

@@ -233,7 +233,7 @@ return array
             'type' => 'all',
             'order' => array('day' => 'desc', 'cdate' => 'desc'),
             'group' => '(case when type = 2 then concat_ws("_", type, type_id) else concat_ws("_", type, type_id, sku_id) end)',
-            'col' => '*,sum(total_num) as total_num, sum(sell_num) as sell_num, sum(cash) as cash',
+            'col' => '*,sum(total_num) as total_num, sum(sell_num) as sell_num, sum(cash) as cash,sum(sell_nonum) as sell_nonum,sum(price) as price',
         ),
     ),
 );

+ 5 - 3
service/bill/lib/Cron.php

@@ -74,7 +74,7 @@ class Cron
     # 权益使用情况统计:类型、商品名、总发放数量、总使用数量
     public function goods_api()
     {
-        $num = Dever::input('num', 1);
+        $num = Dever::input('num', 5);
         $start = Dever::input('start', date('Y-m-d', strtotime('-'.$num.' day')));
         $end = Dever::input('end', date('Y-m-d'));
 
@@ -84,9 +84,9 @@ class Cron
 
         for($i=0; $i<=$day; $i++) {
             $where['start'] = $start + 86400*$i;
-            //$where['end'] = $start + 86400*$i + 86399;
+            $where['end'] = $start + 86400*$i + 86399;
             $goods = Dever::db('agent/member_goods')->findAll($where);
-            $dh_order = Dever::db('agent/dh_order')->getDhNum(array('status'=>3,'start'=>$where['start'],'state'=>1));
+            $dh_order = Dever::db('agent/dh_order')->getDhNum(array('status'=>3,'start'=>$where['start'],'end'=>$where['end'],'state'=>1));
             // print_R($dh_order);die;
             if ($goods) {
                 foreach ($goods as $k => $v) {
@@ -113,6 +113,8 @@ class Cron
                 }
             }
         }
+
+        return 'ok';
     }
 
     # 区域分润