更新查询
This commit is contained in:
parent
2209bac2f0
commit
59f6928e3f
@ -153,7 +153,7 @@ class SpuRepository extends BaseRepository
|
|||||||
'product.attrValue',
|
'product.attrValue',
|
||||||
]);
|
]);
|
||||||
$productMake = app()->make(ProductRepository::class);
|
$productMake = app()->make(ProductRepository::class);
|
||||||
$count = $query->count();
|
$count = $query->fetchSql(false)->count();
|
||||||
$list = $query->page($page, $limit)->setOption('field', [])->field($this->productFiled)->select();
|
$list = $query->page($page, $limit)->setOption('field', [])->field($this->productFiled)->select();
|
||||||
$append = ['stop_time','svip_price','show_svip_info','is_svip_price'];
|
$append = ['stop_time','svip_price','show_svip_info','is_svip_price'];
|
||||||
if ($productMake->getUserIsPromoter($userInfo))
|
if ($productMake->getUserIsPromoter($userInfo))
|
||||||
@ -190,12 +190,12 @@ class SpuRepository extends BaseRepository
|
|||||||
// $where['product_id'] = $this->getSpuFromCache($where['mer_rand_id'], $page, $limit);
|
// $where['product_id'] = $this->getSpuFromCache($where['mer_rand_id'], $page, $limit);
|
||||||
// 查询
|
// 查询
|
||||||
$query = $this->dao->search($where);
|
$query = $this->dao->search($where);
|
||||||
$randPidList = $query->setOption('field', [])->field(['P.product_id'])->page(1)->limit(500)->column('P.product_id');
|
$randPidList = $query->setOption('field', [])->field(['P.product_id'])->fetchSql(false)->page(1)->limit(500)->column('P.product_id');
|
||||||
$randNum = count($randPidList);
|
$randNum = count($randPidList);
|
||||||
// 最多10条随机数据
|
// 最多10条随机数据
|
||||||
if ($randNum > 10) {
|
if ($randNum > 10) {
|
||||||
array_rand($randPidList, 10);
|
array_rand($randPidList, 10);
|
||||||
} else if ($randNum == 0) {
|
} elseif ($randNum > 0) {
|
||||||
array_rand($randPidList, $randNum);
|
array_rand($randPidList, $randNum);
|
||||||
} else {
|
} else {
|
||||||
$randPidList = [];
|
$randPidList = [];
|
||||||
|
@ -46,7 +46,8 @@ class CloudWarehouse extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$typeIdArray = Db::name('MerchantType')->whereNotIn('type_code', Merchant::TypeCode['TypeCloudWarehouse'] . ',' .Merchant::TypeCode['TypeSupplyChain'])->column('mer_type_id');
|
// 除了市级供应链都可以查询
|
||||||
|
$typeIdArray = Db::name('MerchantType')->whereNotIn('type_code', Merchant::TypeCode['TypeSupplyChain'])->column('mer_type_id');
|
||||||
$params = $this->request->params(['category_id', 'street_code', 'order', ['product_type', 0], 'keyword']);
|
$params = $this->request->params(['category_id', 'street_code', 'order', ['product_type', 0], 'keyword']);
|
||||||
$search = [
|
$search = [
|
||||||
'street_id' => $params['street_code'],
|
'street_id' => $params['street_code'],
|
||||||
|
@ -43,7 +43,7 @@ class StoreSpu extends BaseController
|
|||||||
{
|
{
|
||||||
[$page, $limit] = $this->getPage();
|
[$page, $limit] = $this->getPage();
|
||||||
// 除了市级供应链都可以查询
|
// 除了市级供应链都可以查询
|
||||||
$typeIdArray = Db::name('MerchantType')->whereNotIn('type_code', Merchant::TypeCode['TypeCloudWarehouse'] . ',' .Merchant::TypeCode['TypeSupplyChain'])->column('mer_type_id');
|
$typeIdArray = Db::name('MerchantType')->whereNotIn('type_code', (string)Merchant::TypeCode['TypeSupplyChain'])->column('mer_type_id');
|
||||||
$where = $this->request->params([
|
$where = $this->request->params([
|
||||||
'keyword',
|
'keyword',
|
||||||
'cate_id',
|
'cate_id',
|
||||||
@ -143,7 +143,7 @@ class StoreSpu extends BaseController
|
|||||||
]);
|
]);
|
||||||
if ($where['action']) unset($where['product_type']);
|
if ($where['action']) unset($where['product_type']);
|
||||||
$currentMerchant = Db::name('merchant')->where('mer_id',$id)->field('category_id,street_id')->find();
|
$currentMerchant = Db::name('merchant')->where('mer_id',$id)->field('category_id,street_id')->find();
|
||||||
$typeIdArray = Db::name('MerchantType')->whereNotIn('type_code', Merchant::TypeCode['TypeCloudWarehouse'] . ',' .Merchant::TypeCode['TypeSupplyChain'])->column('mer_type_id');
|
$typeIdArray = Db::name('MerchantType')->whereIn('type_code', (string)Merchant::TypeCode['TypeTownSupplyChain'])->column('mer_type_id');
|
||||||
|
|
||||||
$merIdArray = Db::name('merchant')
|
$merIdArray = Db::name('merchant')
|
||||||
->where('street_id',$currentMerchant['street_id'])
|
->where('street_id',$currentMerchant['street_id'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user