feature/main20240421
郭嘉 6 months ago
parent 3f25450980
commit e5454f73e3
  1. 15
      app/api/controller/Square.php
  2. 15
      app/api/model/Square.php

@ -58,6 +58,21 @@ class Square extends Controller
return $this->renderError('添加失败');
}
/**
* 删除门店
* @param int $shopId
* @return Json
*/
public function delete(int $squareId): Json
{
// 门店详情
$model = squareModel::detail($squareId, $this->storeId);
if (!$model->setDelete()) {
return $this->renderError($model->getError() ?: '删除失败');
}
return $this->renderSuccess('删除成功');
}
/**
* 列表

@ -31,6 +31,21 @@ class Square extends \app\common\model\Square
return $this->save($data) !== false;
}
/**
* 详情信息
* @param int $storeId
* @return static|array|null
*/
public static function detail(int $squareId, $store_id = 0)
{
$store_id = $store_id ? $store_id : self::$storeId;
$where = [
'square_id' => $squareId,
'store_id' => $store_id
];
return static::get($where, []);
}
/**
* 新增记录
* @param array $data

Loading…
Cancel
Save