feature/main20240421
guojia 7 months ago
parent d4015f4e8d
commit 7827116a8f
  1. 16
      app/store/controller/Merchant.php
  2. 2
      app/store/model/Style.php

@ -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

@ -28,8 +28,6 @@ class Style extends model
*/
public function edit(array $data): bool
{
// 是否删除图片
!isset($data['logo_image_id']) && $data['logo_image_id'] = 0;
return $this->save($data) !== false;
}

Loading…
Cancel
Save