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
ba38bc7d
authored
Aug 28, 2025
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'ysx-记录手动上下架sku日志-20250825'
parents
7eb1693e
2e960fd4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
18 deletions
app/Http/Controllers/Api/SkuApiController.php
app/Http/Services/SkuService.php
app/Model/ManualPutawaySkuLog.php
resources/views/script/BatchUpdateSkuStatusScript.blade.php
resources/views/script/SkuListScript.blade.php
resources/views/web/BatchUpdateSkuStatus.blade.php
app/Http/Controllers/Api/SkuApiController.php
View file @
ba38bc7d
...
...
@@ -118,6 +118,7 @@ class SkuApiController extends Controller
{
$data
=
$request
->
only
([
'sku_ids'
,
'supplier_codes'
,
'is_long_term'
,
'operate_type'
,
'cp_time'
,
...
...
@@ -127,7 +128,6 @@ class SkuApiController extends Controller
$this
->
response
(
-
1
,
'请设置上架有效期'
);
}
}
(
new
SkuService
())
->
batchUpdateSkuStatus
(
$data
);
$this
->
response
(
0
,
'操作成功,请等待后台上下架任务完成刷新查看'
);
}
...
...
app/Http/Services/SkuService.php
View file @
ba38bc7d
...
...
@@ -3,18 +3,19 @@
namespace
App\Http\Services
;
use
App\Http\Controllers\Filter\SkuListFilter
;
use
App\Model\IntracodeModel
;
use
GuzzleHttp\Client
;
use
App\Model\LogModel
;
use
App\Model\TagsModel
;
use
App\Model\RedisModel
;
use
App\Model\IntracodeModel
;
use
App\Model\SkuUploadLogModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\TagsModel
;
use
GuzzleHttp\Client
;
use
App\Model\ManualPutawaySkuLog
;
use
Illuminate\Support\Facades\DB
;
use
App\Model\SupplierChannelModel
;
use
PhpAmqpLib\Message\AMQPMessage
;
use
Illuminate\Support\Facades\Redis
;
use
App\Http\Controllers\Filter\SkuListFilter
;
use
PhpAmqpLib\Connection\AMQPStreamConnection
;
use
PhpAmqpLib\Message\AMQPMessage
;
class
SkuService
extends
BaseService
{
...
...
@@ -35,8 +36,8 @@ class SkuService extends BaseService
$map
[
'no_rule'
]
=
1122
;
try
{
// $return = curl($url, $map, 1);
$url
=
base64_encode
(
$url
.
'?'
.
http_build_query
(
$map
));
$return
=
curl
(
config
(
'website.FootstoneCurlUrl'
)
.
$url
);
$url
=
base64_encode
(
$url
.
'?'
.
http_build_query
(
$map
));
$return
=
curl
(
config
(
'website.FootstoneCurlUrl'
)
.
$url
);
}
catch
(
\Exception
$e
)
{
return
$e
->
getMessage
();
}
...
...
@@ -44,7 +45,7 @@ class SkuService extends BaseService
$data
=
json_decode
(
$return
,
true
);
$list
=
[];
if
(
isset
(
$data
[
'error_code'
])
&&
$data
[
'error_code'
]
==
0
)
{
$url
=
config
(
'website.GoodsServerUrl'
)
.
'/synchronization?goods_id='
.
implode
(
','
,
$data
[
'data'
][
'goods_id'
]);
$url
=
config
(
'website.GoodsServerUrl'
)
.
'/synchronization?goods_id='
.
implode
(
','
,
$data
[
'data'
][
'goods_id'
]);
$return
=
curl
(
$url
,
$map
,
1
);
$skuListData
=
json_decode
(
$return
,
true
);
if
(
isset
(
$skuListData
[
'errcode'
])
&&
$skuListData
[
'errcode'
]
==
0
)
{
...
...
@@ -318,19 +319,24 @@ class SkuService extends BaseService
{
try
{
$skuIds
=
explode
(
','
,
$data
[
'sku_ids'
]);
$supplierCodes
=
explode
(
','
,
$data
[
'supplier_codes'
]);
//构建队列数据
//上架
$queueData
=
[];
if
(
$data
[
'operate_type'
]
==
self
::
OPERATE_TYPE_PUTAWAY
)
{
$queueName
=
'lie_footstone_batch_upsku_queue'
;
$data
[
'cp_time'
]
=
$data
[
'is_long_term'
]
==
1
?
self
::
LONG_TERM_TIMESTAMP
:
strtotime
(
$data
[
'cp_time'
]);
foreach
(
$skuIds
as
$skuId
)
{
foreach
(
$skuIds
as
$
key
=>
$
skuId
)
{
$queueData
[]
=
[
'sku_id'
=>
$skuId
,
'cp_time'
=>
$data
[
'cp_time'
],
];
ManualPutawaySkuLog
::
addManualPutawaySkuLog
(
$skuId
,
$supplierCodes
[
$key
]);
}
}
else
{
foreach
(
$skuIds
as
$key
=>
$skuId
)
{
ManualPutawaySkuLog
::
addManualPutawaySkuLog
(
$skuId
,
$supplierCodes
[
$key
]);
}
$queueName
=
'lie_footstone_batch_downsku_queue'
;
$queueData
[
'down_type'
]
=
2
;
$queueData
[
'data'
]
=
$skuIds
;
...
...
app/Model/ManualPutawaySkuLog.php
0 → 100644
View file @
ba38bc7d
<?php
namespace
App\Model
;
use
App\Http\Services\SkuService
;
use
Illuminate\Database\Eloquent\Model
;
//联营分类模型
class
ManualPutawaySkuLog
extends
Model
{
protected
$connection
=
'spu'
;
protected
$table
=
'manual_putaway_sku_log'
;
protected
$primaryKey
=
'id'
;
public
$timestamps
=
false
;
public
static
function
addManualPutawaySkuLog
(
$skuId
,
$supplierCode
=
''
)
{
if
(
empty
(
$supplierCode
))
{
return
true
;
}
//先判断是否存在
$manualPutawaySkuLog
=
self
::
where
(
'sku_id'
,
$skuId
)
->
first
();
if
(
$manualPutawaySkuLog
)
{
self
::
where
(
'sku_id'
,
$skuId
)
->
update
([
'is_new'
=>
1
,
'update_time'
=>
time
(),
]);
return
;
}
self
::
insert
([
'sku_id'
=>
$skuId
,
'supplier_code'
=>
$supplierCode
,
'create_time'
=>
time
(),
'is_new'
=>
1
,
]);
}
}
resources/views/script/BatchUpdateSkuStatusScript.blade.php
View file @
ba38bc7d
...
...
@@ -42,6 +42,7 @@
timeout
:
30000
,
//超时时间设置,单位毫秒
data
:
{
sku_ids
:
data
.
field
.
sku_ids
,
supplier_codes
:
data
.
field
.
supplier_codes
,
is_long_term
:
data
.
field
.
is_long_term
?
1
:
-
1
,
operate_type
:
data
.
field
.
operate_type
,
cp_time
:
data
.
field
.
cp_time
...
...
@@ -64,4 +65,4 @@
});
});
</script>
\ No newline at end of file
</script>
resources/views/script/SkuListScript.blade.php
View file @
ba38bc7d
...
...
@@ -285,14 +285,16 @@
let
checkStatus
=
table
.
checkStatus
(
'skuList'
);
let
data
=
checkStatus
.
data
;
let
skuIds
=
[];
let
supplierCodes
=
[];
$
.
each
(
data
,
function
(
index
,
value
)
{
skuIds
.
push
(
value
.
goods_id
);
supplierCodes
.
push
(
value
.
canal
);
});
if
(
skuIds
.
length
===
0
)
{
layer
.
msg
(
'请选择要操作的sku'
);
return
;
}
batchUpdateGoodsStatus
(
skuIds
,
'passed'
);
batchUpdateGoodsStatus
(
skuIds
,
'passed'
,
supplierCodes
);
})
//批量下架
...
...
@@ -300,17 +302,18 @@
let
checkStatus
=
table
.
checkStatus
(
'skuList'
);
let
data
=
checkStatus
.
data
;
let
skuIds
=
[];
let
supplierCodes
=
[];
$
.
each
(
data
,
function
(
index
,
value
)
{
skuIds
.
push
(
value
.
goods_id
);
supplierCodes
.
push
(
value
.
canal
);
});
if
(
skuIds
.
length
===
0
)
{
layer
.
msg
(
'请选择要操作的sku'
);
return
;
}
batchUpdateGoodsStatus
(
skuIds
,
'offshelf'
);
batchUpdateGoodsStatus
(
skuIds
,
'offshelf'
,
supplierCodes
);
})
//批量下架
$
(
"#set_prefer"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'skuList'
);
let
data
=
checkStatus
.
data
;
...
...
@@ -387,7 +390,7 @@
});
//批量上下架操作
function
batchUpdateGoodsStatus
(
skuIds
,
status
)
{
function
batchUpdateGoodsStatus
(
skuIds
,
status
,
supplierCodes
)
{
let
statusName
=
status
===
'offshelf'
?
'下架'
:
'上架'
;
let
operateType
=
status
===
'offshelf'
?
'-1'
:
'1'
;
if
(
status
!==
'offshelf'
)
{
...
...
@@ -397,7 +400,7 @@
offset
:
'100px'
,
fixed
:
false
,
//不固定
maxmin
:
true
,
content
:
'/sku/BatchUpdateSkuStatus?view=iframe&sku_ids='
+
skuIds
+
'&operate_type='
+
operateType
,
content
:
'/sku/BatchUpdateSkuStatus?view=iframe&sku_ids='
+
skuIds
+
'&operate_type='
+
operateType
+
'&supplier_codes='
+
supplierCodes
,
title
:
statusName
+
'商品'
,
end
:
function
()
{
table
.
reload
(
'skuList'
,
{
...
...
@@ -414,6 +417,7 @@
url
:
'/api/sku/batchUpdateSkuStatus'
,
timeout
:
30000
,
//超时时间设置,单位毫秒
data
:
{
'supplier_codes'
:
supplierCodes
.
join
(
','
),
'sku_ids'
:
skuIds
.
join
(
','
),
'operate_type'
:
-
1
,
},
...
...
resources/views/web/BatchUpdateSkuStatus.blade.php
View file @
ba38bc7d
<div
style=
"padding: 30px;"
>
<form
class=
"layui-form"
>
<input
type=
"hidden"
name=
"sku_ids"
value=
"{{request()->get('sku_ids')}}"
>
<input
type=
"hidden"
name=
"supplier_codes"
value=
"{{request()->get('supplier_codes')}}"
>
<input
type=
"hidden"
name=
"operate_type"
value=
"{{request()->get('operate_type')}}"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
><span
style=
"color: red"
>
*
</span>
上架有效期:
</label>
...
...
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