commit
6841ff5a11
@ -95,7 +95,8 @@ class CloudWarehouse extends BaseController
|
||||
* 云仓商品列表
|
||||
* @return mixed
|
||||
*/
|
||||
public function index($street_code,$page_num=1,$category_id=0){
|
||||
public function index($street_code, $page_num = 1, $category_id = 0)
|
||||
{
|
||||
if ($category_id == 0) {
|
||||
return app('json')->fail('分类id不能为0');
|
||||
}
|
||||
@ -123,4 +124,41 @@ class CloudWarehouse extends BaseController
|
||||
->select();
|
||||
return app('json')->success(['count' => $count, 'list' => $select]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定类型的云仓商品列表
|
||||
* @return mixed
|
||||
*/
|
||||
public function town()
|
||||
{
|
||||
// 除了市级供应链都可以查询
|
||||
$params = $this->request->params(['category_id', 'street_code', 'order', ['product_type', 0], 'keyword', 'page_num']);
|
||||
$search = [
|
||||
'street_id' => $params['street_code'],
|
||||
'type_id' => Merchant::TypeTownSupplyChain,
|
||||
'status' => 1,
|
||||
'is_del' => 0,
|
||||
'mer_state' => 1,
|
||||
];
|
||||
if (!empty($params['category_id'])) {
|
||||
$search['category_id'] = $params['category_id'];
|
||||
}
|
||||
$merchantIds = $this->merchantDao->search($search)->column('mer_id');
|
||||
[$page, $limit] = $this->getPage();
|
||||
if (isset($params['page_num']) && $params['page_num'] != '') {
|
||||
$page = $params['page_num'];
|
||||
}
|
||||
if (empty($merchantIds)) {
|
||||
return app('json')->success(['count' => 0, 'list' => []]);
|
||||
}
|
||||
|
||||
$where['entry_mer_id'] = 0;
|
||||
$where['keyword'] = $params['keyword'];
|
||||
$where['mer_ids'] = $merchantIds;
|
||||
$where['product_type'] = $params['product_type'];
|
||||
$where['is_gift_bag'] = 0;
|
||||
$where['order'] = $params['order'] ?: 'sort';
|
||||
$products = $this->spuRepository->getApiCloudSearch($where, $page, $limit, false);
|
||||
return app('json')->success($products);
|
||||
}
|
||||
}
|
@ -594,6 +594,7 @@ Route::group('api/', function () {
|
||||
Route::any('store/test', 'api.Test/test');
|
||||
Route::get('subscribe', 'api.Common/subscribe');
|
||||
Route::resource('store/product/cloudWarehouse', 'api.store.product.CloudWarehouse');
|
||||
Route::get('store/product/town_cloud', 'api.store.product.CloudWarehouse/town');
|
||||
})->middleware(UserTokenMiddleware::class, false);
|
||||
|
||||
//微信支付回调
|
||||
|
Loading…
x
Reference in New Issue
Block a user