更新
This commit is contained in:
parent
eedcccff1c
commit
8846b6b4a8
@ -30,7 +30,7 @@ class CloudWarehouse extends BaseController
|
||||
* @param SpuRepository $repository
|
||||
* @param MerchantDao $merchantDao
|
||||
*/
|
||||
public function __construct(App $app, MerchantDao $merchantDao, SpuRepository $spuRepository,SpuDao $SpuDao)
|
||||
public function __construct(App $app, MerchantDao $merchantDao, SpuRepository $spuRepository, SpuDao $SpuDao)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->merchantDao = $merchantDao;
|
||||
@ -43,28 +43,43 @@ class CloudWarehouse extends BaseController
|
||||
* type_id 13云仓商品列表
|
||||
* @return mixed
|
||||
*/
|
||||
public function index($street_code, $page = 1, $category_id = 0,$location='')
|
||||
public function index($street_code, $page = 1, $category_id = 0, $location = '')
|
||||
{
|
||||
$cloud_product = Db::name('cloud_product')
|
||||
->where('cate_id',$category_id)
|
||||
->where('street_code', $street_code)->where('status', 1)->page($page)->column('product_id');
|
||||
$cloud_product_arr = Db::name('cloud_product')
|
||||
->where('cate_id', $category_id)
|
||||
->whereOR('street_code', $street_code)->whereOR('mer_labels', ',6,')->where('status', 1)->page($page)->field('product_id,mer_labels')->select();
|
||||
$cloud_product = [];
|
||||
foreach ($cloud_product_arr as $key => $value) {
|
||||
$cloud_product[] = $value['product_id'];
|
||||
}
|
||||
$where = [
|
||||
'is_show' => 1,
|
||||
'is_used' => 1,
|
||||
'status' => 1,
|
||||
'is_del' => 0,
|
||||
'mer_status' => 1,
|
||||
'product_type'=>98,
|
||||
'product_id'=>$cloud_product
|
||||
'product_type' => 98,
|
||||
'product_id' => $cloud_product
|
||||
];
|
||||
if (!$cloud_product && $category_id==0) {
|
||||
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();
|
||||
|
||||
$products = $this->spuRepository->getApiSearch($where,$page,10, false,true);
|
||||
if($products['list']){
|
||||
$list=$products['list'];
|
||||
$count = Db::name('cloud_product')->whereOR('street_code', $street_code)->whereOR('mer_labels', ',6,')->where('status', 1)->count();
|
||||
|
||||
$products = $this->spuRepository->getApiSearch($where, $page, 10, false, true);
|
||||
if ($products['list']) {
|
||||
$list = $products['list'];
|
||||
foreach ($cloud_product_arr as $key => $value) {
|
||||
foreach ($list as $k => $v) {
|
||||
if ($value['product_id'] == $v['product_id']) {
|
||||
if ($value['mer_labels'] == ',6,') {
|
||||
$list[$k]['mer_labels_name'] = '五日达';
|
||||
} else {
|
||||
$list[$k]['mer_labels_name'] = '次日达';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return app('json')->success(['count' => $count, 'list' => $list]);
|
||||
}
|
||||
@ -75,10 +90,10 @@ class CloudWarehouse extends BaseController
|
||||
*/
|
||||
public function town()
|
||||
{
|
||||
$params = $this->request->params(['category_id', 'street_code', 'order', ['product_type', 0], 'keyword', 'page','cate_pid']);
|
||||
$params = $this->request->params(['category_id', 'street_code', 'order', ['product_type', 0], 'keyword', 'page', 'cate_pid']);
|
||||
$search = [
|
||||
'street_id' => $params['street_code'],
|
||||
'type_id' =>[Merchant::TypeStore,Merchant::TypeTownSupplyChain],
|
||||
'type_id' => [Merchant::TypeStore, Merchant::TypeTownSupplyChain],
|
||||
'status' => 1,
|
||||
'is_del' => 0,
|
||||
'mer_state' => 1,
|
||||
@ -101,10 +116,10 @@ class CloudWarehouse extends BaseController
|
||||
if (!empty($params['category_id'])) {
|
||||
$where['cate_id'] = $params['category_id'];
|
||||
}
|
||||
if($params['cate_pid']!=''){
|
||||
if ($params['cate_pid'] != '') {
|
||||
$where['cate_pid'] = $params['cate_pid'];
|
||||
}
|
||||
$products = $this->spuRepository->getApiSearch($where, $page, $limit, false,true);
|
||||
$products = $this->spuRepository->getApiSearch($where, $page, $limit, false, true);
|
||||
return app('json')->success($products);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user