<?php

namespace app\admin\controller\user_ship;


use app\admin\controller\BaseAdminController;
use app\admin\lists\user_ship\UserShipLists;
use app\admin\logic\user_ship\UserShipLogic;
use app\admin\validate\user_ship\UserShipValidate;


/**
 * 会员类型控制器
 * Class UserShipController
 * @package app\admin\controller\user_ship
 */
class UserShipController extends BaseAdminController
{


    /**
     * @notes 获取会员类型列表
     * @return \think\response\Json
     * @author admin
     * @date 2024/06/29 14:18
     */
    public function lists()
    {
        return $this->dataLists(new UserShipLists());
    }


    /**
     * @notes 添加会员类型
     * @return \think\response\Json
     * @author admin
     * @date 2024/06/29 14:18
     */
    public function add()
    {
        $params = (new UserShipValidate())->post()->goCheck('add');
        $result = UserShipLogic::add($params);
        if (true === $result) {
            return $this->success('添加成功', [], 1, 1);
        }
        return $this->fail(UserShipLogic::getError());
    }


    /**
     * @notes 编辑会员类型
     * @return \think\response\Json
     * @author admin
     * @date 2024/06/29 14:18
     */
    public function edit()
    {
        $params = (new UserShipValidate())->post()->goCheck('edit');
        $result = UserShipLogic::edit($params);
        if (true === $result) {
            return $this->success('编辑成功', [], 1, 1);
        }
        return $this->fail(UserShipLogic::getError());
    }


    /**
     * @notes 删除会员类型
     * @return \think\response\Json
     * @author admin
     * @date 2024/06/29 14:18
     */
    public function delete()
    {
        $params = (new UserShipValidate())->post()->goCheck('delete');
        UserShipLogic::delete($params);
        return $this->success('删除成功', [], 1, 1);
    }


    /**
     * @notes 获取会员类型详情
     * @return \think\response\Json
     * @author admin
     * @date 2024/06/29 14:18
     */
    public function detail()
    {
        $params = (new UserShipValidate())->goCheck('detail');
        $result = UserShipLogic::detail($params);
        return $this->data($result);
    }


}