Commit c24d4e1c authored by suntengda's avatar suntengda

Merge branch 'pindan_activity_list_optimize' into develop

parents a88625ee e68ce8cc
......@@ -183,6 +183,7 @@ class MarketingController extends Base
}
/**
* 正在进行和未开始的拼单活动列表
* @throws \App\Exception\custom\InterfaceException
*/
public function pindan_active_and_ready_listAction()
......
......@@ -5,7 +5,6 @@ namespace App\Services\marketing;
use Api\PhpServices\Ksy\Ks3Api;
use Api\PhpUtils\Http\Request;
use Api\PhpUtils\Http\HttpUtil;
use App\Exception\BaseException;
use App\Exception\custom\InterfaceException;
......@@ -472,18 +471,19 @@ class MarketingService
}
/**
* 获取已结束的
* 获取已结束的拼单活动列表
* @param int $page
* @param int $pageSize
* @param bool $useCache
* @return array|mixed
*/
public static function getPindanEndList($page=1,$pageSize=10,$useCache=true){
try{
$redis = RedisUtil::getInstance('cache',['serializer'=>'none']);
$key = "tuancan_end_list_".$page.'_'.$pageSize.'_'.date('Ymd');
// $list['end'] = $useCache ? $redis->get($key) : [];
$list = $useCache ? $redis->get($key) : [];
if(empty($list['end'])) {
if(empty($list)) {
//已结束的 按结束时间倒序
$params['page'] = $page;
$params['page_size'] = $pageSize;
......@@ -494,21 +494,21 @@ class MarketingService
$params['need_buy_num'] = false;
$params['online_status'] = [Marketing::ONLINE_STATUS_QIDONG, Marketing::ONLINE_STATUS_GUANBI, Marketing::ONLINE_STATUS_DAOQI];//状态 , 1启用,2关闭,3 到期
$params['activity_status'] = MarketingPindan::ACTIVITY_STATUS_FINISHED;//1 未开始,2进行中,3已结束, 4当日上新(即将开始)
$list['end'] = MarketingService::marketingList($params)['result'];
$list['end'] = $list['end'] ? array_column($list['end'], null, 'marketing_id') : [];
$list = MarketingService::marketingList($params)['result'];
$list = $list ? array_column($list, null, 'marketing_id') : [];
$marketingIdsEnd = array_keys($list['end']);
$list = self::_fillSkuAndOrderInfo($marketingIdsEnd,$list);
$marketingIdsEnd = array_keys($list);
$list = self::_fillSkuAndOrderInfo($marketingIdsEnd,['end'=>$list]);
$redis->set($key,json_encode($list['end']),['ex'=>86400]);//已结束列表 缓存一天
$redis->set($key,json_encode($list),['ex'=>86400]);//已结束列表 缓存一天
}else {
$list['end'] = json_decode($list['end'], true);
$list = json_decode($list, true);
}
}catch (\Exception $e) {
FileLog::error("获取团餐已结束列表异常", $e->getMessage(), $e, 'suntengda@yidian-inc.com');
}
return $list['end'] ?? [];
return $list ?? [];
}
/**
......@@ -1129,6 +1129,24 @@ class MarketingService
Marketing::updateRecord($marketingParams, ["marketing_id" => $marketingId, "marketing_type" => $marketingType]);
}
/**
* 切换活动状态
* @param $marketingId
* @param $onlineStatus
* @return \Api\PhpUtils\Mysql\MysqlBase
*/
public static function toogleOnlineStatus($marketingId,$onlineStatus)
{
if(!in_array($onlineStatus,array_keys(Marketing::$onlineStatusDesc))) {
return 0;
}
$data = [
'online_status' => $onlineStatus,
];
return Marketing::updateRecord($data, ["marketing_id" => $marketingId]);
}
/**
* 分销活动详情
* @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