validate([ 'game_id' => ['nullable', 'string', 'min:1'], 'member_id' => ['nullable', 'string', 'min:1'], 'first_name' => ['nullable', 'string', 'min:1'], 'username' => ['nullable', 'string', 'min:1'], ]); $search = request()->all(); $result = UserService::paginate($search); } catch (ValidationException $e) { return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first()); } catch (Exception $e) { return $this->error(intval($e->getCode())); } return $this->success($result); } /** * @api {post} /admin/user/merge 账户合并 * @apiGroup 会员管理 * @apiDescription 合并后,余额,银行卡,USDT地址 将合并到新用户,请谨慎操作 * * @apiUse result * @apiUse header * @apiVersion 1.0.0 * * @apiParam {string} member_id 接收者的member_id * @apiParam {string} secret_key 被合并的用户的秘钥 */ public function merge(): JsonResponse { DB::beginTransaction(); try { $params = request()->validate([ 'member_id' => ['required', 'string', 'min:1'], 'secret_key' => ['required', 'string', 'min:1'], ]); $res = SecretService::migration($params['member_id'], $params['secret_key']); if (!$res) { throw new Exception(lang("迁移失败"), HttpStatus::CUSTOM_ERROR); } $oldUser = UserModel::where('secret_key', $params['secret_key'])->first(); $newUser = UserModel::where('member_id', $params['member_id'])->first(); $text = "账户转移通知:\n"; $text .= "管理员已将您的账户转移至新用户\n\n"; $text .= "新用户信息\n"; $text .= "用户ID:{$newUser->getMemberId()}\n"; $text .= "用户名:{$newUser->getUsername()}\n"; $text .= "昵称:{$newUser->getFirstName()}\n"; TopUpService::notifyTransferSuccess($oldUser->getMemberId(), $text); $text = "账户转移通知:\n"; $text .= "管理员已将指定账户转移至您的账户\n\n"; $text .= "原账户信息\n\n"; $text .= "用户ID:{$oldUser->getMemberId()}\n"; $text .= "用户名:{$oldUser->getUsername()}\n"; $text .= "昵称:{$oldUser->getFirstName()}\n"; TopUpService::notifyTransferSuccess($newUser->getMemberId(), $text); DB::commit(); } catch (ValidationException $e) { DB::rollBack(); return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first()); } catch (Exception $e) { DB::rollBack(); if($e->getCode() == HttpStatus::CUSTOM_ERROR){ return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage()); } return $this->error(intval($e->getCode())); } return $this->success(msg: '已完成迁移'); } public function address() { try { request()->validate([ 'member_id' => ['required', 'integer', 'min:1'], ]); $search = request()->all(); $result = AddressService::findAll($search); } catch (ValidationException $e) { return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first()); } catch (Exception $e) { return $this->error(intval($e->getCode())); } return $this->success($result); } }