Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
newShopBack
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
newshop
newShopBack
Commits
62bd3c6f
Commit
62bd3c6f
authored
Dec 27, 2019
by
孙磊
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'development' of
http://gitlab-ebiz.yiyao365.cn/newshop/newshopback
into development
parents
d29b09de
a1045901
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
4 deletions
+18
-4
main.php
backend/config/main.php
+1
-0
GoodsDetailSettingController.php
...controllers/v1/shopgoods/GoodsDetailSettingController.php
+9
-2
ShopGoodsDetailSetting.php
backend/models/v1/shopgoods/ShopGoodsDetailSetting.php
+8
-2
No files found.
backend/config/main.php
View file @
62bd3c6f
...
...
@@ -7,6 +7,7 @@ $params = array_merge(
);
return
[
'id'
=>
'app-backend'
,
'language'
=>
'zh-CN'
,
'basePath'
=>
dirname
(
__DIR__
),
'controllerNamespace'
=>
'backend\controllers'
,
'bootstrap'
=>
[
'log'
],
...
...
backend/controllers/v1/shopgoods/GoodsDetailSettingController.php
View file @
62bd3c6f
...
...
@@ -130,12 +130,19 @@ class GoodsDetailSettingController extends BaseController
if
(
!
$_model
)
{
throw
new
BadRequestHttpException
(
'该模板不存在'
);
}
//过滤掉部分为空的参数
//过滤掉部分为空的参数
;
foreach
(
$params
as
$key
=>
$value
)
{
if
(
in_array
(
$key
,
[
'STATUS'
,
'START_TIME'
,
'END_TIME'
])
&&
empty
(
trim
(
$value
)
))
{
if
(
in_array
(
$key
,
[
'STATUS'
,
'START_TIME'
,
'END_TIME'
])
&&
(
empty
(
trim
(
$value
))
&&
$value
!=
'0'
))
{
unset
(
$params
[
$key
]);
}
}
//兼容启用关闭功能,防止时间格式验证失败
if
(
!
isset
(
$params
[
'START_TIME'
]))
{
$_model
->
START_TIME
=
date
(
'Y-m-d H:i:s'
,
$_model
->
START_TIME
);
}
if
(
!
isset
(
$params
[
'END_TIME'
]))
{
$_model
->
END_TIME
=
date
(
'Y-m-d H:i:s'
,
$_model
->
END_TIME
);
}
$_model
->
attributes
=
$params
;
if
(
!
$_model
->
save
())
{
...
...
backend/models/v1/shopgoods/ShopGoodsDetailSetting.php
View file @
62bd3c6f
...
...
@@ -70,7 +70,10 @@ class ShopGoodsDetailSetting extends \app\models\v1\BaseModel
*/
public
function
validateStartTime
()
{
$this
->
START_TIME
=
strtotime
(
$this
->
START_TIME
);
$date
=
strtotime
(
$this
->
START_TIME
);
if
(
$date
!==
false
)
{
$this
->
START_TIME
=
$date
;
}
}
/**
...
...
@@ -78,7 +81,10 @@ class ShopGoodsDetailSetting extends \app\models\v1\BaseModel
*/
public
function
validateEndTime
()
{
$this
->
END_TIME
=
strtotime
(
$this
->
END_TIME
);
$date
=
strtotime
(
$this
->
END_TIME
);
if
(
$date
!==
false
)
{
$this
->
END_TIME
=
$date
;
}
}
/**
...
...
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