feature/main20240421
guojia 7 months ago
parent c9d99f7975
commit d4015f4e8d
  1. 15
      app/common/model/Style.php
  2. 5
      app/store/controller/Merchant.php

@ -34,16 +34,13 @@ class Style extends BaseModel
* @param int $storeId * @param int $storeId
* @return static|array|null * @return static|array|null
*/ */
public static function detail() public static function detail(int $styleId)
{ {
try { $where = [
$list = self::withoutGlobalScope() 'style_id' => $styleId,
->where('1', '=', 1) 'store_id' => self::$storeId
->find(); ];
return $list ?? null; return static::get($where, []);
} catch (\Exception $e) {
return null;
}
} }
/** /**

@ -134,7 +134,8 @@ class Merchant extends Controller
// 新增记录 // 新增记录
$model = new StyleModel; $model = new StyleModel;
$data = $this->postForm(); $data = $this->postForm();
if ($model->add($data)) { $data['style_id'] = 1;
if ($model->edit($data)) {
return $this->renderSuccess('添加成功'); return $this->renderSuccess('添加成功');
} }
return $this->renderError($model->getError() ?: '添加失败'); return $this->renderError($model->getError() ?: '添加失败');
@ -143,7 +144,7 @@ class Merchant extends Controller
public function getPageStyle(): Json public function getPageStyle(): Json
{ {
// 新增记录 // 新增记录
$detail = StyleModel::detail(); $detail = StyleModel::detail(1);
return $this->renderSuccess(compact('detail')); return $this->renderSuccess(compact('detail'));
} }

Loading…
Cancel
Save