Your Name 3 年之前
父节点
当前提交
155a244160
共有 2 个文件被更改,包括 39 次插入1 次删除
  1. 16 0
      app/shop/database/info.php
  2. 23 1
      service/bill/lib/Cron.php

+ 16 - 0
app/shop/database/info.php

@@ -854,6 +854,22 @@ return array
             'col' => 'id,id as value, name',
         ),
 
+        'getguiAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'type' => array('yes', '!='),
+                // 'town' => 'yes',
+                // 'area' => array('yes', 'like'),
+                'status' => 1,
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'id' => 'desc'),
+            'col' => 'id,id as value, name',
+        ),
+
         'getAllByType' => array
         (
             # 匹配的正则或函数 选填项

+ 23 - 1
service/bill/lib/Cron.php

@@ -502,7 +502,7 @@ class Cron
         $end_time = date('Y-m-d', strtotime($start_time. ' +1 month -1 day')).' 23:59:59';
         $start = Dever::maketime($start_time);
         $end = Dever::maketime($end_time);
-        $shops = Dever::db('shop/info')->getAll();
+        $shops = Dever::db('shop/info')->getguiAll(array('type'=>2));
         foreach ($shops as $k => $v) {
             $w = array('end' => $end,'new_shop_id'=> $v['id']);
             $member = Dever::db('agent/member_shop_log')->getAllByShop($w);
@@ -606,6 +606,27 @@ class Cron
                 }
                 
 
+                $res = Dever::db('bill/shop_stat')->find(array('month'=>$insert['month'],'shop_id'=>$v['id']));
+                if ($res) {
+                    $insert['where_id'] = $res['id'];
+                    Dever::db('bill/shop_stat')->update($insert);
+                } else {
+                    Dever::db('bill/shop_stat')->insert($insert);
+                }
+            } else {
+                $insert = array();
+                $insert['shop_id'] = $v['id'];
+                $insert['month'] = $start;
+                $insert['c_money'] = 0;
+                $insert['mids'] = '';
+                $insert['month_mids'] = array();
+                $insert['num'] = 0;
+                $insert['dl_num'] = 0;
+                $insert['v_num'] = 0;
+                $insert['ck_num'] = 0;
+                $insert['out_num'] = 0;
+                $insert['out_money'] = 0;
+                $insert['nei_money'] = 0;
                 $res = Dever::db('bill/shop_stat')->find(array('month'=>$insert['month'],'shop_id'=>$v['id']));
                 if ($res) {
                     $insert['where_id'] = $res['id'];
@@ -614,6 +635,7 @@ class Cron
                     Dever::db('bill/shop_stat')->insert($insert);
                 }
             }
+            
         }
 
 /*