multi-store/app/api/controller/product/ProductController.php

41 lines
1.0 KiB
PHP

<?php
namespace app\api\controller\product;
use app\api\controller\BaseApiController;
use app\api\lists\product\ProductLists;
use app\api\lists\product\StoreProductLists;
use app\common\model\system_store\SystemStoreStaff;
class ProductController extends BaseApiController{
public $notNeedLogin = ['lists'];
/**
* 商品列表
*/
public function lists(){
return $this->dataLists(new ProductLists());
}
/**
* 商品列表
*/
public function mer_list(){
$this->request->__set('store_id',$this->request->userInfo['store_id']??0);
return $this->dataLists(new ProductLists());
}
/**
* 商品列表
*/
public function store_lists(){
$store_id=SystemStoreStaff::where('uid',$this->userId)->where('is_admin',1)->value('store_id');
if($store_id>0){
$this->request->__set('store_id',$store_id);
return $this->dataLists(new StoreProductLists());
}else{
return $this->data(['lists'=>[]]);
}
}
}