Commit ce27e9dc authored by suntengda's avatar suntengda

update 拼单小程序活动列表新版接口 获取活动运营配置接口

parent 4ebddeaf
<?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
...@@ -1543,4 +1543,60 @@ class MarketingService ...@@ -1543,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
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