dever 3 年之前
父节点
当前提交
31cbf3c52c
共有 2 个文件被更改,包括 19 次插入13 次删除
  1. 16 8
      app/mshop/src/My.php
  2. 3 5
      app/shop/lib/Info.php

+ 16 - 8
app/mshop/src/My.php

@@ -351,10 +351,16 @@ class My extends Core
         $this->data['config'] = Dever::db('main/manage_config')->find();
         $where['shop_id'] = $this->shop_id;
         $shop = Dever::db('shop/info')->find($this->shop_id);
+        $stat_type = Dever::db('cash/shop')->config['config_type'];
         $month = Dever::input('month');
         if ($month) {
-            $where['start'] = Dever::maketime($month . '-01 00:00:00');
-            $where['end'] = Dever::maketime($month . '-t 23:59:59');
+            Dever::setInput('day', $month);
+            if ($stat_type == 1) {
+                list($where['start'], $where['end']) = Dever::month();
+            } else {
+                list($where['start'], $where['end']) = Dever::week();
+            }
+            
         }
         
         $this->data['data'] = Dever::db('cash/shop')->getAll($where);
@@ -363,9 +369,9 @@ class My extends Core
 
         if ($this->data['data']) {
             foreach ($this->data['data'] as $k => $v) {
-                $this->data['data'][$k]['name'] = date('Y年m月', $v['month']);
-                $this->data['data'][$k]['start'] = date('Y-m-01', $v['month']);
-                $this->data['data'][$k]['end'] = date('Y-m-t', $v['month']);
+                $this->data['data'][$k]['name'] = Dever::load('cash/lib/set')->statDate($stat_type, $v['day']);
+                Dever::setInput('day', $v['day']);
+                list($this->data['data'][$k]['start'], $this->data['data'][$k]['end']) = Dever::month();
                 $this->data['data'][$k]['status_name'] = $status[$v['shop_status']];
             }
         }
@@ -399,15 +405,17 @@ class My extends Core
         $where['shop_id'] = $this->shop_id;
         $this->data['config'] = Dever::db('main/sell_config')->find();
         $this->data['info'] = Dever::db('cash/shop')->find($where);
+        $stat_type = Dever::db('cash/shop')->config['config_type'];
 
         if (!$this->data['info']) {
             Dever::alert('账单不存在');
         }
         $status = Dever::db('cash/shop')->config['config_status'];
 
-        $this->data['info']['name'] = date('Y年m月',  $this->data['info']['month']);
-        $this->data['info']['start'] = date('Y-m-01', $this->data['info']['month']);
-        $this->data['info']['end'] = date('Y-m-t', $this->data['info']['month']);
+
+        $this->data['info']['name'] = Dever::load('cash/lib/set')->statDate($stat_type, $this->data['info']['day']);
+        Dever::setInput('day', $this->data['info']['day']);
+        list($this->data['info']['start'], $this->data['info']['end']) = Dever::month();
         $this->data['info']['status_name'] = $type[$this->data['info']['shop_status']];
 
         $where = array();

+ 3 - 5
app/shop/lib/Info.php

@@ -247,11 +247,9 @@ class Info
             $where['sku_id'] = $sku_id;
         }
         
-        if ($check) {
-            $other = Dever::db('shop/goods_sku')->getData($where);
-            if (!$other) {
-                return false;
-            }
+        $other = Dever::db('shop/goods_sku')->getData($where);
+        if (!$other && $check) {
+            return false;
         }
         
         $data = Dever::load('goods/lib/info')->getInfo($info, $attr, array($other, array('total')));