修复市级供应链

This commit is contained in:
mkm 2023-11-15 16:09:14 +08:00
parent 80b0e6efd6
commit fd6b126cf4

View File

@ -8,14 +8,11 @@ use app\common\repositories\store\product\SpuRepository;
use think\facade\Db;
use think\App;
use crmeb\basic\BaseController;
use app\common\dao\store\product\SpuDao;
class CloudWarehouse extends BaseController
{
/**
* @var SpuRepository
*/
protected $repository;
/**
* @var MerchantDao
*/
@ -25,18 +22,20 @@ class CloudWarehouse extends BaseController
*/
protected $spuRepository;
protected $SpuDao;
/**
* StoreProduct constructor.
* @param App $app
* @param SpuRepository $repository
* @param MerchantDao $merchantDao
*/
public function __construct(App $app, SpuRepository $repository, MerchantDao $merchantDao, SpuRepository $spuRepository)
public function __construct(App $app, MerchantDao $merchantDao, SpuRepository $spuRepository,SpuDao $SpuDao)
{
parent::__construct($app);
$this->repository = $repository;
$this->merchantDao = $merchantDao;
$this->spuRepository = $spuRepository;
$this->SpuDao = $SpuDao;
$this->spuRepository->userInfo = $this->request->isLogin() ? $this->request->userInfo() : null;
}
@ -104,24 +103,20 @@ class CloudWarehouse extends BaseController
'status' => 1,
'is_del' => 0,
'mer_status' => 1,
'product_type'=>98,
'product_id'=>$cloud_product
];
if (!$cloud_product && $category_id==0) {
return app('json')->success(['count' => 0, 'list' => []]);
}
$count = Db::name('cloud_product')->where('street_code', $street_code)->where('status', 1)->count();
$select = Db::name('store_product')->whereIn('product_id', $cloud_product)->where($where)
->withAttr('merchant', function ($value, $data) {
$find= Db::name('merchant')->where('mer_id', $data['mer_id'])->field('mer_id,mer_name')->find();
return $find;
})
->withAttr('sku', function ($value, $data) {
$find = Db::name('store_product_attr_value')->where('mer_id', $data['mer_id'])->where('product_id', $data['product_id'])->find();
return ['' => $find];
})
// ->field('product_id,mer_id,store_name,bar_code,price,stock,product_type,image')
->select();
return app('json')->success(['count' => $count, 'list' => $select]);
$products = $this->spuRepository->getApiSearch($where,$page,10);
if($products['list']){
$list=$products['list'];
}
return app('json')->success(['count' => $count, 'list' => $list]);
}
/**