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
b6ad507d
authored
May 31, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
批量上下架修改
parent
9a7f1de6
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
102 additions
and
21 deletions
.env
app/Http/Controllers/Api/SkuApiController.php
app/Http/Controllers/SkuController.php
app/Http/Services/QueueService.php
app/Http/Services/SkuService.php
config/perm.php
resources/views/script/BatchUpdateSkuStatusScript.blade.php
resources/views/script/SkuListScript.blade.php
.env
View file @
b6ad507d
...
...
@@ -74,7 +74,7 @@ REDIS_USER_HOST=192.168.1.234
REDIS_USER_PASSWORD=icDb29mLy2s
REDIS_USER_PORT=6379
REDIS_READ_HOST=192.168.1.23
7
REDIS_READ_HOST=192.168.1.23
4
REDIS_READ_PASSWORD=icDb29mLy2s
REDIS_READ_PORT=6379
...
...
app/Http/Controllers/Api/SkuApiController.php
View file @
b6ad507d
...
...
@@ -98,12 +98,12 @@ class SkuApiController extends Controller
]);
if
(
$data
[
'operate_type'
]
==
SkuService
::
OPERATE_TYPE_PUTAWAY
)
{
if
(
$data
[
'is_long_term'
]
==
-
1
&&
empty
(
$data
[
'cp_time'
]))
{
return
$this
->
setError
(
'请设置上架有效期'
);
$this
->
response
(
-
1
,
'请设置上架有效期'
);
}
}
(
new
SkuService
())
->
batchUpdateSkuStatus
(
$data
);
return
$this
->
setSuccess
(
'操作成功,请等待后台上下架任务完成刷新查看'
);
$this
->
response
(
0
,
'操作成功,请等待后台上下架任务完成刷新查看'
);
}
...
...
app/Http/Controllers/SkuController.php
View file @
b6ad507d
...
...
@@ -73,4 +73,8 @@ class SkuController extends Controller
return
$this
->
view
(
'批量下架'
);
}
public
function
BatchUpdateSkuStatus
(
$request
)
{
return
$this
->
view
(
'批量上架'
);
}
}
app/Http/Services/QueueService.php
View file @
b6ad507d
...
...
@@ -2,7 +2,6 @@
namespace
App\Http\Services
;
use
App\Http\Models\Cms\ConfigModel
;
use
PhpAmqpLib\Connection\AMQPStreamConnection
;
use
PhpAmqpLib\Message\AMQPMessage
;
...
...
app/Http/Services/SkuService.php
View file @
b6ad507d
...
...
@@ -174,7 +174,7 @@ class SkuService
//上架
$queueData
=
[];
if
(
$data
[
'operate_type'
]
==
self
::
OPERATE_TYPE_PUTAWAY
)
{
$queueName
=
'lie_batch_upsku_queue'
;
$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
)
{
$queueData
[]
=
[
...
...
@@ -183,7 +183,7 @@ class SkuService
];
}
}
else
{
$queueName
=
'lie_batch_downsku_queue'
;
$queueName
=
'lie_
footstone_
batch_downsku_queue'
;
$queueData
[
'down_type'
]
=
2
;
$queueData
[
'data'
]
=
$skuIds
;
}
...
...
config/perm.php
View file @
b6ad507d
...
...
@@ -14,6 +14,7 @@ return [
'BatchOffShelf'
,
'AddSupplierAttachment'
,
'UpdateSupplierAttachment'
,
'BatchUpdateSkuStatus'
,
]
//不用验证权限的方法
],
];
resources/views/script/BatchUpdateSkuStatusScript.blade.php
0 → 100644
View file @
b6ad507d
<script>
layui
.
use
([
'table'
,
'form'
,
'laydate'
,
'layer'
,
'upload'
,
'element'
,
'admin'
],
function
()
{
let
form
=
layui
.
form
;
let
admin
=
layui
.
admin
;
let
table
=
layui
.
table
;
let
element
=
layui
.
element
;
let
upload
=
layui
.
upload
;
let
layer
=
layui
.
layer
;
let
laydate
=
layui
.
laydate
;
let
$
=
layui
.
$
;
laydate
.
render
({
elem
:
'#cp_time_selector'
,
//指定元素
type
:
'datetime'
});
form
.
render
();
form
.
on
(
'switch(is_long_term)'
,
function
(
data
)
{
let
element
=
$
(
'#cp_time_selector'
);
if
(
data
.
elem
.
checked
)
{
element
.
addClass
(
'layui-disabled'
);
element
.
attr
(
'disabled'
,
true
);
$
(
'#cp_time_selector_div'
).
hide
();
$
(
'#none_time_div'
).
show
();
form
.
render
();
}
else
{
element
.
removeClass
(
'layui-disabled'
);
element
.
attr
(
'disabled'
,
false
);
$
(
'#cp_time_selector_div'
).
show
();
$
(
'#none_time_div'
).
hide
();
form
.
render
();
}
});
form
.
on
(
'submit(batchUpdateSkuStatus)'
,
function
(
data
)
{
let
operate
=
data
.
field
.
operate_type
>
0
?
'上架'
:
'下架'
;
layer
.
confirm
(
'确定要'
+
operate
+
'商品吗'
,
function
(
index
)
{
const
url
=
'/api/sku/batchUpdateSkuStatus'
;
$
.
ajax
({
type
:
'post'
,
url
:
url
,
timeout
:
30000
,
//超时时间设置,单位毫秒
data
:
{
sku_ids
:
data
.
field
.
sku_ids
,
is_long_term
:
data
.
field
.
is_long_term
?
1
:
-
1
,
operate_type
:
data
.
field
.
operate_type
,
cp_time
:
data
.
field
.
cp_time
},
dataType
:
'json'
,
success
:
function
(
res
)
{
if
(
res
.
err_code
===
0
)
{
admin
.
closeThisDialog
();
parent
.
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
});
}
else
{
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
});
}
}
});
});
});
form
.
on
(
'submit(cancel)'
,
function
(
data
)
{
admin
.
closeThisDialog
();
});
});
</script>
\ No newline at end of file
resources/views/script/SkuListScript.blade.php
View file @
b6ad507d
...
...
@@ -241,7 +241,7 @@
offset
:
'100px'
,
fixed
:
false
,
//不固定
maxmin
:
true
,
content
:
'/
web/sku/batchUpdateSkuStatus?window=tru
e&sku_ids='
+
skuIds
+
'&operate_type='
+
operateType
,
content
:
'/
sku/BatchUpdateSkuStatus?view=ifram
e&sku_ids='
+
skuIds
+
'&operate_type='
+
operateType
,
title
:
statusName
+
'商品'
,
end
:
function
()
{
table
.
reload
(
'skuList'
,
{
...
...
@@ -253,23 +253,32 @@
});
}
else
{
layer
.
confirm
(
'确定要下架选中的商品吗'
,
function
(
index
)
{
$
.
post
(
'/api/sku/batchUpdateSkuStatus'
,
{
'sku_ids'
:
skuIds
.
join
(
','
),
'operate_type'
:
-
1
,
},
function
(
res
)
{
if
(
res
.
code
===
0
)
{
layer
.
msg
(
res
.
msg
,
{
icon
:
6
});
table
.
reload
(
'skuList'
,
{
page
:
{
curr
:
currentPage
},
});
}
else
{
layer
.
msg
(
res
.
msg
,
{
icon
:
5
});
return
false
;
$
.
ajax
({
type
:
'post'
,
url
:
'/api/sku/batchUpdateSkuStatus'
,
timeout
:
30000
,
//超时时间设置,单位毫秒
data
:
{
'sku_ids'
:
skuIds
.
join
(
','
),
'operate_type'
:
-
1
,
},
dataType
:
'json'
,
success
:
function
(
res
)
{
console
.
log
(
res
);
if
(
res
.
err_code
===
0
)
{
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
});
table
.
reload
(
'skuList'
,
{
page
:
{
curr
:
currentPage
},
});
}
else
{
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
});
return
false
;
}
}
});
});
}
}
...
...
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