rabin 3 年之前
父節點
當前提交
a173436405
共有 1 個文件被更改,包括 31 次插入0 次删除
  1. 31 0
      service/agent/lib/Tool.php

+ 31 - 0
service/agent/lib/Tool.php

@@ -795,4 +795,35 @@ class Tool
         $file = '复购数据';
         return Dever::excelExport($body, $head, $file);
     }
+
+    # 导出商品
+    public function goods_api()
+    {
+        $data = Dever::db('agent/order')->fetchAll('select * from churen_goods_info where status = 1');
+
+        $start = Dever::maketime('2022-06-01 00:00:00');
+        $end = Dever::maketime('2022-06-30 23:59:59');
+
+        $head = array('月份', '商品');
+        $result = array();
+        if ($data) {
+            $yes = $no = 0;
+            $ybody = $nbody = array();
+            foreach ($data as $k => $v) {
+                $buy = Dever::db('shop/sell_order_goods')->find(array('goods_id' => $v['id']));
+                if ($buy && $buy['cdate'] >= $start && $buy <= $end) {
+                    $yes += 1;
+                } else {
+                    $no += 1;
+                }
+            }
+        }
+
+        $data = array(count($data), $yes, $no);
+
+        print_r($data);die;
+
+        $file = '商品';
+        return Dever::excelExport($body, $head, $file);
+    }
 }