Commit aeb1df5e by 杨树贤

Merge branch 'ysx-修复修改显示类型-20241202'

parents 91ab9b41 dbc1325d
......@@ -110,7 +110,7 @@ class SkuService extends BaseService
$sku['goods_label'] = array_get($goodsTag, 'goods_label', '');
if ($this->orgId == 1) {
$sku['goods_label_name'] = array_get(config('field.SkuGoodsLabel'), $sku['goods_label'], '');
}else{
} else {
$sku['goods_label_name'] = array_get(config('field.SkuGoodsLabelForIedge'), $sku['goods_label'], '');
}
$sku['tags'] = array_get($goodsTag, 'tags', []);
......@@ -488,34 +488,7 @@ class SkuService extends BaseService
$goodsLabel = (int)$goodsLabel;
//判断是类型1(针对商品)还是类型2(针对供应商)
if ($type == 1) {
$redis = new RedisModel();
$skuIds = explode(',', $skuIds);
foreach ($skuIds as $skuId) {
$skuId = (int)$skuId;
$skuCache = $redis->hget('sku', $skuId);
$skuCache = json_decode($skuCache, true);
$skuCache['goods_label'] = $goodsLabel;
$redis->hset('sku', $skuId, json_encode($skuCache));
$dbInfo = getSpuSkuDb($skuId);
$connection = DB::connection($dbInfo["db"]);
$table = $dbInfo['table'];
$connection->table($table)->where('goods_id', $skuId)->update([
'goods_label' => $goodsLabel,
]);
$goodsTag = $redis->hget('goods_tag', $skuId);
if ($goodsTag) {
$goodsTag = json_decode($goodsTag, true);
$goodsTag['goods_label'] = $goodsLabel;
} else {
$goodsTag = [
'goods_label' => $goodsLabel,
];
}
$redis->hset('goods_tag', $skuId, json_encode($goodsTag));
}
self::updateGoodsLabel($skuIds, $goodsLabel);
} else {
$data = [
'canal' => $supplierCode,
......@@ -524,4 +497,26 @@ class SkuService extends BaseService
$this->batchUpdateSkuInfoQueue($data);
}
}
public static function updateGoodsLabel($skuIds, $goodsLabel)
{
if (!is_array($skuIds)) {
$skuIds = explode(',', trim($skuIds));
}
$conn = new AMQPStreamConnection(config('database.connections.rabbitmq2.host'),
config('database.connections.rabbitmq2.port'),
config('database.connections.rabbitmq2.login'),
config('database.connections.rabbitmq2.password'));
foreach ($skuIds as $skuId) {
$channel = $conn->channel();
$channel->queue_declare('lie_footstone_update_sku_info_queue', false, true, false, false);
$msg = new AMQPMessage(json_encode([[
'goods_id' => $skuId,
'goods_label' => $goodsLabel,
]]),
array('content_type' => 'text/plain'));
$channel->basic_publish($msg, '', 'sku_update');
}
}
}
......@@ -34,6 +34,7 @@ return [
'AbsoluteUrls' => [
'skulist' => 'http://footstone.liexin.net/footstone/skulist?',
'addsku' => 'http://footstone.liexin.net/footstone/addsku?',
'UpdateSku' => 'http://footstone.liexindev.net/web/sku/updateSku',
'uploadskulist' => 'http://footstone.liexin.net/footstone/uploadskulist',
'batch' => 'http://footstone.liexin.net/footstone/Batches?', // 批量下架
'exportMonopoly' => 'http://footstone.liexin.net/footstone/exportMonopoly?', // 专卖商品批量导出
......
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 sign in to comment