<?php

use App\Base\Base;
use \App\Services\marketing\BusinessCircleService;
use \Validate\BusinessCircleValidate;

class BusinesscircleController extends Base
{
    /**
     * 商圈数据列表
     * @throws Exception
     */
    public function listAction()
    {
        $params = $this->params;
        $list = BusinessCircleService::getList($params);
        $this->success(["result" => $list]);
    }

    /**
     * 商圈详情
     * @throws Exception
     */
    public function detailAction()
    {
        (new BusinessCircleValidate())->scene("detail")->validate();

        $params = $this->params;
        $list = BusinessCircleService::businessCircleDetail($params);
        $this->success(["result" => $list]);
    }

    /**
     * 商圈编辑（包括add 和 update）
     * @throws Exception
     */
    public function editAction()
    {
        $params = $this->params;
        $list = BusinessCircleService::businessCircleEdit($params);
        $this->success(["result" => $list]);
    }

    /**
     * 商圈删除（逻辑删除）
     * @throws Exception
     */
    public function deleteAction()
    {
        (new BusinessCircleValidate())->scene("delete")->validate();

        $params = $this->params;
        $list = BusinessCircleService::businessCircleDelete($params);
        $this->success(["result" => $list]);
    }
}