shop-php/app/controller/middle/StoreProduct.php
2023-12-05 13:30:10 +08:00

56 lines
1.6 KiB
PHP

<?php
namespace app\controller\middle;
use crmeb\basic\BaseController;
use think\App;
use app\common\repositories\store\product\ProductRepository;
use app\common\repositories\system\merchant\MerchantRepository;
/**
* Class Auth
* @package app\controller\api
* @author xaboy
* @day 2020-05-06
*/
class StoreProduct extends BaseController
{
protected $repository;
public function __construct(App $app, ProductRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
public function getStatusFilter()
{
return app('json')->success($this->repository->getFilter(null,'商品',0));
}
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['cate_id', 'keyword', ['type', 1], 'mer_cate_id', 'pid','store_name','is_trader','us_status','product_id','star','sys_labels','hot_type','svip_price_type']);
$mer_id = $this->request->param('mer_id','');
$merId = $mer_id ? $mer_id : null;
$where['is_gift_bag'] = 0;
$_where = $this->repository->switchType($where['type'], null,0);
unset($_where['product_type']);
unset($_where['star']);
$where = array_merge($where, $_where);
$data = $this->repository->getAdminList($merId, $where, $page, $limit);
$data['lists'] = $data['list'];
unset($data['list']);
return app('json')->success($data);
}
public function lists()
{
$make = app()->make(MerchantRepository::class);
$data = $make->selectWhere(['is_del' => 0],'mer_id,mer_name');
return app('json')->success($data);
}
}