|
@@ -106,16 +106,16 @@ class StoreProductDao extends BaseDao
|
|
|
})->when(isset($where['ids']) && $where['ids'], function ($query) use ($where) {
|
|
})->when(isset($where['ids']) && $where['ids'], function ($query) use ($where) {
|
|
|
if (!isset($where['type'])) $query->where('id', 'in', $where['ids']);
|
|
if (!isset($where['type'])) $query->where('id', 'in', $where['ids']);
|
|
|
})->when(isset($where['not_ids']) && $where['not_ids'], function ($query) use ($where) {
|
|
})->when(isset($where['not_ids']) && $where['not_ids'], function ($query) use ($where) {
|
|
|
- $query->whereNotIn('id', $where['not_ids']);
|
|
|
|
|
- })->when(isset($where['pids']) && $where['pids'], function ($query) use ($where) {
|
|
|
|
|
- if ((isset($where['priceOrder']) && $where['priceOrder'] != '') || (isset($where['salesOrder']) && $where['salesOrder'] != '')) {
|
|
|
|
|
- $query->whereIn('pid', $where['pids']);
|
|
|
|
|
- } else {
|
|
|
|
|
- $query->whereIn('pid', $where['pids'])->orderField('pid', $where['pids'], 'asc');
|
|
|
|
|
- }
|
|
|
|
|
- })->when(isset($where['not_pids']) && $where['not_pids'], function ($query) use ($where) {
|
|
|
|
|
- $query->whereNotIn('pid', $where['not_pids']);
|
|
|
|
|
- })->count();
|
|
|
|
|
|
|
+ $query->whereNotIn('id', $where['not_ids']);
|
|
|
|
|
+ })->when(isset($where['pids']) && $where['pids'], function ($query) use ($where) {
|
|
|
|
|
+ if ((isset($where['priceOrder']) && $where['priceOrder'] != '') || (isset($where['salesOrder']) && $where['salesOrder'] != '')) {
|
|
|
|
|
+ $query->whereIn('pid', $where['pids']);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $query->whereIn('pid', $where['pids'])->orderField('pid', $where['pids'], 'asc');
|
|
|
|
|
+ }
|
|
|
|
|
+ })->when(isset($where['not_pids']) && $where['not_pids'], function ($query) use ($where) {
|
|
|
|
|
+ $query->whereNotIn('pid', $where['not_pids']);
|
|
|
|
|
+ })->count();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -244,6 +244,9 @@ class StoreProductDao extends BaseDao
|
|
|
if (is_array($where['use_min_price']) && count($where['use_min_price']) == 2) {
|
|
if (is_array($where['use_min_price']) && count($where['use_min_price']) == 2) {
|
|
|
$query->where('price', $where['use_min_price'][0] ?? '=', $where['use_min_price'][1] ?? 0);
|
|
$query->where('price', $where['use_min_price'][0] ?? '=', $where['use_min_price'][1] ?? 0);
|
|
|
}
|
|
}
|
|
|
|
|
+ })->when(isset($where['award']) && $where['award'] >= 0, function ($query) use ($where) {
|
|
|
|
|
+ if ($where['award']) $query->where('award_price', '>', 0);
|
|
|
|
|
+ if ($where['award']) $query->where('award_price', 0);
|
|
|
})->when(!$page && $limit, function ($query) use ($limit) {
|
|
})->when(!$page && $limit, function ($query) use ($limit) {
|
|
|
$query->limit($limit);
|
|
$query->limit($limit);
|
|
|
})->field($field)->select()->toArray();
|
|
})->field($field)->select()->toArray();
|
|
@@ -278,19 +281,19 @@ class StoreProductDao extends BaseDao
|
|
|
return $this->getModel()->whereIn('id', $ids)->field($field)->select()->toArray();
|
|
return $this->getModel()->whereIn('id', $ids)->field($field)->select()->toArray();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 获取推荐商品
|
|
|
|
|
- * @param array $where
|
|
|
|
|
- * @param array $field
|
|
|
|
|
- * @param int $num
|
|
|
|
|
- * @param int $page
|
|
|
|
|
- * @param int $limit
|
|
|
|
|
- * @param array $with
|
|
|
|
|
- * @return array
|
|
|
|
|
- * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
- * @throws \think\db\exception\DbException
|
|
|
|
|
- * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取推荐商品
|
|
|
|
|
+ * @param array $where
|
|
|
|
|
+ * @param array $field
|
|
|
|
|
+ * @param int $num
|
|
|
|
|
+ * @param int $page
|
|
|
|
|
+ * @param int $limit
|
|
|
|
|
+ * @param array $with
|
|
|
|
|
+ * @return array
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\DbException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ */
|
|
|
public function getRecommendProduct(array $where, array $field = ['*'], int $num = 0, int $page = 0, int $limit = 0, array $with = ['couponId', 'star'])
|
|
public function getRecommendProduct(array $where, array $field = ['*'], int $num = 0, int $page = 0, int $limit = 0, array $with = ['couponId', 'star'])
|
|
|
{
|
|
{
|
|
|
return $this->search($where)->field($field)
|
|
return $this->search($where)->field($field)
|
|
@@ -317,7 +320,7 @@ class StoreProductDao extends BaseDao
|
|
|
*/
|
|
*/
|
|
|
public function getProductCartList(array $where, int $page, int $limit, array $field = ['*'])
|
|
public function getProductCartList(array $where, int $page, int $limit, array $field = ['*'])
|
|
|
{
|
|
{
|
|
|
- $where['is_verify'] = 1;
|
|
|
|
|
|
|
+ $where['is_verify'] = 1;
|
|
|
$where['is_show'] = 1;
|
|
$where['is_show'] = 1;
|
|
|
$where['is_del'] = 0;
|
|
$where['is_del'] = 0;
|
|
|
return $this->search($where)->when($page, function ($query) use ($page, $limit) {
|
|
return $this->search($where)->when($page, function ($query) use ($page, $limit) {
|