Commit 3f6a1000 authored by luhongguang's avatar luhongguang

Merge branch 'develop' of https://git.yidian-inc.com:8021/bp/goods into develop

parents f9b3fa77 997b773d
......@@ -26,5 +26,6 @@ class MarketingException extends BaseException
12 => '勾选商品不能为空',
13 => '商品在其他互动已勾选',
14 => '开始时间不能大于等于结束时间',
15 => '分润比例不能大于50%',
];
}
\ No newline at end of file
......@@ -27,12 +27,33 @@ class MarketingService
$endTime = !empty($params['end_time']) ? $params['end_time'] : '';
$goodsSkuId = !empty($params['goods_sku_id']) ? $params['goods_sku_id'] : '';
$lifeAccountId = !empty($params['life_account_id']) ? $params['life_account_id'] : '';
if (empty($startTime)) {
throw new MarketingException(['cus'=>8]);
}
if (empty($endTime)) {
throw new MarketingException(['cus'=>9]);
}
// if ($startTime <= date("Y-m-d")) {
// throw new MarketingException(['cus'=>10]);
// }
if ($endTime <= date("Y-m-d")) {
throw new MarketingException(['cus'=>11]);
}
if ($startTime >= $endTime) {
throw new MarketingException(['cus'=>14]);
}
$goodsData = [
"OR" => [
"start_time[>=]" => $startTime,
"end_time[>=]" => $startTime,
],
'online_status' => 1,
];
//已存在的活动
......@@ -50,6 +71,7 @@ class MarketingService
$where = [
'online_status' => 1,
'rule_refund' => 2,
];
if (!empty($tmpGoodsSkuId)) {
......@@ -138,7 +160,7 @@ class MarketingService
unset($where['LIMIT']);
unset($where['ORDER']);
$count = Marketing::getCount($where);
$data = ['result' => $list,'count' => $count];
$data = ['result' => $lists,'count' => $count];
return $data;
}
......@@ -151,14 +173,18 @@ class MarketingService
public static function addMarketing($params){
$marketingName = !empty($params['marketing_name']) ? $params['marketing_name'] : '';
$firstCommissionRate = !empty($params['first_commission_value']) ? $params['first_commission_value']*100 : '';
$secondCommissionRate = !empty($params['second_commission_value']) ? $params['second_commission_value']*100 : '';
$firstCommissionRate = !empty($params['first_commission_value']) ? $params['first_commission_value']*100 : 0;
$secondCommissionRate = !empty($params['second_commission_value']) ? $params['second_commission_value']*100 : 0;
$createUserEmail = !empty($params['op_cur_user']) ? $params['op_cur_user'] : '';
$startTime = !empty($params['start_time']) ? $params['start_time'] : '';
$endTime = !empty($params['end_time']) ? $params['end_time'] : '';
$type = !empty($params['marketing_type']) ? $params['marketing_type'] : 1;
$goodsSkuId = !empty($params['goods_sku_id']) ? explode(",", $params['goods_sku_id']) : [];
$rate = $firstCommissionRate + $secondCommissionRate;
if ($rate > 5000) {
throw new MarketingException(['cus'=>15]);
}
if (empty($goodsSkuId)) {
throw new MarketingException(['cus'=>12]);
......@@ -188,15 +214,15 @@ class MarketingService
throw new MarketingException(['cus'=>9]);
}
if ($startTime <= date("Y-m-d")) {
throw new MarketingException(['cus'=>10]);
}
// if ($startTime <= date("Y-m-d")) {
// throw new MarketingException(['cus'=>10]);
// }
if ($endTime <= date("Y-m-d")) {
throw new MarketingException(['cus'=>11]);
}
if ($startTime >= $endTime) {
if ($startTime >= $endTime) {
throw new MarketingException(['cus'=>14]);
}
......
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