Commit 62bd3c6f authored by 孙磊's avatar 孙磊

Merge branch 'development' of http://gitlab-ebiz.yiyao365.cn/newshop/newshopback into development

parents d29b09de a1045901
......@@ -7,6 +7,7 @@ $params = array_merge(
);
return [
'id' => 'app-backend',
'language' => 'zh-CN',
'basePath' => dirname(__DIR__),
'controllerNamespace' => 'backend\controllers',
'bootstrap' => ['log'],
......
......@@ -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()) {
......
......@@ -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;
}
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment