Commit 8fc82418 authored by luhongguang's avatar luhongguang

update:拼单商品快照

parent e4cc04d1
...@@ -18,6 +18,7 @@ use \Validate\GoodsInitShopValidate; ...@@ -18,6 +18,7 @@ use \Validate\GoodsInitShopValidate;
use \App\Services\goods\ElasticGoodService; use \App\Services\goods\ElasticGoodService;
use \App\Services\goods\MarketingPindanGoodsService; use \App\Services\goods\MarketingPindanGoodsService;
use \App\Models\marketing\mysql\Marketing; use \App\Models\marketing\mysql\Marketing;
use \App\Services\goods\GoodsSnapshotsService;
class GoodsController extends Base class GoodsController extends Base
...@@ -302,4 +303,14 @@ class GoodsController extends Base ...@@ -302,4 +303,14 @@ class GoodsController extends Base
$res = GoodsService::refundGoods($params); $res = GoodsService::refundGoods($params);
$this->success(["result" => $res]); $this->success(["result" => $res]);
} }
/**
* 拼单商品快照批量获取
* @throws Exception
*/
public function pindan_goods_snapshotsAction()
{
$res = GoodsSnapshotsService::pindanGoodsSnapshots($this->params);
$this->success(["result" => $res]);
}
} }
\ No newline at end of file
<?php
namespace App\Services\goods;
use App\Models\goods\mysql\PindanGoodsSnapshot;
class GoodsSnapshotsService
{
/**
* 拼单商品快照批量获取
* @param $params
* @return array
*/
public static function pindanGoodsSnapshots($params)
{
$str = empty($params["snapshots_str"]) ? "" : $params["snapshots_str"];
$pindanGoodsSnapshot = [];
if (!empty($str)) {
$paramsArr = json_decode($str, true);
if (!empty($paramsArr)) {
foreach ($paramsArr as $param) {
if (isset($param["goods_sku_id"]) || isset($param["goods_version"])) {
$key = $param["goods_sku_id"]."_".$param["goods_version"];
$pindanGoodsSnapshot[$key] = PindanGoodsSnapshot::select("*", [
"goods_sku_id" => $param["goods_sku_id"],
"goods_version" => $param["goods_version"]
]);
}
}
}
}
return $pindanGoodsSnapshot;
}
}
\ No newline at end of file
...@@ -862,7 +862,7 @@ class MarketingService ...@@ -862,7 +862,7 @@ class MarketingService
foreach ($goodsSkuList as $key => $item) { foreach ($goodsSkuList as $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"] = $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"] = sprintf("%.2f", $item["original_price"] / 100); $goodsSkuList[$key]["original_price"] = sprintf("%.2f", $item["original_price"] / 100);
$goodsSkuList[$key]["price"] = sprintf("%.2f", $item["price"] / 100); $goodsSkuList[$key]["price"] = sprintf("%.2f", $item["price"] / 100);
} }
......
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