返回批发价字段
This commit is contained in:
parent
c872994d00
commit
04474ac0e4
@ -2628,7 +2628,8 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
if ($money < $end[0]['price']) {
|
if ($money < $end[0]['price']) {
|
||||||
$list = $end;
|
$list = $end;
|
||||||
} else {
|
} else {
|
||||||
$list = array_merge($end, $end);//满足2条数据
|
$end[0]['num'] =2;
|
||||||
|
$list = $end;//满足2条数据
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//在1 或者 2区间
|
//在1 或者 2区间
|
||||||
@ -2636,7 +2637,9 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
$list = $this->findNearestPriceProductDg($deal, $minMoney, $range, $newArray, $money, $money);
|
$list = $this->findNearestPriceProductDg($deal, $minMoney, $range, $newArray, $money, $money);
|
||||||
|
|
||||||
}
|
}
|
||||||
$count = count($list);
|
|
||||||
|
// $count = array_sum(array_column($list, 'num')); //重复拿
|
||||||
|
$count = count($list);//计算数量的
|
||||||
return compact('count', 'list');
|
return compact('count', 'list');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -2646,6 +2649,26 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//合并数组相同value_id
|
||||||
|
public function mergeSameValueIds($array) {
|
||||||
|
$result = [];
|
||||||
|
foreach ($array as $item) {
|
||||||
|
// 如果$result中已经有相同的value_id,则增加num并移除旧数组中的项
|
||||||
|
if (isset($result[$item['value_id']])) {
|
||||||
|
$result[$item['value_id']]['num'] += $item['num'];
|
||||||
|
} else {
|
||||||
|
// 否则,直接添加到结果数组中
|
||||||
|
$result[$item['value_id']] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将键值数组转换回索引数组
|
||||||
|
return array_values($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getRangeNumber($price, $ranges = [[0, 100], [100, 500], [500, PHP_INT_MAX]])
|
public function getRangeNumber($price, $ranges = [[0, 100], [100, 500], [500, PHP_INT_MAX]])
|
||||||
{
|
{
|
||||||
@ -2707,6 +2730,9 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
$nearestProduct = $product;
|
$nearestProduct = $product;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if($nearestProduct){
|
||||||
|
$nearestProduct['num']=1;
|
||||||
|
}
|
||||||
|
|
||||||
return $nearestProduct;
|
return $nearestProduct;
|
||||||
}
|
}
|
||||||
@ -2729,7 +2755,7 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
$nearestProduct = $product;
|
$nearestProduct = $product;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$nearestProduct['num'] = 1;
|
||||||
$newArray[] = $nearestProduct;
|
$newArray[] = $nearestProduct;
|
||||||
$remarkId = $nearestProduct['value_id'];
|
$remarkId = $nearestProduct['value_id'];
|
||||||
$totalPrice = array_sum(array_column($newArray, 'price')); //本次全部的价格之和
|
$totalPrice = array_sum(array_column($newArray, 'price')); //本次全部的价格之和
|
||||||
|
@ -34,7 +34,7 @@ class SpuRepository extends BaseRepository
|
|||||||
{
|
{
|
||||||
public $dao;
|
public $dao;
|
||||||
public $merchantFiled = 'mer_id,mer_name,mer_avatar,is_trader,mer_info,mer_keyword,type_id';
|
public $merchantFiled = 'mer_id,mer_name,mer_avatar,is_trader,mer_info,mer_keyword,type_id';
|
||||||
public $productFiled = 'P.product_id,S.store_name,S.image,activity_id,S.keyword,S.price,S.mer_id,spu_id,S.status,store_info,brand_id,cate_id,unit_name,S.star,S.rank,S.sort,P.sales,S.product_type,rate,reply_count,extension_type,S.sys_labels,S.mer_labels,P.delivery_way,P.delivery_free,S.ot_price,svip_price_type,P.stock,mer_svip_status';
|
public $productFiled = 'P.product_id,S.store_name,S.image,activity_id,S.keyword,S.price,S.mer_id,spu_id,S.status,store_info,brand_id,cate_id,unit_name,S.star,S.rank,S.sort,P.sales,S.product_type,rate,reply_count,extension_type,S.sys_labels,S.mer_labels,P.delivery_way,P.delivery_free,S.ot_price,svip_price_type,P.stock,mer_svip_status,P.wholesale_price';
|
||||||
public function __construct(SpuDao $dao)
|
public function __construct(SpuDao $dao)
|
||||||
{
|
{
|
||||||
$this->dao = $dao;
|
$this->dao = $dao;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user