zhangguidong 2 年之前
父节点
当前提交
a73f378a2c
共有 2 个文件被更改,包括 54 次插入3 次删除
  1. 53 0
      app/data/controller/api/business/Goods.php
  2. 1 3
      config/apidoc.php

+ 53 - 0
app/data/controller/api/business/Goods.php

@@ -0,0 +1,53 @@
+<?php
+
+namespace app\data\controller\api\business;
+
+use app\data\model\ShopGoods;
+use think\admin\Controller;
+
+/**
+ * 商家商品数据接口
+ */
+class Goods extends Controller
+{
+    /**
+     * @Title ("我的商品数据")
+     * @Param ("name",desc="商品名称")
+     * @Param ("status",desc="1售卖中 0已下架 2已售罄 传空全部")
+     * @return void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function goods_list(){
+        $count = ['全部','售卖中','已下架','已售罄'];
+        foreach ($count as &$v){
+            switch ($v){
+                case '全部':
+                    $where =[];
+                    break;
+                case '售卖中':
+                    $where['status']=1;
+                    break;
+                case '已下架':
+                    $where['status']=0;
+                    break;
+                case '已售罄':
+                    $where['status']=2;
+            }
+            $v=ShopGoods::mk()->where('admin_id',10000)->where($where)->count();
+        }
+        $query = ShopGoods::mQuery()->like('name,cateids')->equal('code,status');
+        $result = $query->where('admin_id',10000)->order('id desc')->page(true, false, false, 10);
+        $data['count'] =$count;
+        $data['list']=$result;
+        $this->success('我的商品列表',$data);
+    }
+    /**
+     * @Title ("添加商品")
+     */
+    public function goods_add(){
+
+    }
+
+}

+ 1 - 3
config/apidoc.php

@@ -26,9 +26,7 @@ return [
                         \app\data\controller\api\Goods::class,
 
                         \app\data\controller\api\Order::class,
-
-
-//                        \app\data\controller\api\auth\Address::class,
+                        \app\data\controller\api\business\Goods::class,