multi-store/app/admin/controller/user/UserController.php
2024-06-20 13:44:11 +08:00

85 lines
2.2 KiB
PHP

<?php
namespace app\admin\controller\user;
use app\admin\controller\BaseAdminController;
use app\admin\lists\user\UserLists;
use app\admin\logic\user\UserLogic;
use app\admin\validate\user\UserValidate;
class UserController extends BaseAdminController
{
/**
* @notes 用户列表
* @author 乔峰
* @date 2022//22 16:16
*/
public function lists()
{
return $this->dataLists(new UserLists());
}
/**
* @notes 添加用户列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/25 10:20
*/
public function add()
{
$params = (new UserValidate())->post()->goCheck('add');
$result = UserLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(UserLogic::getError());
}
/**
* @notes 获取用户详情
* @author 乔峰
* @date 2022/9/22 16:34
*/
public function detail()
{
$params = (new UserValidate())->goCheck('detail');
$detail = UserLogic::detail($params['id']);
return $this->success('', $detail);
}
/**
* @notes 编辑用户信息
* @author 乔峰
* @date 2022/9/22 16:34
*/
public function edit()
{
// $params = (new UserValidate())->post()->goCheck('edit');
$params = $this->request->post();
$result = UserLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(UserLogic::getError());
}
//采购款明细、余额明细、礼品券明细、返还金明细
public function fundList()
{
(new UserValidate())->get()->goCheck('fund');
$page_no = (int)$this->request->get('page_no', 1);
$page_size = (int)$this->request->get('page_size', 15);
$params = $this->request->get();
$params['page_no'] = $page_no > 0 ? $page_no : 1;
$params['page_size'] = $page_size > 0 ? $page_size : 15;
$res = UserLogic::dealDetails($params);
$res['page_no'] = $params['page_no'];
$res['page_size'] = $params['page_size'];
return $this->success('ok', $res);
}
}