$code, 'status' => $status, 'msg' => $msg, 'page' => $page, 'data' => $data ]); } /** * 抛出逻辑异常 * @throws LogicException * @deprecated 函数已弃用, 请使用 throw_logic_exception() */ public static function throw_logic_exception(string $msg = 'error', int $code = 1, string $status = 'error', mixed $data = [], int $httpCode = 200, $header = [], $options = []): void { throw new LogicException(error_response($msg, $status, $code, $data, $httpCode, $header, $options)); } /** * 返回失败数据 * @deprecated 函数已弃用, 请使用 error_response() */ public static function error_response(string $msg = 'error', string $status = 'error', int $code = 1, mixed $data = [], int $httpCode = 400, $header = [], $options = []): Response { return json([ 'code' => $code, 'status' => $status, 'msg' => $msg, 'data' => $data ], $httpCode, $header, $options); } /** * 构建树形结构选项 * @param array $data 数据源 * @param string $valueField 值字段 * @param string $labelField 标签字段 * @param string $parentField 父字段 * @param int $parentId 父ID * @param string $childrenKey 子节点键 * @param bool $preserveOriginal 是否保留原始数据 * * @deprecated 函数已弃用, 请使用 build_tree_options() */ public static function build_tree_options( array $data, string $valueField = 'id', string $labelField = 'name', string $parentField = 'parent_id', int $parentId = 0, string $childrenKey = 'children', bool $preserveOriginal = true ): array { return build_tree_options($data, $valueField, $labelField, $parentField, $parentId, $childrenKey, $preserveOriginal); } /** * 生成随机密码 * @param int $length 密码长度 * @return string 生成的密码 * @throws RandomException * @deprecated 函数已弃用, 请使用 secret_password() */ public static function secret_password(int $length = 16): string { return secret_password($length); } /** * 获取插件目录 * @param string $extensionID 插件ID * @return string 插件目录 * @deprecated 函数已弃用, 请使用 extension_path() */ public static function extension_path(string $extensionID = ''): string { return extension_path($extensionID); } /** * * @deprecated 废弃方法,请使用 extension_name_list 方法 */ public static function extension_name_list(): array { return extension_name_list(); } }