|
|
@@ -51,6 +51,7 @@ class ActivityLogic extends BaseLogic
|
|
|
array_multisort(array_column($res['activity_info']['block_data'], 'sort'), SORT_DESC, $res['activity_info']['block_data']);
|
|
|
foreach ($res['activity_info']['block_data'] as &$v){
|
|
|
array_multisort(array_column($v['goods'], 'recommend_weight'), SORT_DESC, $v['goods']);
|
|
|
+ $v['goods'] = self::groupArrays($v['goods']);
|
|
|
}
|
|
|
$res['coupons'] = CouponRules::with(['couponCategoryOne'])->where('property_activity_id',$params['property_activity_id'])
|
|
|
->select()
|
|
|
@@ -70,7 +71,15 @@ class ActivityLogic extends BaseLogic
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ public static function groupArrays($array) {
|
|
|
+ $result = []; $groupSize = 2;
|
|
|
+ $totalElements = count($array);
|
|
|
+ for ($i = 0; $i < $totalElements; $i += $groupSize)
|
|
|
+ { $end = min($i + $groupSize, $totalElements);
|
|
|
+ $result[] = array_slice($array, $i, $end - $i);
|
|
|
+ }
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
public static function createPropertyOrder($params,$serviceOrder){
|
|
|
try{
|
|
|
// 判断商品是否为 代理活动商品
|