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
aa10b30a
Commit
aa10b30a
authored
Aug 25, 2021
by
jianghaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updateS:et
parent
2b65ef42
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
0 deletions
+77
-0
GoodsOnlineSiteValidate.php
application/library/Validate/GoodsOnlineSiteValidate.php
+23
-0
Goods.php
application/modules/Goods/controllers/Goods.php
+15
-0
GoodsService.php
application/services/goods/GoodsService.php
+39
-0
No files found.
application/library/Validate/GoodsOnlineSiteValidate.php
0 → 100644
View file @
aa10b30a
<?php
namespace
Validate
;
/**
* Class GoodsAuditValidate
*
* @package Validate
*/
class
GoodsOnlineSiteValidate
extends
BaseValidate
{
protected
$rule
=
[
'goods_spu_id'
=>
'require'
,
'online_type'
=>
'require'
,
];
protected
$message
=
[
"goods_spu_id"
=>
"商品id不能为空"
,
"online_type"
=>
"设置类型不能为空"
,
];
}
\ No newline at end of file
application/modules/Goods/controllers/Goods.php
View file @
aa10b30a
...
@@ -16,6 +16,7 @@ use \Validate\GoodsOnlineOfflineValidate;
...
@@ -16,6 +16,7 @@ use \Validate\GoodsOnlineOfflineValidate;
use
\Validate\PaySuccessGoodsCallbackValidate
;
use
\Validate\PaySuccessGoodsCallbackValidate
;
use
\Validate\GoodsInitShopValidate
;
use
\Validate\GoodsInitShopValidate
;
use
\Validate\PindanGoodsAddValidate
;
use
\Validate\PindanGoodsAddValidate
;
use
\Validate\GoodsOnlineSiteValidate
;
use
\App\Services\goods\ElasticGoodService
;
use
\App\Services\goods\ElasticGoodService
;
use
\App\Services\goods\MarketingPindanGoodsService
;
use
\App\Services\goods\MarketingPindanGoodsService
;
use
\App\Models\marketing\mysql\Marketing
;
use
\App\Models\marketing\mysql\Marketing
;
...
@@ -118,6 +119,20 @@ class GoodsController extends Base
...
@@ -118,6 +119,20 @@ class GoodsController extends Base
$this
->
success
();
$this
->
success
();
}
}
/**
* 修改商品定点上架设置
* @date 2021-08-25
* @license [license]
* @version [version]
*/
public
function
online_siteAction
()
{
$params
=
$this
->
params
;
(
new
GoodsOnlineSiteValidate
())
->
validate
();
GoodsService
::
onlineSite
(
$params
);
$this
->
success
();
}
/**
/**
* 审核通过/驳回
* 审核通过/驳回
*/
*/
...
...
application/services/goods/GoodsService.php
View file @
aa10b30a
...
@@ -549,6 +549,45 @@ class GoodsService
...
@@ -549,6 +549,45 @@ class GoodsService
return
true
;
return
true
;
}
}
/**
* 设置商品上架
* @date 2021-08-25
* @copyright [copyright]
* @license [license]
* @version [version]
* @param $params [description]
* @return array [description]
*/
public
static
function
onlineSite
(
$params
)
{
$goodsSpuId
=
$params
[
"goods_spu_id"
];
$onlineType
=
!
empty
(
$params
[
"online_type"
])
?
$params
[
"online_type"
]
:
0
;
$onlineStartTime
=
!
empty
(
$params
[
"online_start_time"
])
?
$params
[
"online_start_time"
]
:
null
;
$onlineEndTime
=
!
empty
(
$params
[
"online_end_time"
])
?
$params
[
"online_end_time"
]
:
null
;
GoodsSku
::
beginTransaction
();
$goodsSkuList
=
GoodsSku
::
select
(
"*"
,
[
"goods_spu_id"
=>
$goodsSpuId
]);
if
(
!
empty
(
$goodsSkuList
))
{
foreach
(
$goodsSkuList
as
$sku
)
{
$goodsSkuId
=
$sku
[
"goods_sku_id"
];
$goodsSkuData
=
[
"online_type"
=>
$onlineType
,
"online_start_time"
=>
$onlineStartTime
,
"online_end_time"
=>
$onlineEndTime
];
GoodsSku
::
save
(
$goodsSkuData
,
[
"goods_sku_id"
=>
$goodsSkuId
]);
//上架的话,生成快照
self
::
addGoodsSnapshot
(
$sku
);
self
::
updateGoodsInfoToEs
(
$goodsSkuId
);
}
}
if
(
!
GoodsSku
::
commit
())
{
GoodsSku
::
rollback
();
throw
new
GoodsException
([
"cus"
=>
11
]);
}
return
true
;
}
/**
/**
* 生成快照数据
* 生成快照数据
* @param $skuInfo
* @param $skuInfo
...
...
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