Commit fe261c15 authored by luhongguang's avatar luhongguang

update:拼单商品list

parent d5d1e354
......@@ -116,11 +116,31 @@ class MarketingService
* @return array|mixed
*/
public static function marketingList($params)
{
$marketingType = !empty($params['marketing_type']) ? $params['marketing_type'] : Marketing::MARKETING_TYPE_FENXIAO;
if ($marketingType == Marketing::MARKETING_TYPE_FENXIAO) {
return self::fenxiaoMarketingList($params);
} else if ($marketingType == Marketing::MARKETING_TYPE_TUANGOU) {
return [];
} else if ($marketingType == Marketing::MARKETING_TYPE_MIAOSHA) {
return [];
} else if ($marketingType == Marketing::MARKETING_TYPE_PINDAN) {
return self::pindanMarketingList($params);
}
}
/**
* 分销活动列表
* @param $params
* @return array
*/
private static function fenxiaoMarketingList($params)
{
$params['page'] = !empty($params['page']) ? $params['page'] : 1;
$limit = !empty($params['page_size']) ? $params['page_size'] : 20;
$page = ($params['page'] - 1) * $limit;
$where["marketing_type"] = Marketing::MARKETING_TYPE_FENXIAO;
if (!empty($params['marketing_name'])) {
$where['marketing_name'] = $params['marketing_name'];
}
......@@ -135,7 +155,7 @@ class MarketingService
if (!empty($valu)) {
$where['online_status'][$key] = $valu;
}else{
$where['online_status'] = [1,2];
$where['online_status'] = [1,2];
break;
}
}
......@@ -153,11 +173,11 @@ class MarketingService
}else{
$marketingId = array_column($marketingGoodsList, 'marketing_id');
if (!empty($where['marketing_id'])) {
array_push($marketingId,$where['marketing_id']);
array_push($marketingId,$where['marketing_id']);
}
$where['marketing_id'] = $marketingId;
}
}
$where['ORDER'] = ["create_time" => "DESC"];
......@@ -165,9 +185,9 @@ class MarketingService
$list = Marketing::getRecords($where);
$lists = [];
foreach ($list as $key => $value) {
$lists[$key] = $value;
$lists[$key]['first_commission_value'] = !empty($value['first_commission_value']) ? $value['first_commission_value']/100 : 0;
$lists[$key]['second_commission_value'] = !empty($value['second_commission_value']) ? $value['second_commission_value']/100 : 0;
$lists[$key] = $value;
$lists[$key]['first_commission_value'] = !empty($value['first_commission_value']) ? $value['first_commission_value']/100 : 0;
$lists[$key]['second_commission_value'] = !empty($value['second_commission_value']) ? $value['second_commission_value']/100 : 0;
}
unset($where['LIMIT']);
unset($where['ORDER']);
......@@ -176,6 +196,39 @@ class MarketingService
return $data;
}
/**
* 拼单活动列表
* @param $params
* @return array
*/
private static function pindanMarketingList($params)
{
$params['page'] = !empty($params['page']) ? $params['page'] : 1;
$limit = !empty($params['page_size']) ? $params['page_size'] : 20;
$page = ($params['page'] - 1) * $limit;
$where["marketing_type"] = Marketing::MARKETING_TYPE_PINDAN;
if (!empty($params['marketing_name'])) {
$where['marketing_name'] = $params['marketing_name'];
}
if (!empty($params['online_status'])) {
$where['online_status'] = $params['online_status'];
}
$where['ORDER'] = ["create_time" => "DESC"];
$where['LIMIT'] = [$page, $limit];
$list = Marketing::select(["marketing_id", "marketing_name", "online_status", "update_time", "create_time"], $where);
$lists = [];
foreach ($list as $key => $value) {
$lists[$key] = $value;
}
unset($where['LIMIT']);
unset($where['ORDER']);
$count = Marketing::count("*", $where);
return ['result' => $lists,'count' => $count];
}
/**
* 创建活动
* @param $params
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment