Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jwhx
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sugar
jwhx
Commits
b016ead5
Commit
b016ead5
authored
Dec 27, 2024
by
wuxiaoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
13b76c9d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
modules/Goods/app/Models/GoodsSku.php
modules/Goods/app/Models/GoodsSku.php
+1
-1
modules/Goods/app/Services/GoodsService.php
modules/Goods/app/Services/GoodsService.php
+3
-1
No files found.
modules/Goods/app/Models/GoodsSku.php
View file @
b016ead5
...
@@ -13,7 +13,7 @@ use App\Models\BaseModel;
...
@@ -13,7 +13,7 @@ use App\Models\BaseModel;
class
GoodsSku
extends
BaseModel
{
class
GoodsSku
extends
BaseModel
{
protected
$table
=
'goods_sku'
;
protected
$table
=
'goods_sku'
;
protected
$fillable
=
[
'goods_id'
,
'sku_value'
,
'sku'
,
'price'
,
'integral'
,
'stock'
,
'sales'
,
'cover'
,
'created_at'
,
'updated_at'
];
protected
$fillable
=
[
'goods_id'
,
'sku_value'
,
'sku'
,
'price'
,
'integral'
,
'stock'
,
'sales'
,
'cover'
,
'created_at'
,
'updated_at'
,
'goods_sn'
];
// protected $hidden = ['deleted_at'];
// protected $hidden = ['deleted_at'];
protected
function
casts
()
:
array
{
protected
function
casts
()
:
array
{
...
...
modules/Goods/app/Services/GoodsService.php
View file @
b016ead5
...
@@ -119,7 +119,7 @@ class GoodsService {
...
@@ -119,7 +119,7 @@ class GoodsService {
foreach
(
$goods
->
setFilterFields
(
$request
->
all
())
as
$key
=>
$value
)
{
foreach
(
$goods
->
setFilterFields
(
$request
->
all
())
as
$key
=>
$value
)
{
$goods
->
$key
=
$value
;
$goods
->
$key
=
$value
;
}
}
$goods
->
goods_sn
=
date
(
'YmdHis'
)
;
$goods
->
goods_sn
=
"G"
.
date
(
'YmdHis'
)
;
$goods
->
save
();
$goods
->
save
();
//更新栏目
//更新栏目
...
@@ -131,6 +131,7 @@ class GoodsService {
...
@@ -131,6 +131,7 @@ class GoodsService {
foreach
(
$sku
as
$key
=>
$value
)
{
foreach
(
$sku
as
$key
=>
$value
)
{
$sku
[
$key
][
'sku_value'
]
=
isset
(
$value
[
'sku_value'
])
?
$value
[
'sku_value'
]
:
Arr
::
except
(
$value
,
[
'price'
,
'stock'
,
'cover'
,
'original_price'
,
'sales'
]);
$sku
[
$key
][
'sku_value'
]
=
isset
(
$value
[
'sku_value'
])
?
$value
[
'sku_value'
]
:
Arr
::
except
(
$value
,
[
'price'
,
'stock'
,
'cover'
,
'original_price'
,
'sales'
]);
$sku
[
$key
][
'sku'
]
=
implode
(
';'
,
$value
[
'sku_value'
]);
$sku
[
$key
][
'sku'
]
=
implode
(
';'
,
$value
[
'sku_value'
]);
$sku
[
$key
][
'goods_sn'
]
=
"S"
.
date
(
'YmdHis'
)
;
}
}
$goods
->
sku
()
->
createMany
(
$sku
);
$goods
->
sku
()
->
createMany
(
$sku
);
}
}
...
@@ -176,6 +177,7 @@ class GoodsService {
...
@@ -176,6 +177,7 @@ class GoodsService {
foreach
(
$sku
as
$key
=>
$value
)
{
foreach
(
$sku
as
$key
=>
$value
)
{
$value
[
'sku_value'
]
=
isset
(
$value
[
'sku_value'
])
?
$value
[
'sku_value'
]
:
Arr
::
except
(
$value
,
[
'price'
,
'stock'
,
'cover'
,
'original_price'
,
'sales'
]);
$value
[
'sku_value'
]
=
isset
(
$value
[
'sku_value'
])
?
$value
[
'sku_value'
]
:
Arr
::
except
(
$value
,
[
'price'
,
'stock'
,
'cover'
,
'original_price'
,
'sales'
]);
$value
[
'sku'
]
=
implode
(
';'
,
$value
[
'sku_value'
]);
$value
[
'sku'
]
=
implode
(
';'
,
$value
[
'sku_value'
]);
$value
[
'goods_sn'
]
=
empty
(
$value
[
'goods_sn'
])
?
"S"
.
date
(
'YmdHi'
)
.
rand
(
1000
,
9999
)
:
$value
[
'goods_sn'
];
$goods
->
sku
()
->
updateOrCreate
([
'id'
=>
$value
[
'id'
]
??
0
],
$value
);
$goods
->
sku
()
->
updateOrCreate
([
'id'
=>
$value
[
'id'
]
??
0
],
$value
);
}
}
}
else
{
}
else
{
...
...
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