<?php

use App\Base\Base;
use \App\Services\marketing\TagService;
use \Validate\TagValidate;

class TagController extends Base
{
    /**
     * 分类标签数据列表
     * @throws Exception
     */
    public function listAction()
    {
        $params = $this->params;
        $list = TagService::getList($params);
        $this->success(["result" => $list]);
    }

    /**
     * 分类标签详情
     * @throws Exception
     */
    public function detailAction()
    {
        (new TagValidate())->scene("detail")->validate();

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

    /**
     * 分类标签编辑（包括add 和 update）
     * @throws Exception
     */
    public function editAction()
    {
        $params = $this->params;
        $list = TagService::tagEdit($params);
        $this->success(["result" => $list]);
    }

    /**
     * 分类标签删除（逻辑删除）
     * @throws Exception
     */
    public function deleteAction()
    {
        (new TagValidate())->scene("delete")->validate();

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