110 lines
2.6 KiB
PHP
110 lines
2.6 KiB
PHP
<?php
|
|
namespace app\adminapi\controller\user;
|
|
|
|
|
|
use app\adminapi\controller\BaseAdminController;
|
|
use app\adminapi\lists\user\UserGroupLists;
|
|
use app\adminapi\logic\user\UserGroupLogic;
|
|
use app\adminapi\validate\user\UserGroupValidate;
|
|
|
|
|
|
/**
|
|
* 用户分组控制器
|
|
* Class UserGroupController
|
|
* @package app\adminapi\controller\user
|
|
*/
|
|
class UserGroupController extends BaseAdminController
|
|
{
|
|
|
|
|
|
/**
|
|
* @notes 获取用户分组列表
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/04/25 01:04
|
|
*/
|
|
public function lists()
|
|
{
|
|
return $this->dataLists(new UserGroupLists());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 添加用户分组
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/04/25 01:04
|
|
*/
|
|
public function add()
|
|
{
|
|
$params = (new UserGroupValidate())->post()->goCheck('add');
|
|
$result = UserGroupLogic::add($params);
|
|
if (true === $result) {
|
|
return $this->success('添加成功', [], 1, 1);
|
|
}
|
|
return $this->fail(UserGroupLogic::getError());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 编辑用户分组
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/04/25 01:04
|
|
*/
|
|
public function edit()
|
|
{
|
|
$params = (new UserGroupValidate())->post()->goCheck('edit');
|
|
$result = UserGroupLogic::edit($params);
|
|
if (true === $result) {
|
|
return $this->success('编辑成功', [], 1, 1);
|
|
}
|
|
return $this->fail(UserGroupLogic::getError());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 删除用户分组
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/04/25 01:04
|
|
*/
|
|
public function delete()
|
|
{
|
|
$params = (new UserGroupValidate())->post()->goCheck('delete');
|
|
UserGroupLogic::delete($params);
|
|
return $this->success('删除成功', [], 1, 1);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 获取用户分组详情
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/04/25 01:04
|
|
*/
|
|
public function detail()
|
|
{
|
|
$params = (new UserGroupValidate())->goCheck('detail');
|
|
$result = UserGroupLogic::detail($params);
|
|
return $this->data($result);
|
|
}
|
|
|
|
/**
|
|
* @notes 用户分组
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/03/19 02:29
|
|
*/
|
|
public function setUserGroup()
|
|
{
|
|
$params = $this->request->post();
|
|
$result = UserGroupLogic::setUserGroup($params);
|
|
if (true === $result) {
|
|
return $this->success('分组成功', [], 1, 1);
|
|
}
|
|
return $this->fail(UserGroupLogic::getError());
|
|
}
|
|
|
|
|
|
} |