test_service d3170b4d1c 1
2023-12-01 15:43:29 +08:00

1 line
1011 B
PHP

<?php
namespace app\api\controller\food\user;
use app\api\controller\food\Controller;
use app\api\model\food\Pact as PactModel;
/**
* 预约管理
*/
class Pact extends Controller
{
/**
* 获取列表
*/
public function lists()
{
$model = new PactModel;
$list = $model->getUserPact($this->user_id);
return $this->renderSuccess($list);
}
/**
* 添加
*/
public function add()
{
$model = new PactModel;
if($model->add($this->request->post())){
return $this->renderMsg('操作成功');
}
$error = $model->getError() ?: '操作失败';
return $this->renderError($error);
}
/**
* 删除
*/
public function delete($id)
{
$model = PactModel::get($id);
if ($model->remove()) {
return $this->renderMsg('删除成功');
}
$error = $model->getError() ?: '删除失败';
return $this->renderError($error);
}
}