Commit be8f4c58 authored by jianghaiming's avatar jianghaiming

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

parents 7f9d72e0 3a4b631b
...@@ -826,11 +826,16 @@ class MarketingService ...@@ -826,11 +826,16 @@ class MarketingService
} }
} }
$marketingGoods = []; $marketingGoods = [];
foreach ($skuInfoList as $key => $skuInfo) { $tempSkuInfoList = array_column($skuInfoList, null, "goods_sku_id");
$marketingGoods[$key]["goods_spu_id"] = $skuInfo["goods_spu_id"]; foreach ($goodsSkuId as $key => $skuId) {
$marketingGoods[$key]["goods_sku_id"] = $skuInfo["goods_sku_id"]; if (empty($tempSkuInfoList[$skuId]["goods_spu_id"])) {
continue;
}
$marketingGoods[$key]["goods_spu_id"] = $tempSkuInfoList[$skuId]["goods_spu_id"];
$marketingGoods[$key]["goods_sku_id"] = $skuId;
$marketingGoods[$key]["marketing_id"] = $marketingId; $marketingGoods[$key]["marketing_id"] = $marketingId;
} }
MarketingGoods::save($marketingGoods); MarketingGoods::save($marketingGoods);
//自提点 //自提点
...@@ -989,10 +994,9 @@ class MarketingService ...@@ -989,10 +994,9 @@ class MarketingService
$pindanMarketing = MarketingPindan::getRecord(['marketing_id' => $params['marketing_id']]); $pindanMarketing = MarketingPindan::getRecord(['marketing_id' => $params['marketing_id']]);
$lifeAccountList = CommonService::getlifeAccountList(['life_account_id' => [$pindanMarketing["publish_life_account_id"]]]); $lifeAccountList = CommonService::getlifeAccountList(['life_account_id' => [$pindanMarketing["publish_life_account_id"]]]);
$goodsSkuList = MarketingGoods::marketingGoodsList(['marketing_id' => $params['marketing_id']]); $marketingGoodsList = MarketingGoods::marketingGoodsList(['marketing_id' => $params['marketing_id'], "ORDER" => ["id" => "ASC"]]);
if (!empty($marketingGoodsList)) {
if (!empty($goodsSkuList)) { $goodsSkuId = array_column($marketingGoodsList , 'goods_sku_id');
$goodsSkuId = array_column($goodsSkuList , 'goods_sku_id');
$goodsSkuList = PindanGoodsSku::select('*', ['goods_sku_id' => $goodsSkuId]); $goodsSkuList = PindanGoodsSku::select('*', ['goods_sku_id' => $goodsSkuId]);
} }
empty($goodsSkuList) && $goodsSkuList = []; empty($goodsSkuList) && $goodsSkuList = [];
...@@ -1046,7 +1050,14 @@ class MarketingService ...@@ -1046,7 +1050,14 @@ class MarketingService
$otasData[$item["ota_id"]] = $item; $otasData[$item["ota_id"]] = $item;
} }
foreach ($goodsSkuList as $key => $item) { //这里是为了排序,按查 marketing_goods 出来的顺序排序
$tempGoodsSkuList = array_column($goodsSkuList, null, "goods_sku_id");
foreach ($marketingGoodsList as $key => $value) {
if (empty($tempGoodsSkuList[$value["goods_sku_id"]])) {
continue;
}
$item = $tempGoodsSkuList[$value["goods_sku_id"]];
$goodsSkuList[$key] = $item;
$goodsSkuList[$key]["desc_pic_url_list"] = GoodsService::getUrlList($item["desc_pic_url"]); $goodsSkuList[$key]["desc_pic_url_list"] = GoodsService::getUrlList($item["desc_pic_url"]);
$goodsSkuList[$key]["ota_name"] = empty($otasData[$item["ota_id"]]["ota_name"]) ? "" : $otasData[$item["ota_id"]]["ota_name"]; $goodsSkuList[$key]["ota_name"] = empty($otasData[$item["ota_id"]]["ota_name"]) ? "" : $otasData[$item["ota_id"]]["ota_name"];
$goodsSkuList[$key]["original_price"] = empty($item["original_price"]) ? '' : sprintf("%.2f", (int)$item["original_price"] / 100); $goodsSkuList[$key]["original_price"] = empty($item["original_price"]) ? '' : sprintf("%.2f", (int)$item["original_price"] / 100);
...@@ -1065,6 +1076,14 @@ class MarketingService ...@@ -1065,6 +1076,14 @@ class MarketingService
$goodsSkuList[$key]["all_have_buy_goods_count"] = $allHaveBuyGoodsStatistics[$item["goods_sku_id"]]; $goodsSkuList[$key]["all_have_buy_goods_count"] = $allHaveBuyGoodsStatistics[$item["goods_sku_id"]];
} }
} }
foreach ($goodsSkuList as $key => $item) {
if ($item["inventory_rest"] == 0) {
unset($goodsSkuList[$key]);
array_push($goodsSkuList, $item);
}
}
$goodsSkuList = array_values($goodsSkuList);
} }
$takePlaceIds = MarketingTakePlace::getRecords(["marketing_id" => $marketingData["id"]], ["take_place_id"]); $takePlaceIds = MarketingTakePlace::getRecords(["marketing_id" => $marketingData["id"]], ["take_place_id"]);
......
...@@ -8,6 +8,7 @@ use Api\PhpServices\Daemon\DaemonServiceInterface; ...@@ -8,6 +8,7 @@ use Api\PhpServices\Daemon\DaemonServiceInterface;
use Api\PhpUtils\Log\DaemonLog; use Api\PhpUtils\Log\DaemonLog;
use App\Models\marketing\mysql\Marketing; use App\Models\marketing\mysql\Marketing;
use Api\PhpServices\Wechat\Msg; use Api\PhpServices\Wechat\Msg;
use App\Models\marketing\mysql\MarketingPindan;
class Pindan implements DaemonServiceInterface class Pindan implements DaemonServiceInterface
{ {
...@@ -31,12 +32,9 @@ class Pindan implements DaemonServiceInterface ...@@ -31,12 +32,9 @@ class Pindan implements DaemonServiceInterface
$where["start_time[>]"] = $lastStartTime; $where["start_time[>]"] = $lastStartTime;
$where["end_time[>=]"] = $now; $where["end_time[>=]"] = $now;
$where['ORDER'] = ["update_time" => "DESC"]; $where['ORDER'] = ["update_time" => "DESC"];
$where['LIMIT'] = [0, 1]; $marketing = Marketing::get(['marketing_id','marketing_name','start_time'], $where);
$list = Marketing::select(["marketing_id", "marketing_name", "marketing_type","start_time", "end_time",
"online_status", "update_time", "create_time"]
, $where);
if(empty($list)) { if(empty($marketing)) {
DaemonLog::info( DaemonLog::info(
'DaemonServiceInterface_pindan', 'DaemonServiceInterface_pindan',
'no need to send at'.date('Y-m-d H:i:s') 'no need to send at'.date('Y-m-d H:i:s')
...@@ -44,6 +42,7 @@ class Pindan implements DaemonServiceInterface ...@@ -44,6 +42,7 @@ class Pindan implements DaemonServiceInterface
sleep(60); sleep(60);
return false; return false;
} }
$pindan = MarketingPindan::get(["pindan_desc"], ["marketing_id" => $marketing["marketing_id"]]);
//给订阅用户发送消息 //给订阅用户发送消息
//http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=71667995 //http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=71667995
...@@ -53,10 +52,11 @@ class Pindan implements DaemonServiceInterface ...@@ -53,10 +52,11 @@ class Pindan implements DaemonServiceInterface
$type = 2; // 1 公众号 2 小程序 $type = 2; // 1 公众号 2 小程序
//活动信息 //活动信息
$params = [ $params = [
self::emojiFilter($list[0]['marketing_name']), self::emojiFilter($marketing['marketing_name']),
$list[0]['start_time'], $marketing['start_time'],
$list[0]['pindan_desc'] ?: self::DEFAULT_DESC $pindan['pindan_desc'] ?: self::DEFAULT_DESC
]; ];
//发送消息 //发送消息
DaemonLog::info( DaemonLog::info(
'DaemonServiceInterface_pindan', 'DaemonServiceInterface_pindan',
......
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