|
|
@ -27,84 +27,14 @@ class ActivityService implements ActivityServiceInterface |
|
|
public function allForAppletIndex($type, $marketId) |
|
|
public function allForAppletIndex($type, $marketId) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
return GoodsActivity::query() |
|
|
|
|
|
->where(['type' => $type, 'market_id' => $marketId]) |
|
|
|
|
|
->addSelect('sales as total_sales') |
|
|
|
|
|
->get()->toArray(); |
|
|
|
|
|
|
|
|
|
|
|
return [ |
|
|
|
|
|
'type' => ActivityType::FLASH_SALE, |
|
|
|
|
|
'goods' => [ |
|
|
|
|
|
[ |
|
|
|
|
|
'id' => 1, |
|
|
|
|
|
'store_id' => 111, |
|
|
|
|
|
'cover_img' => config('alioss.img_host').'/attachment/types/c9b656181bbbc463624ca3803c5be7539f2fd62253f9a-cwVLri.png', |
|
|
|
|
|
'name' => '【优质】大白菜', |
|
|
|
|
|
'spec' => [ |
|
|
|
|
|
['key' => '净含量', 'value' => '500g'] |
|
|
|
|
|
], |
|
|
|
|
|
'original_price' => 50.5, |
|
|
|
|
|
'price' => 25.25, |
|
|
|
|
|
'inventory' => 0, |
|
|
|
|
|
'month_sales' => 20, |
|
|
|
|
|
'total_sales' => 20, |
|
|
|
|
|
'cart_num' => 0, |
|
|
|
|
|
'is_effective' => 1, |
|
|
|
|
|
'noneffective_note' => '已抢光', |
|
|
|
|
|
'total_seconds' => $seconds, |
|
|
|
|
|
],[ |
|
|
|
|
|
'id' => 1, |
|
|
|
|
|
'store_id' => 111, |
|
|
|
|
|
'cover_img' => config('alioss.img_host').'/attachment/types/c9b656181bbbc463624ca3803c5be7539f2fd62253f9a-cwVLri.png', |
|
|
|
|
|
'name' => '【优质】大白菜', |
|
|
|
|
|
'spec' => [ |
|
|
|
|
|
['key' => '净含量', 'value' => '500g'] |
|
|
|
|
|
], |
|
|
|
|
|
'original_price' => 50.5, |
|
|
|
|
|
'price' => 25.25, |
|
|
|
|
|
'inventory' => 0, |
|
|
|
|
|
'month_sales' => 20, |
|
|
|
|
|
'total_sales' => 20, |
|
|
|
|
|
'cart_num' => 0, |
|
|
|
|
|
'is_effective' => 1, |
|
|
|
|
|
'noneffective_note' => '已抢光', |
|
|
|
|
|
'total_seconds' => $seconds, |
|
|
|
|
|
],[ |
|
|
|
|
|
'id' => 1, |
|
|
|
|
|
'store_id' => 111, |
|
|
|
|
|
'cover_img' => config('alioss.img_host').'/attachment/types/c9b656181bbbc463624ca3803c5be7539f2fd62253f9a-cwVLri.png', |
|
|
|
|
|
'name' => '【优质】大白菜', |
|
|
|
|
|
'spec' => [ |
|
|
|
|
|
['key' => '净含量', 'value' => '500g'] |
|
|
|
|
|
], |
|
|
|
|
|
'original_price' => 50.5, |
|
|
|
|
|
'price' => 25.25, |
|
|
|
|
|
'inventory' => 0, |
|
|
|
|
|
'month_sales' => 20, |
|
|
|
|
|
'total_sales' => 20, |
|
|
|
|
|
'cart_num' => 0, |
|
|
|
|
|
'is_effective' => 1, |
|
|
|
|
|
'noneffective_note' => '已抢光', |
|
|
|
|
|
'total_seconds' => $seconds, |
|
|
|
|
|
],[ |
|
|
|
|
|
'id' => 1, |
|
|
|
|
|
'store_id' => 111, |
|
|
|
|
|
'cover_img' => config('alioss.img_host').'/attachment/types/c9b656181bbbc463624ca3803c5be7539f2fd62253f9a-cwVLri.png', |
|
|
|
|
|
'name' => '【优质】大白菜', |
|
|
|
|
|
'spec' => [ |
|
|
|
|
|
['key' => '净含量', 'value' => '500g'] |
|
|
|
|
|
], |
|
|
|
|
|
'original_price' => 50.5, |
|
|
|
|
|
'price' => 25.25, |
|
|
|
|
|
'inventory' => 0, |
|
|
|
|
|
'month_sales' => 20, |
|
|
|
|
|
'total_sales' => 20, |
|
|
|
|
|
'cart_num' => 0, |
|
|
|
|
|
'is_effective' => 1, |
|
|
|
|
|
'noneffective_note' => '已抢光', |
|
|
|
|
|
'total_seconds' => $seconds, |
|
|
|
|
|
], |
|
|
|
|
|
] |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
$builder = GoodsActivity::query() |
|
|
|
|
|
->select(['*']) |
|
|
|
|
|
->where(['type' => $type]) |
|
|
|
|
|
->addSelect('sales as total_sales'); |
|
|
|
|
|
|
|
|
|
|
|
if ($marketId) { |
|
|
|
|
|
$builder->where(['market_id' => $marketId]); |
|
|
|
|
|
} |
|
|
|
|
|
return $builder->get()->toArray(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |