From 758eb47a477b8617bde42e9af6ee3a78c2781520 Mon Sep 17 00:00:00 2001 From: Anyon Date: Thu, 10 Sep 2020 11:17:23 +0800 Subject: [PATCH] Create Goods.php --- app/data/controller/api/Goods.php | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 app/data/controller/api/Goods.php diff --git a/app/data/controller/api/Goods.php b/app/data/controller/api/Goods.php new file mode 100644 index 000000000..72760ff27 --- /dev/null +++ b/app/data/controller/api/Goods.php @@ -0,0 +1,49 @@ +success('获取商品分类数据成功', GoodsService::instance()->getCateList()); + } + + /** + * 获取标签数据 + */ + public function getMark() + { + $this->success('获取商品标签数据成功', GoodsService::instance()->getMarkList()); + } + + /** + * 获取商品数据 + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function getGoods() + { + $query = $this->_query('ShopGoods')->like('name')->equal('cate'); + $query->where(['deleted' => 0, 'status' => 1])->order('sort desc,id desc'); + $result = $query->page(true, false, false, 10); + // @todo 处理商品列表 + $this->success('获取商品数据成功', $result); + } + +} \ No newline at end of file