Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e732be78
authored
Apr 15, 2025
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复
parent
393ad618
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
31 deletions
app/Http/Services/SkuService.php
app/Http/Services/SkuService.php
View file @
e732be78
...
...
@@ -33,7 +33,11 @@ class SkuService extends BaseService
$url
=
env
(
'ES_SKU_URL'
,
''
);
$map
[
'show_status'
]
=
1
;
$map
[
'no_rule'
]
=
1122
;
$return
=
curl
(
$url
,
$map
,
1
);
try
{
$return
=
curl
(
$url
,
$map
,
1
);
}
catch
(
\Exception
$e
)
{
return
[
$e
->
getMessage
()];
}
$data
=
json_decode
(
$return
,
true
);
$list
=
[];
...
...
@@ -76,8 +80,10 @@ class SkuService extends BaseService
if
(
$brand
)
{
$sku
[
'brand_name'
]
=
$brand
;
}
else
{
$brand
=
DB
::
connection
(
'spu'
)
->
table
(
'brand'
)
->
where
(
'brand_id'
,
$spu
[
'brand_id'
])
->
lists
(
'brand_name'
,
'brand_id'
);
$brand
=
DB
::
connection
(
'spu'
)
->
table
(
'brand'
)
->
where
(
'brand_id'
,
$spu
[
'brand_id'
]
)
->
lists
(
'brand_name'
,
'brand_id'
);
if
(
$brand
)
{
$sku
[
'brand_name'
]
=
$brand
[
$spu
[
'brand_id'
]];
}
...
...
@@ -179,10 +185,14 @@ class SkuService extends BaseService
$validSkuTags
[]
=
$tag
;
}
}
$sku
[
'invalid_sku_tags'
]
=
$invalidSkuTags
?
implode
(
','
,
$invalidSkuTags
)
:
''
;
$sku
[
'valid_sku_tags'
]
=
$validSkuTags
?
implode
(
','
,
$validSkuTags
)
:
''
;
$sku
[
'invalid_sku_tags'
]
=
$invalidSkuTags
?
implode
(
','
,
$invalidSkuTags
)
:
''
;
$sku
[
'valid_sku_tags'
]
=
$validSkuTags
?
implode
(
','
,
$validSkuTags
)
:
''
;
}
unset
(
$sku
);
return
$skuList
;
...
...
@@ -236,44 +246,56 @@ class SkuService extends BaseService
//批量上下架队列
public
function
batchOffShelfSkuQueue
(
$data
)
{
$conn
=
new
AMQPStreamConnection
(
config
(
'database.connections.rabbitmq2.host'
),
$conn
=
new
AMQPStreamConnection
(
config
(
'database.connections.rabbitmq2.host'
),
config
(
'database.connections.rabbitmq2.port'
),
config
(
'database.connections.rabbitmq2.login'
),
config
(
'database.connections.rabbitmq2.password'
));
config
(
'database.connections.rabbitmq2.password'
)
);
$channel
=
$conn
->
channel
();
$channel
->
queue_declare
(
'lie_footstone_batch_downsku_queue'
,
false
,
true
,
false
,
false
);
$msg
=
new
AMQPMessage
(
json_encode
(
$data
),
array
(
'content_type'
=>
'text/plain'
));
$msg
=
new
AMQPMessage
(
json_encode
(
$data
),
array
(
'content_type'
=>
'text/plain'
)
);
$channel
->
basic_publish
(
$msg
,
''
,
'lie_footstone_batch_downsku_queue'
);
}
//批量修改内部编码
public
function
batchUpdateEncodedQueue
(
$data
)
{
$conn
=
new
AMQPStreamConnection
(
config
(
'database.connections.rabbitmq2.host'
),
$conn
=
new
AMQPStreamConnection
(
config
(
'database.connections.rabbitmq2.host'
),
config
(
'database.connections.rabbitmq2.port'
),
config
(
'database.connections.rabbitmq2.login'
),
config
(
'database.connections.rabbitmq2.password'
));
config
(
'database.connections.rabbitmq2.password'
)
);
$channel
=
$conn
->
channel
();
$channel
->
queue_declare
(
'lie_footstone_update_sku_info_queue'
,
false
,
true
,
false
,
false
);
$msg
=
new
AMQPMessage
(
json_encode
(
$data
),
array
(
'content_type'
=>
'text/plain'
));
$msg
=
new
AMQPMessage
(
json_encode
(
$data
),
array
(
'content_type'
=>
'text/plain'
)
);
$channel
->
basic_publish
(
$msg
,
''
,
'lie_footstone_update_sku_info_queue'
);
}
//批量修改商品信息队列
public
function
batchUpdateSkuInfoQueue
(
$data
)
{
$conn
=
new
AMQPStreamConnection
(
config
(
'database.connections.rabbitmq2.host'
),
$conn
=
new
AMQPStreamConnection
(
config
(
'database.connections.rabbitmq2.host'
),
config
(
'database.connections.rabbitmq2.port'
),
config
(
'database.connections.rabbitmq2.login'
),
config
(
'database.connections.rabbitmq2.password'
));
config
(
'database.connections.rabbitmq2.password'
)
);
$channel
=
$conn
->
channel
();
$channel
->
queue_declare
(
'lie_footstone_update_sku_info_queue'
,
false
,
true
,
false
,
false
);
$msg
=
new
AMQPMessage
(
json_encode
(
$data
),
array
(
'content_type'
=>
'text/plain'
));
$msg
=
new
AMQPMessage
(
json_encode
(
$data
),
array
(
'content_type'
=>
'text/plain'
)
);
$channel
->
basic_publish
(
$msg
,
''
,
'lie_footstone_update_sku_info_queue'
);
}
...
...
@@ -440,7 +462,6 @@ class SkuService extends BaseService
$ruler
[
'upload_futures_goods_validity_period'
]
=
$futuresCpTimeDay
;
$ruler
=
json_encode
(
$ruler
);
$redis
->
hset
(
'supplier_sku_upload_ruler_v2'
,
$supplierId
,
$ruler
);
}
$cpTimeDayStr
=
$cpTimeDay
==
-
1
?
'无限制'
:
$cpTimeDay
;
(
new
LogService
())
->
BatchAddIgnoreAuditLogs
(
$supplierIdList
,
LogModel
::
UPDATE_OPERATE
,
'批量配置供应商sku上架有效期'
,
'上架有效期修改为'
.
$cpTimeDayStr
.
'天,期货有效期修改为'
.
$futuresCpTimeDay
.
'天'
);
...
...
@@ -478,10 +499,7 @@ class SkuService extends BaseService
}
//设置供应商相关sku的队列数据
public
function
setSupplierSkuCpTimeLimitQueue
(
$supplier
)
{
}
public
function
setSupplierSkuCpTimeLimitQueue
(
$supplier
)
{}
public
function
batchUpdateGoodsLabel
(
$type
,
$supplierCode
,
$skuIds
,
$goodsLabel
)
...
...
@@ -504,21 +522,25 @@ class SkuService extends BaseService
if
(
!
is_array
(
$skuIds
))
{
$skuIds
=
explode
(
','
,
trim
(
$skuIds
));
}
$conn
=
new
AMQPStreamConnection
(
config
(
'database.connections.rabbitmqSku.host'
),
$conn
=
new
AMQPStreamConnection
(
config
(
'database.connections.rabbitmqSku.host'
),
config
(
'database.connections.rabbitmqSku.port'
),
config
(
'database.connections.rabbitmqSku.login'
),
config
(
'database.connections.rabbitmqSku.password'
));
config
(
'database.connections.rabbitmqSku.password'
)
);
foreach
(
$skuIds
as
$skuId
)
{
$channel
=
$conn
->
channel
();
$channel
->
queue_declare
(
'lie_footstone_update_sku_info_queue'
,
false
,
true
,
false
,
false
);
if
(
empty
(
$skuId
))
{
continue
;
}
$msg
=
new
AMQPMessage
(
json_encode
([[
'goods_id'
=>
$skuId
,
'goods_label'
=>
$goodsLabel
,
]]),
array
(
'content_type'
=>
'text/plain'
));
$msg
=
new
AMQPMessage
(
json_encode
([[
'goods_id'
=>
$skuId
,
'goods_label'
=>
$goodsLabel
,
]]),
array
(
'content_type'
=>
'text/plain'
)
);
$channel
->
basic_publish
(
$msg
,
''
,
'sku_update'
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment