Commit c35d0fc1 authored by luhongguang's avatar luhongguang

update:商品快照门店信息

parent 88983463
...@@ -367,7 +367,6 @@ class GoodsService ...@@ -367,7 +367,6 @@ class GoodsService
$operatorName = $params["user_name"]; $operatorName = $params["user_name"];
$goodsSpu = GoodsSpu::get("*", ["goods_spu_id" => $goodsSpuId]); $goodsSpu = GoodsSpu::get("*", ["goods_spu_id" => $goodsSpuId]);
//todo::权限判断 后台管理员
//权限判断 //权限判断
if (!empty($params["life_account_id"]) && $goodsSpu["life_account_id"] != $params["life_account_id"]) { if (!empty($params["life_account_id"]) && $goodsSpu["life_account_id"] != $params["life_account_id"]) {
throw new GoodsException(["cus" => 13]); throw new GoodsException(["cus" => 13]);
...@@ -426,7 +425,7 @@ class GoodsService ...@@ -426,7 +425,7 @@ class GoodsService
*/ */
private static function addGoodsSnapshot($skuInfo) private static function addGoodsSnapshot($skuInfo)
{ {
$subShopList = ShopService::getSubShopList($skuInfo["shop_id"]); $subShopList = ShopService::getRelationShop($skuInfo["goods_sku_id"]);
$skuInfo["sub_shop"] = json_encode($subShopList); $skuInfo["sub_shop"] = json_encode($subShopList);
GoodsSnapshot::insertRecord($skuInfo); GoodsSnapshot::insertRecord($skuInfo);
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace App\Services\shop; namespace App\Services\shop;
use App\Models\goods\mysql\GoodsSkuSubShop;
use App\Models\shop\mysql\Shop; use App\Models\shop\mysql\Shop;
use App\Models\shop\mysql\SubShop; use App\Models\shop\mysql\SubShop;
use Api\PhpUtils\Validate\Validate; use Api\PhpUtils\Validate\Validate;
...@@ -259,7 +260,7 @@ class ShopService ...@@ -259,7 +260,7 @@ class ShopService
} }
/** /**
* 获取定 shop_id 下的门店 * 获取定 shop_id 下的门店
* @param $shopId * @param $shopId
* @return \Api\PhpUtils\Mysql\MysqlBase * @return \Api\PhpUtils\Mysql\MysqlBase
*/ */
...@@ -284,4 +285,23 @@ class ShopService ...@@ -284,4 +285,23 @@ class ShopService
} }
} }
} }
/**
* 获取商品关联的门店信息
* @param $goodsSkuId
* @return \Api\PhpUtils\Mysql\MysqlBase|array
*/
public static function getRelationShop($goodsSkuId)
{
$subShopIds = GoodsSkuSubShop::select("sub_shop_id", ["goods_sku_id"=>$goodsSkuId]);
$subShopList = [];
if (!empty($subShopIds)) {
$subShopIdList = [];
foreach ($subShopIds as $subShopId) {
$subShopIdList[] = $subShopId;
}
$subShopList = SubShop::select("*", ["sub_shop_id" => $subShopIdList]);
}
return $subShopList;
}
} }
\ 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