Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
goods
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
goods
Commits
12bb3643
Commit
12bb3643
authored
Jun 21, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:上架生成商品快照
parent
e9d45509
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
GoodsService.php
application/services/goods/GoodsService.php
+18
-2
No files found.
application/services/goods/GoodsService.php
View file @
12bb3643
...
@@ -12,6 +12,7 @@ use App\Exception\custom\GoodsException;
...
@@ -12,6 +12,7 @@ use App\Exception\custom\GoodsException;
use
App\Models\goods\mysql\Category
;
use
App\Models\goods\mysql\Category
;
use
App\Models\goods\mysql\GoodsOperationRecord
;
use
App\Models\goods\mysql\GoodsOperationRecord
;
use
App\Models\goods\mysql\GoodsSku
;
use
App\Models\goods\mysql\GoodsSku
;
use
App\Models\goods\mysql\GoodsSnapshot
;
use
App\Models\goods\mysql\GoodsSpu
;
use
App\Models\goods\mysql\GoodsSpu
;
use
App\Models\goods\mysql\Shop
;
use
App\Models\goods\mysql\Shop
;
use
App\Services\shop\ShopService
;
use
App\Services\shop\ShopService
;
...
@@ -312,7 +313,7 @@ class GoodsService
...
@@ -312,7 +313,7 @@ class GoodsService
$operatorName
=
$params
[
"user_name"
];
$operatorName
=
$params
[
"user_name"
];
$goodsSpu
=
GoodsSpu
::
get
(
"*"
,
[
"goods_spu_id"
=>
$goodsSpuId
]);
$goodsSpu
=
GoodsSpu
::
get
(
"*"
,
[
"goods_spu_id"
=>
$goodsSpuId
]);
//todo::权限判断
商品所属 life_account_id 或者
后台管理员
//todo::权限判断 后台管理员
//权限判断
//权限判断
if
(
!
empty
(
$params
[
"life_account_id"
])
&&
$goodsSpu
[
"life_account_id"
]
!=
$params
[
"life_account_id"
])
{
if
(
!
empty
(
$params
[
"life_account_id"
])
&&
$goodsSpu
[
"life_account_id"
]
!=
$params
[
"life_account_id"
])
{
throw
new
GoodsException
([
"cus"
=>
13
]);
throw
new
GoodsException
([
"cus"
=>
13
]);
...
@@ -333,7 +334,6 @@ class GoodsService
...
@@ -333,7 +334,6 @@ class GoodsService
$goodsSkuId
=
$sku
[
"goods_sku_id"
];
$goodsSkuId
=
$sku
[
"goods_sku_id"
];
GoodsSku
::
save
([
"online_status"
=>
$onlineStatus
],
[
"goods_sku_id"
=>
$goodsSkuId
]);
GoodsSku
::
save
([
"online_status"
=>
$onlineStatus
],
[
"goods_sku_id"
=>
$goodsSkuId
]);
//todo:: info to es
//商品操作记录
//商品操作记录
$res
=
self
::
getSnowIdgenId
(
"goods"
);
$res
=
self
::
getSnowIdgenId
(
"goods"
);
if
(
empty
(
$res
))
{
if
(
empty
(
$res
))
{
...
@@ -352,6 +352,11 @@ class GoodsService
...
@@ -352,6 +352,11 @@ class GoodsService
"note"
=>
empty
(
$params
[
"rejected_reason"
])
?
""
:
$params
[
"rejected_reason"
],
"note"
=>
empty
(
$params
[
"rejected_reason"
])
?
""
:
$params
[
"rejected_reason"
],
];
];
GoodsOperationRecord
::
insertRecord
(
$record
);
GoodsOperationRecord
::
insertRecord
(
$record
);
//上架的话,生成快照
if
(
GoodsSku
::
ONLINE_STATUS_ONLINE
==
$onlineStatus
)
{
self
::
addGoodsSnapshot
(
$sku
);
}
}
}
}
}
if
(
!
GoodsSku
::
commit
())
{
if
(
!
GoodsSku
::
commit
())
{
...
@@ -361,6 +366,17 @@ class GoodsService
...
@@ -361,6 +366,17 @@ class GoodsService
return
true
;
return
true
;
}
}
/**
* 生成快照数据
* @param $skuInfo
*/
private
static
function
addGoodsSnapshot
(
$skuInfo
)
{
$subShopList
=
ShopService
::
getSubShopList
(
$skuInfo
[
"shop_id"
]);
$skuInfo
[
"sub_shop"
]
=
json_encode
(
$subShopList
);
GoodsSnapshot
::
insertRecord
(
$skuInfo
);
}
/**
/**
* 商品名是否可用
* 商品名是否可用
* @param $goodsName
* @param $goodsName
...
...
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