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
06e13e25
Commit
06e13e25
authored
Jun 15, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:检查商品名
parent
41919cd2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
88 deletions
+22
-88
CheckGoodsNameValidate.php
application/library/Validate/CheckGoodsNameValidate.php
+4
-2
EditSetmealValidate.php
application/library/Validate/EditSetmealValidate.php
+0
-25
EditStoresValidate.php
application/library/Validate/EditStoresValidate.php
+0
-31
SetmealListValidate.php
application/library/Validate/SetmealListValidate.php
+0
-21
Goods.php
application/modules/Goods/controllers/Goods.php
+5
-6
GoodsService.php
application/services/goods/GoodsService.php
+13
-3
No files found.
application/library/Validate/
StoresList
Validate.php
→
application/library/Validate/
CheckGoodsName
Validate.php
View file @
06e13e25
...
@@ -5,17 +5,19 @@ namespace Validate;
...
@@ -5,17 +5,19 @@ namespace Validate;
/**
/**
* Class
StoresList
Validate
* Class
CheckGoodsName
Validate
*
*
* @package Validate
* @package Validate
*/
*/
class
StoresList
Validate
extends
BaseValidate
class
CheckGoodsName
Validate
extends
BaseValidate
{
{
protected
$rule
=
[
protected
$rule
=
[
'name'
=>
'require'
,
'life_account_id'
=>
'require'
,
'life_account_id'
=>
'require'
,
];
];
protected
$message
=
[
protected
$message
=
[
"name"
=>
"商品名不能为空"
,
"life_account_id"
=>
"生活号id不能为空"
,
"life_account_id"
=>
"生活号id不能为空"
,
];
];
}
}
\ No newline at end of file
application/library/Validate/EditSetmealValidate.php
deleted
100644 → 0
View file @
41919cd2
<?php
namespace
Validate
;
/**
* Class EditSetmealValidate
*
* @package Validate
*/
class
EditSetmealValidate
extends
BaseValidate
{
protected
$rule
=
[
'life_account_id'
=>
'require'
,
'good_sku_id'
=>
'require'
,
'setmeal_data'
=>
'require'
,
];
protected
$message
=
[
"life_account_id"
=>
"生活号id不能为空"
,
"good_sku_id"
=>
"商品id不能为空"
,
"setmeal_data"
=>
"套餐数据不能为空"
,
];
}
\ No newline at end of file
application/library/Validate/EditStoresValidate.php
deleted
100644 → 0
View file @
41919cd2
<?php
namespace
Validate
;
/**
* Class EditStoresValidate
*
* @package Validate
*/
class
EditStoresValidate
extends
BaseValidate
{
protected
$rule
=
[
'life_account_id'
=>
'require'
,
'name'
=>
'require'
,
'address_lng'
=>
'require'
,
'address_lat'
=>
'require'
,
'address'
=>
'require'
,
'phone'
=>
'require'
,
];
protected
$message
=
[
"life_account_id"
=>
"生活号id不能为空"
,
"name"
=>
"门店名称不能为空"
,
"address_lng"
=>
"门店位置经度不能为空"
,
"address_lat"
=>
"门店位置纬度不能为空"
,
"address"
=>
"门店地址不能为空"
,
"phone"
=>
"门店电话不能为空"
,
];
}
\ No newline at end of file
application/library/Validate/SetmealListValidate.php
deleted
100644 → 0
View file @
41919cd2
<?php
namespace
Validate
;
/**
* Class SetmealListValidate
*
* @package Validate
*/
class
SetmealListValidate
extends
BaseValidate
{
protected
$rule
=
[
'goods_sku_id'
=>
'require'
,
];
protected
$message
=
[
"goods_sku_id"
=>
"商品id不能为空"
,
];
}
\ No newline at end of file
application/modules/Goods/controllers/Goods.php
View file @
06e13e25
...
@@ -3,12 +3,7 @@
...
@@ -3,12 +3,7 @@
use
App\Base\Base
;
use
App\Base\Base
;
use
App\Services\goods\GoodsService
;
use
App\Services\goods\GoodsService
;
use
App\Services\goods\CategoryService
;
use
App\Services\goods\CategoryService
;
use
App\Services\goods\StoresService
;
use
\Validate\CheckGoodsNameValidate
;
use
App\Services\goods\SetmealService
;
use
\Validate\EditStoresValidate
;
use
\Validate\StoresListValidate
;
use
\Validate\EditSetmealValidate
;
use
\Validate\SetmealListValidate
;
use
\Validate\GoodsAuditValidate
;
use
\Validate\GoodsAuditValidate
;
...
@@ -96,7 +91,11 @@ class GoodsController extends Base
...
@@ -96,7 +91,11 @@ class GoodsController extends Base
*/
*/
public
function
check_goods_nameAction
()
public
function
check_goods_nameAction
()
{
{
(
new
CheckGoodsNameValidate
())
->
validate
();
$params
=
$this
->
params
;
$res
=
GoodsService
::
checkGoodsName
(
$params
[
"name"
],
$params
[
"life_account_id"
]);
$this
->
success
([
"data"
=>
$res
]);
}
}
/**
/**
...
...
application/services/goods/GoodsService.php
View file @
06e13e25
...
@@ -157,7 +157,6 @@ class GoodsService
...
@@ -157,7 +157,6 @@ class GoodsService
"shop_id"
=>
$shopId
,
"shop_id"
=>
$shopId
,
"life_account_id"
=>
$lifeAccountId
,
"life_account_id"
=>
$lifeAccountId
,
"merchant_id"
=>
$lifeAccount
[
"merchant_id"
],
"merchant_id"
=>
$lifeAccount
[
"merchant_id"
],
"name"
=>
$lifeAccount
[
"life_account_name"
],
"status"
=>
Shop
::
STATUS_ONLINE
,
"status"
=>
Shop
::
STATUS_ONLINE
,
]);
]);
}
else
{
}
else
{
...
@@ -296,8 +295,19 @@ class GoodsService
...
@@ -296,8 +295,19 @@ class GoodsService
return
true
;
return
true
;
}
}
public
static
function
checkGoodsName
(
$goodsName
)
/**
* 商品名是否可用
* @param $goodsName
* @param $lifeAccountId
* @return bool
*/
public
static
function
checkGoodsName
(
$goodsName
,
$lifeAccountId
)
{
{
$sku
=
GoodsSpu
::
get
(
"*"
,
[
"name"
=>
$goodsName
,
"life_account_id"
=>
$lifeAccountId
]);
$nameCanUse
=
false
;
if
(
empty
(
$sku
))
{
$nameCanUse
=
true
;
}
return
[
"can_use"
=>
$nameCanUse
];
}
}
}
}
\ 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