dataLists(new UserLists()); } /** * @notes 获取用户详情 * @return \think\response\Json * @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 编辑用户信息 * @return \think\response\Json * @author 段誉 * @date 2022/9/22 16:34 */ public function edit() { $params = (new UserValidate())->post()->goCheck('setInfo'); UserLogic::setUserInfo($params); return $this->success('操作成功', [], 1, 1); } /** * @notes 调整用户余额 * @return \think\response\Json * @author 段誉 * @date 2023/2/23 14:33 */ public function adjustMoney() { $params = (new AdjustUserMoney())->post()->goCheck(); $res = UserLogic::adjustUserMoney($params); if (true === $res) { return $this->success('操作成功', [], 1, 1); } return $this->fail($res); } /** * @notes 调整用户账户(余额/积分) */ public function adjustAccount() { $params = $this->request->post(); if (empty($params['user_id']) || empty($params['type']) || empty($params['action']) || empty($params['num'])) { return $this->fail('参数不完整'); } if (!in_array($params['type'], ['money', 'points'])) { return $this->fail('调整类型错误'); } if (!in_array($params['action'], [1, 2])) { return $this->fail('操作类型错误'); } if ($params['num'] <= 0) { return $this->fail('调整数量必须大于零'); } $res = UserLogic::adjustUserAccount($params); if (true === $res) { return $this->success('操作成功', [], 1, 1); } return $this->fail($res); } }