|
|
|
@ -131,14 +131,20 @@ class Merchant extends Controller |
|
|
|
|
*/ |
|
|
|
|
public function setPageStyle(): Json |
|
|
|
|
{ |
|
|
|
|
// 新增记录 |
|
|
|
|
$model = new StyleModel; |
|
|
|
|
$detail = StyleModel::detail(1); |
|
|
|
|
$data = $this->postForm(); |
|
|
|
|
$data['style_id'] = 1; |
|
|
|
|
if ($model->edit($data)) { |
|
|
|
|
return $this->renderSuccess('添加成功'); |
|
|
|
|
if (empty($detail)) { |
|
|
|
|
if ($model->add($data)) { |
|
|
|
|
return $this->renderSuccess('操作成功'); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if ($model->edit($data)) { |
|
|
|
|
return $this->renderSuccess('操作成功'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return $this->renderError($model->getError() ?: '添加失败'); |
|
|
|
|
|
|
|
|
|
return $this->renderError($model->getError() ?: '操作失败'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getPageStyle(): Json |
|
|
|
|