You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

110 lines
3.9 KiB

<?php
namespace App\Service\v3\Implementations;
use App\Constants\v3\ActivityType;
use App\Model\v3\GoodsActivity;
use App\Service\v3\Interfaces\ActivityServiceInterface;
class ActivityService implements ActivityServiceInterface
{
public function do()
{
// TODO: Implement do() method.
}
public function check()
{
// TODO: Implement check() method.
}
public function undo()
{
// TODO: Implement undo() method.
}
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,
],
]
];
}
}