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
94d53cd4
Commit
94d53cd4
authored
Dec 19, 2019
by
侯贺政
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除商品详情页模板,新建、更新验证时预处理时间
Signed-off-by:
houhezheng
<
houhezheng@romens.cn
>
parent
d39e64a7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
3 deletions
+34
-3
GoodsDetailSettingController.php
...controllers/v1/shopgoods/GoodsDetailSettingController.php
+16
-3
ShopGoodsDetailSetting.php
backend/models/v1/shopgoods/ShopGoodsDetailSetting.php
+18
-0
No files found.
backend/controllers/v1/shopgoods/GoodsDetailSettingController.php
View file @
94d53cd4
...
@@ -66,6 +66,10 @@ class GoodsDetailSettingController extends BaseController
...
@@ -66,6 +66,10 @@ class GoodsDetailSettingController extends BaseController
* END_TIME:生效结束时间,
* END_TIME:生效结束时间,
* HEAD_PIC_URL:顶部内容,
* HEAD_PIC_URL:顶部内容,
* FOOT_PIC_URL:底部内容"),
* FOOT_PIC_URL:底部内容"),
* @OA\Response(
* response=422,
* description="数据验证错误,错误信息(数组)。",
* ),
* security={{"Authorization": {}}}
* security={{"Authorization": {}}}
* )
* )
*/
*/
...
@@ -88,7 +92,7 @@ class GoodsDetailSettingController extends BaseController
...
@@ -88,7 +92,7 @@ class GoodsDetailSettingController extends BaseController
* description="更新商品详情页模板设置",
* description="更新商品详情页模板设置",
* @OA\RequestBody(
* @OA\RequestBody(
* required=true,
* required=true,
* description="注:时间格式为 Y-m-d H:i:s
;
启用按钮也用此接口,传入GUID,STATUS即可。",
* description="注:时间格式为 Y-m-d H:i:s
;
启用按钮也用此接口,传入GUID,STATUS即可。",
* @OA\MediaType(
* @OA\MediaType(
* mediaType="application/x-www-form-urlencoded",
* mediaType="application/x-www-form-urlencoded",
* @OA\Schema(
* @OA\Schema(
...
@@ -177,7 +181,7 @@ class GoodsDetailSettingController extends BaseController
...
@@ -177,7 +181,7 @@ class GoodsDetailSettingController extends BaseController
$params
=
Yii
::
$app
->
request
->
bodyParams
;
$params
=
Yii
::
$app
->
request
->
bodyParams
;
$orgGuid
=
Yii
::
$app
->
user
->
identity
->
ORG_GUID
;
$orgGuid
=
Yii
::
$app
->
user
->
identity
->
ORG_GUID
;
$model
=
new
$this
->
modelClass
();
$model
=
new
$this
->
modelClass
();
$model
->
senario
=
'creation'
;
$model
->
s
c
enario
=
'creation'
;
$model
->
attributes
=
$params
;
$model
->
attributes
=
$params
;
$model
->
ORG_GUID
=
$orgGuid
;
$model
->
ORG_GUID
=
$orgGuid
;
$model
->
GUID
=
str_shuffle
(
uniqid
()
.
rand
(
1000
,
9999
))
.
$orgGuid
;;
$model
->
GUID
=
str_shuffle
(
uniqid
()
.
rand
(
1000
,
9999
))
.
$orgGuid
;;
...
@@ -212,7 +216,16 @@ class GoodsDetailSettingController extends BaseController
...
@@ -212,7 +216,16 @@ class GoodsDetailSettingController extends BaseController
*/
*/
public
function
actionSettingDel
()
public
function
actionSettingDel
()
{
{
$guid
=
Yii
::
$app
->
request
->
get
(
'GUID'
);
$model
=
new
$this
->
modelClass
();
$_model
=
$model
::
findOne
(
$guid
);
if
(
!
$_model
)
{
throw
new
BadRequestHttpException
(
'该模板不存在'
);
}
if
(
!
$_model
->
delete
())
{
throw
new
ServerErrorHttpException
(
'删除失败!'
);
}
throw
new
HttpException
(
200
,
"删除成功!"
);
}
}
/**
/**
...
...
backend/models/v1/shopgoods/ShopGoodsDetailSetting.php
View file @
94d53cd4
...
@@ -43,6 +43,8 @@ class ShopGoodsDetailSetting extends \app\models\v1\BaseModel
...
@@ -43,6 +43,8 @@ class ShopGoodsDetailSetting extends \app\models\v1\BaseModel
[[
'GUID'
,
'ORG_GUID'
],
'string'
,
'max'
=>
50
],
[[
'GUID'
,
'ORG_GUID'
],
'string'
,
'max'
=>
50
],
[[
'NAME'
],
'string'
,
'max'
=>
255
],
[[
'NAME'
],
'string'
,
'max'
=>
255
],
[[
'GUID'
],
'unique'
,
'on'
=>
'creation'
],
[[
'GUID'
],
'unique'
,
'on'
=>
'creation'
],
[[
'START_TIME'
],
'validateStartTime'
],
[[
'END_TIME'
],
'validateEndTime'
],
];
];
}
}
...
@@ -63,6 +65,22 @@ class ShopGoodsDetailSetting extends \app\models\v1\BaseModel
...
@@ -63,6 +65,22 @@ class ShopGoodsDetailSetting extends \app\models\v1\BaseModel
];
];
}
}
/**
* 预处理生效开始时间为时间戳
*/
public
function
validateStartTime
()
{
$this
->
START_TIME
=
strtotime
(
$this
->
START_TIME
);
}
/**
* 预处理生效结束时间为时间戳
*/
public
function
validateEndTime
()
{
$this
->
END_TIME
=
strtotime
(
$this
->
END_TIME
);
}
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
...
...
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