<?php

namespace app\admin\controller\user_label;


use app\admin\controller\BaseAdminController;
use app\admin\lists\user_label\UserLabelLists;
use app\admin\logic\user_label\UserLabelLogic;
use app\admin\validate\user_label\UserLabelValidate;


/**
 * 用户标签控制器
 * Class UserLabelController
 * @package app\admin\controller\user_label
 */
class UserLabelController extends BaseAdminController
{


    /**
     * @notes 获取用户标签列表
     * @return \think\response\Json
     * @author admin
     * @date 2024/06/17 17:02
     */
    public function lists()
    {
        return $this->dataLists(new UserLabelLists());
    }


    /**
     * @notes 添加用户标签
     * @return \think\response\Json
     * @author admin
     * @date 2024/06/17 17:02
     */
    public function add()
    {
        $params = (new UserLabelValidate())->post()->goCheck('add');
        $result = UserLabelLogic::add($params);
        if (true === $result) {
            return $this->success('添加成功', [], 1, 1);
        }
        return $this->fail(UserLabelLogic::getError());
    }


    /**
     * @notes 编辑用户标签
     * @return \think\response\Json
     * @author admin
     * @date 2024/06/17 17:02
     */
    public function edit()
    {
        $params = (new UserLabelValidate())->post()->goCheck('edit');
        $result = UserLabelLogic::edit($params);
        if (true === $result) {
            return $this->success('编辑成功', [], 1, 1);
        }
        return $this->fail(UserLabelLogic::getError());
    }


    /**
     * @notes 删除用户标签
     * @return \think\response\Json
     * @author admin
     * @date 2024/06/17 17:02
     */
    public function delete()
    {
        $params = (new UserLabelValidate())->post()->goCheck('delete');
        UserLabelLogic::delete($params);
        return $this->success('删除成功', [], 1, 1);
    }


    /**
     * @notes 获取用户标签详情
     * @return \think\response\Json
     * @author admin
     * @date 2024/06/17 17:02
     */
    public function detail()
    {
        $params = (new UserLabelValidate())->goCheck('detail');
        $result = UserLabelLogic::detail($params);
        return $this->data($result);
    }


}