mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
75 lines
2.3 KiB
PHP
75 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Business\KuaiTuanTuan;
|
|
|
|
use App\Models\Groups as GroupsModel;
|
|
use App\Models\GroupGoods;
|
|
use App\Utils\DateTimeUtils;
|
|
|
|
class Groups
|
|
{
|
|
public static function createGroup($localGroupId)
|
|
{
|
|
$type = 'pdd.ktt.group.create';
|
|
$group = GroupsModel::query()->find($localGroupId);
|
|
$groupGoods = GroupGoods::query()
|
|
->where('group_id', $group->id)
|
|
->with(['goodsSku:id,stock'])
|
|
->orderBy('sort')
|
|
->get();
|
|
$goodsSkus = [];
|
|
foreach ($groupGoods as $item) {
|
|
$goodsSkus[] = [
|
|
'category_name' => $item['category_name'],
|
|
'goods_desc' => $item['goods_desc'] ?: $group['title'],
|
|
'goods_name' => $item['goods_name'],
|
|
'limit_buy' => $item['limit_buy'],
|
|
'market_price' => $item['market_price'],
|
|
'sku_list' => [[
|
|
'external_sku_id' => $item['external_sku_id'],
|
|
'price_in_fen' => $item['price_in_fen'] * 100,
|
|
'quantity_type' => 0,
|
|
'spec_id_list' => [],
|
|
'total_quantity' => $item['goodsSku']['stock'],
|
|
]]
|
|
];
|
|
}
|
|
$appendParams = [
|
|
'end_time' => $group->getOriginal('end_time'),
|
|
'goods_list' => json_encode($goodsSkus, 256),
|
|
'is_save_preview' => $group['is_save_preview'],
|
|
'start_time' => $group->getOriginal('start_time'),
|
|
'title' => $group['title'],
|
|
'isv_no' => $group['activity_no'] ?: '',
|
|
];
|
|
|
|
return [$type, $appendParams];
|
|
}
|
|
|
|
public static function queryGroupStatus($localGroupId)
|
|
{
|
|
$type = 'pdd.ktt.group.query.status';
|
|
$group = GroupsModel::query()->find($localGroupId);
|
|
$appendParams = [
|
|
'activity_no' => $group->activity_no
|
|
];
|
|
|
|
return [$type, $appendParams];
|
|
}
|
|
|
|
public static function queryGroup()
|
|
{
|
|
$type = 'pdd.ktt.group.query.list';
|
|
$time = DateTimeUtils::getMicroTime();
|
|
$appendParams = [
|
|
'end_update_time' => $time,
|
|
'page' => 1,
|
|
'size' => 10,
|
|
'start_update_time' => $time - 3600 * 24 * 6 * 1000
|
|
];
|
|
|
|
return [$type, $appendParams];
|
|
}
|
|
}
|
|
|