|
@@ -905,7 +905,7 @@ class Good extends Base
|
|
|
'size' => 15
|
|
|
], 'post', 'trim');
|
|
|
|
|
|
- $where = [];
|
|
|
+ $where = $ladder_where = [];
|
|
|
|
|
|
if ($param['min_price'] && $param['max_price']) {
|
|
|
$skuCodes = Db::name('good_ladder')
|
|
@@ -914,6 +914,7 @@ class Good extends Base
|
|
|
->group('skuCode')
|
|
|
->column('skuCode');
|
|
|
$where[] = ['b.skuCode', 'in', $skuCodes];
|
|
|
+ $ladder_where[] = ['sale_price', 'between', [$param['min_price'], $param['max_price']]];
|
|
|
}
|
|
|
|
|
|
if ($param['is_stock'] != '') $where[] = ['a.is_stock', '=', $param['is_stock']];
|
|
@@ -940,10 +941,10 @@ class Good extends Base
|
|
|
|
|
|
$count = Db::name('good')
|
|
|
->alias("a")
|
|
|
- ->field("b.skuCode,b.platform_code,b.plat_code,b.id as good_id,a.*,b.addtime,b.updatetime,b.exam_status,gb.createrid purchase_id,gb.creater purchase,gl.min_num,gl.max_num")//成本表里的创建人,也是线上商品的采购人,为了防止混淆,给creater取个别名
|
|
|
+// ->field("b.skuCode,b.platform_code,b.plat_code,b.id as good_id,a.*,b.addtime,b.updatetime,b.exam_status,gb.createrid purchase_id,gb.creater purchase,gl.min_num,gl.max_num")//成本表里的创建人,也是线上商品的采购人,为了防止混淆,给creater取个别名
|
|
|
->leftJoin("good_platform b", "a.spuCode=b.spuCode")
|
|
|
->leftJoin("good_basic gb", "gb.spuCode=a.spuCode")
|
|
|
- ->leftJoin("good_ladder gl", "gl.skuCode=b.skuCode")
|
|
|
+// ->leftJoin("good_ladder gl", "gl.skuCode=b.skuCode")
|
|
|
->where($where)
|
|
|
->where('b.exam_status', '=', 6)//6表示上线成功
|
|
|
->order("b.addtime desc")
|
|
@@ -951,16 +952,18 @@ class Good extends Base
|
|
|
|
|
|
$list = Db::name('good')
|
|
|
->alias("a")
|
|
|
- ->field("b.skuCode,b.platform_code,b.plat_code,b.id as good_id,a.*,b.addtime,b.updatetime,b.exam_status,gb.createrid purchase_id,gb.creater purchase,gl.min_num,gl.max_num,gl.sale_price")//成本表里的创建人,也是线上商品的采购人,为了防止混淆,给creater取个别名
|
|
|
+ ->field("b.skuCode,b.platform_code,b.plat_code,b.id as good_id,a.*,b.addtime,b.updatetime,b.exam_status,gb.createrid purchase_id,gb.creater purchase")//成本表里的创建人,也是线上商品的采购人,为了防止混淆,给creater取个别名
|
|
|
->leftJoin("good_platform b", "a.spuCode=b.spuCode")
|
|
|
->leftJoin("good_basic gb", "gb.spuCode=a.spuCode")
|
|
|
- ->leftJoin("good_ladder gl", "gl.skuCode=b.skuCode")
|
|
|
+// ->leftJoin("good_ladder gl", "gl.skuCode=b.skuCode")
|
|
|
->page($param['page'], $param['size'])
|
|
|
->where($where)
|
|
|
->where('b.exam_status', '=', 6)//6表示上线成功
|
|
|
->order("b.addtime desc")
|
|
|
+// ->fetchSql()
|
|
|
->select()
|
|
|
->toArray();
|
|
|
+// halt($list);
|
|
|
|
|
|
//6.补充数据,照搬list方法
|
|
|
$data = [];
|
|
@@ -998,6 +1001,20 @@ class Good extends Base
|
|
|
}
|
|
|
$value['specinfo'] = $speclist;
|
|
|
$value['noble_name'] = isset($value['noble_metal']) && $value['noble_metal'] != 0 ? $this->noble[$value['noble_metal']] : "";
|
|
|
+
|
|
|
+ //补充阶梯数据
|
|
|
+ $ladder_info = Db::name('good_ladder')
|
|
|
+ ->field('min_num,max_num,sale_price')
|
|
|
+ ->where(['skuCode' => $value['skuCode']])
|
|
|
+ ->where($ladder_where)
|
|
|
+ ->order('min_num', 'asc')
|
|
|
+ ->find();
|
|
|
+
|
|
|
+ $value['min_num'] = isset($ladder_info['min_num']) ? $ladder_info['min_num'] : 0;
|
|
|
+ $value['max_num'] = isset($ladder_info['max_num']) ? $ladder_info['max_num'] : 0;
|
|
|
+ $value['sale_price'] = isset($ladder_info['sale_price']) ? $ladder_info['sale_price'] : 0;
|
|
|
+
|
|
|
+
|
|
|
$data[] = $value;
|
|
|
}
|
|
|
|