Commit ac116b72 authored by jianghaiming's avatar jianghaiming

Merge branch 'test' of https://gitlab.yidian-inc.com/bp/goods into test

parents 127733f3 4458a654
<?php <?php
use App\Base\Base; use App\Base\Base;
use App\Models\marketing\mysql\Marketing;
use App\Services\marketing\MarketingService; use App\Services\marketing\MarketingService;
use App\Exception\custom\MarketingException; use App\Exception\custom\MarketingException;
use App\Services\marketing\MarketingGoodsService; use App\Services\marketing\MarketingGoodsService;
...@@ -256,4 +257,30 @@ class MarketingController extends Base ...@@ -256,4 +257,30 @@ class MarketingController extends Base
$res = $redis->set($key, $cvVersion); $res = $redis->set($key, $cvVersion);
$this->success(['result' => $res]); $this->success(['result' => $res]);
} }
public function get_operate_configAction()
{
$userId = $this->params['user_id'] ?? 0;
$res = MarketingService::getMarketingOperateConfig($userId);
$this->success(['result' => $res]);
}
/**
* 查询活动是否在线 1在线 0不在线
* @throws \App\Exception\custom\ParamException
*/
public function is_onlineAction()
{
(new MarketingInfoValidate())->validate();
$marketingId = $this->params['marketing_id'];
$status = MarketingService::getStatusByMarketingIds($marketingId);
if(isset($status[$marketingId]) && $status[$marketingId]['online_status'] == Marketing::ONLINE_STATUS_QIDONG) {
$result = 1;
}else {
$result = 0;
}
$this->success(['result' => $result]);
}
} }
\ No newline at end of file
...@@ -1406,10 +1406,7 @@ class MarketingService ...@@ -1406,10 +1406,7 @@ class MarketingService
$picIds = []; $picIds = [];
if(!empty($goodsSkuList)) { if(!empty($goodsSkuList)) {
foreach ($goodsSkuList as $index => $item) { $picIds = array_column($goodsSkuList,'desc_pic_url');
$item['desc_pic_url'] = explode(',',$item['desc_pic_url']) ?: [];
$picIds = array_merge($picIds,$item['desc_pic_url']);
}
$picUrl = Ks3Api::concurrencyPicEncryptUrl($picIds); $picUrl = Ks3Api::concurrencyPicEncryptUrl($picIds);
} }
} }
...@@ -1428,9 +1425,8 @@ class MarketingService ...@@ -1428,9 +1425,8 @@ class MarketingService
$item = $goodsSkuList[$value["goods_sku_id"]]; $item = $goodsSkuList[$value["goods_sku_id"]];
$list[$value['marketing_id']][$key]['goods_name'] = $item['goods_name']; $list[$value['marketing_id']][$key]['goods_name'] = $item['goods_name'];
foreach ($goodsSkuList[$value["goods_sku_id"]]['desc_pic_url'] as $picId) { $list[$value['marketing_id']][$key]["desc_pic_url_list"][] = $picUrl[$goodsSkuList[$value["goods_sku_id"]]['desc_pic_url']] ?? [];
$list[$value['marketing_id']][$key]["desc_pic_url_list"][] = $picUrl[$picId]; $list[$value['marketing_id']][$key]["desc_pic_url"] = $picUrl[$goodsSkuList[$value["goods_sku_id"]]['desc_pic_url']] ?? '';
}
$list[$value['marketing_id']][$key]["original_price"] = empty($item["original_price"]) ? '' : sprintf("%.2f", (int)$item["original_price"] / 100); $list[$value['marketing_id']][$key]["original_price"] = empty($item["original_price"]) ? '' : sprintf("%.2f", (int)$item["original_price"] / 100);
$list[$value['marketing_id']][$key]["price"] = sprintf("%.2f", $item["price"] / 100); $list[$value['marketing_id']][$key]["price"] = sprintf("%.2f", $item["price"] / 100);
$needSoldNum && $list[$value['marketing_id']][$key]["all_have_buy_goods_count"] = $soldNum[$value["goods_sku_id"]] ?? 0; $needSoldNum && $list[$value['marketing_id']][$key]["all_have_buy_goods_count"] = $soldNum[$value["goods_sku_id"]] ?? 0;
...@@ -1547,4 +1543,60 @@ class MarketingService ...@@ -1547,4 +1543,60 @@ class MarketingService
} }
return $data; return $data;
} }
//获取活动运营位配置-广场页
public static function getMarketingOperateConfig($userId)
{
//获取裂变和团长分销活动状态
$fissionMarketingId = config('marketing','fission_marketing_id');
$colonelMarketingId = config('marketing','colonel_marketing_id');
$marketingIds = [
$fissionMarketingId,$colonelMarketingId
];
$status = self::getStatusByMarketingIds($marketingIds);
if(isset($status[$fissionMarketingId]) && $status[$fissionMarketingId]['online_status'] == Marketing::ONLINE_STATUS_QIDONG) {
//裂变活动
$config[0] = ['text'=>'裂变活动','img'=>'https://si1.go2yd.com/get-image/0tzV7NKSaKT','link_url'=>'/pages/order/couponList?action=1'];
}
if(isset($status[$colonelMarketingId]) && $status[$colonelMarketingId]['online_status'] == Marketing::ONLINE_STATUS_QIDONG) {
//团长分销
$config[1] = ['text'=>'团长分销','img'=>'https://si1.go2yd.com/get-image/0tzV3wUuFXy'];
}
//查询用户申请团长分销的状态,填充团长分销跳转链接
$userId && $applyInfo = ColonelService::isApply($userId);
$applyStatus = $applyInfo['apply_status'] ?? -1; // -1.未申请 0.未审核 1.审核通过 2.审核未通过
//不同状态跳转不同链接
switch ($applyStatus) {
case 0:
case 2:
$config[1]['link_url'] = '/page-promo/promo/teamLeader/applySuccess';
break;
case 1:
$config[1]['link_url'] = '/page-promo/promo/index';
break;
case -1:
default:
$config[1]['link_url'] = '/page-promo/promo/teamLeader/apply';
break;
}
return $config;
}
/**
* 获取活动的在线状态
* @param $marketingIds
* @return array
*/
public static function getStatusByMarketingIds($marketingIds)
{
$marketingInfo = Marketing::select(['marketing_id','online_status'],['marketing_id' => $marketingIds]);
if(empty($marketingInfo)) {
return [];
}
return array_column($marketingInfo,null,'marketing_id');
}
} }
\ No newline at end of file
...@@ -36,6 +36,11 @@ class TakePlaceService ...@@ -36,6 +36,11 @@ class TakePlaceService
if ($lifeAccountId) { if ($lifeAccountId) {
$where['life_account_id'] = $lifeAccountId; $where['life_account_id'] = $lifeAccountId;
} }
//处理 tag_ids = ['0'] 的情况
if (count($tagIds) == 1 && $tagIds[0] == 0) {
$tagIds = 0;
}
if ($tagIds || $tagIds == 0) { if ($tagIds || $tagIds == 0) {
$where['tag_id'] = $tagIds; $where['tag_id'] = $tagIds;
} }
......
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