1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?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(){
- }
- }
|