json([ 'success' => true, 'data' => [ 'dingtalk_token_configured' => filled($this->configService->get(ErpRequestReportService::DINGTALK_TOKEN_CONFIG_KEY)), ], ]); } public function update(Request $request): JsonResponse { $validated = $request->validate([ 'dingtalk_token' => ['required', 'string', 'max:2048'], ]); $token = trim($validated['dingtalk_token']); if ($token === '') { throw ValidationException::withMessages([ 'dingtalk_token' => 'Token 不能为空', ]); } $this->configService->set( ErpRequestReportService::DINGTALK_TOKEN_CONFIG_KEY, $token, 'ERP 请求日报钉钉机器人 Token' ); return response()->json([ 'success' => true, 'message' => 'ERP 请求日报钉钉机器人 Token 已保存', 'data' => [ 'dingtalk_token_configured' => true, ], ]); } }