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
fd69c988
Commit
fd69c988
authored
Jul 09, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:传参需要merchant_id的地方修改
parent
8ede2e83
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
4 deletions
+24
-4
GoodsException.php
application/exception/custom/GoodsException.php
+1
-0
GoodsInitShopValidate.php
application/library/Validate/GoodsInitShopValidate.php
+0
-2
GoodsService.php
application/services/goods/GoodsService.php
+23
-2
No files found.
application/exception/custom/GoodsException.php
View file @
fd69c988
...
...
@@ -40,5 +40,6 @@ class GoodsException extends BaseException
26
=>
'结束时间格式不对'
,
27
=>
'TCC调用失败'
,
28
=>
'上架状态不能编辑,需先下架,再做编辑操作'
,
29
=>
'发布商品的生活号不存在'
,
];
}
\ No newline at end of file
application/library/Validate/GoodsInitShopValidate.php
View file @
fd69c988
...
...
@@ -13,11 +13,9 @@ 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/services/goods/GoodsService.php
View file @
fd69c988
...
...
@@ -71,9 +71,19 @@ class GoodsService
{
GoodsSpu
::
beginTransaction
();
//生活号信息
$url
=
config
(
'interface'
,
'merchant.lifeaccount.get_life_account_by_id'
);
if
(
empty
(
$url
))
{
throw
new
InterfaceException
([
'cus'
=>
0
]);
}
$lifeAccountRes
=
(
new
Request
())
->
get
(
$url
,
[
"life_account_id"
=>
$params
[
"life_account_id"
]]);
if
(
empty
(
$lifeAccountRes
[
"response"
][
"result"
]))
{
throw
new
GoodsException
([
'cus'
=>
29
]);
}
$lifeAccount
=
[
"life_account_id"
=>
$params
[
"life_account_id"
],
"merchant_id"
=>
$
params
[
"merchant_id"
],
"merchant_id"
=>
$
lifeAccountRes
[
"response"
][
"result"
]
[
"merchant_id"
],
];
$shopId
=
self
::
addShop
(
$lifeAccount
);
$spuData
=
self
::
addGoodsSpu
(
$shopId
,
$params
);
...
...
@@ -1379,10 +1389,21 @@ class GoodsService
*/
public
static
function
initShop
(
$params
=
[])
{
//生活号信息
$url
=
config
(
'interface'
,
'merchant.lifeaccount.get_life_account_by_id'
);
if
(
empty
(
$url
))
{
throw
new
InterfaceException
([
'cus'
=>
0
]);
}
$lifeAccountRes
=
(
new
Request
())
->
get
(
$url
,
[
"life_account_id"
=>
$params
[
"life_account_id"
]]);
if
(
empty
(
$lifeAccountRes
[
"response"
][
"result"
]))
{
throw
new
GoodsException
([
'cus'
=>
29
]);
}
$lifeAccount
=
[
"life_account_id"
=>
$params
[
"life_account_id"
],
"merchant_id"
=>
$
params
[
"merchant_id"
],
"merchant_id"
=>
$
lifeAccountRes
[
"response"
][
"result"
]
[
"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