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
53137dad
Commit
53137dad
authored
Jul 07, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:init_shop 接口
parent
9da2c37a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
0 deletions
+51
-0
GoodsInitShopValidate.php
application/library/Validate/GoodsInitShopValidate.php
+23
-0
Goods.php
application/modules/Goods/controllers/Goods.php
+13
-0
GoodsService.php
application/services/goods/GoodsService.php
+15
-0
No files found.
application/library/Validate/GoodsInitShopValidate.php
0 → 100644
View file @
53137dad
<?php
namespace
Validate
;
/**
* Class GoodsInitShopValidate
*
* @package Validate
*/
class
GoodsInitShopValidate
extends
BaseValidate
{
protected
$rule
=
[
'life_account_id'
=>
'require'
,
'merchant_id'
=>
'require'
,
];
protected
$message
=
[
"life_account_id"
=>
"生活号id不能为空"
,
"merchant_id"
=>
"商户id不能为空"
,
];
}
\ No newline at end of file
application/modules/Goods/controllers/Goods.php
View file @
53137dad
...
...
@@ -13,6 +13,7 @@ use \Validate\GoodsListCValidate;
use
\Validate\OrderGoodsValidate
;
use
\Validate\GoodsOnlineOfflineValidate
;
use
\Validate\PaySuccessGoodsCallbackValidate
;
use
\Validate\GoodsInitShopValidate
;
use
\App\Services\goods\ElasticGoodService
;
...
...
@@ -246,4 +247,16 @@ class GoodsController extends Base
$this
->
success
([
"result"
=>
$res
]);
}
/**
* 初始化 shop_id
* @throws \App\Exception\custom\GoodsException
*/
public
function
init_shopAction
()
{
(
new
GoodsInitShopValidate
())
->
validate
();
$params
=
$this
->
params
;
$shopId
=
GoodsService
::
initShop
(
$params
);
$this
->
success
([
"result"
=>
[
"shop_id"
=>
$shopId
]]);
}
}
\ No newline at end of file
application/services/goods/GoodsService.php
View file @
53137dad
...
...
@@ -1356,4 +1356,19 @@ class GoodsService
GoodsSkuPicRecord
::
save
(
$data
);
}
}
/**
* 当前没有初始化shop的地方,单拎出来一个接口
* @param array $params
* @return mixed
* @throws GoodsException
*/
public
static
function
initShop
(
$params
=
[])
{
$lifeAccount
=
[
"life_account_id"
=>
$params
[
"life_account_id"
],
"merchant_id"
=>
$params
[
"merchant_id"
],
];
return
self
::
addShop
(
$lifeAccount
);
}
}
\ No newline at end of file
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