### Docker Quick Start for AnQiCMS Source: https://github.com/fesiong/anqicms/blob/master/README.md Deploy AnQiCMS using Docker for a quick and easy experience. Ensure Docker is installed and running on your system. ```bash docker pull anqicms/anqicms:latest docker run -d --name anqicms -p 8001:8001 anqicms/anqicms:latest ``` -------------------------------- ### Start AnQiCMS Application Source: https://context7.com/fesiong/anqicms/llms.txt This example shows how to initialize and start the AnQiCMS application. The `New` function creates an instance listening on a specified port with a given log level, and `Serve` handles the application lifecycle including database migrations, task scheduling, and route mounting. ```go package main import ( anqicms "kandaoni.com/anqicms" ) func main() { // 创建 Bootstrap,监听 8001 端口,日志级别 info app := anqicms.New(8001, "info") // Serve 会自动:初始化数据库迁移、启动定时任务、注册模板标签、挂载路由 app.Serve() } ``` ```go // pugEngine.RegisterTag("archiveList", tags.TagArchiveListParser) // pugEngine.RegisterTag("categoryList", tags.TagCategoryListParser) // pugEngine.RegisterTag("pagination", tags.TagPaginationParser) // pugEngine.AddFunc("priceFormat", tags.PriceFormat) // pugEngine.AddFunc("dateFormat", ...) // pugEngine.AddFunc("range", tags.Range) ``` -------------------------------- ### Get AI Writing Configuration Source: https://context7.com/fesiong/anqicms/llms.txt Retrieves the current AI writing configuration. Requires an administrator JWT token for authorization. ```bash curl "https://example.com/manage/plugin/aigenerate" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" ``` -------------------------------- ### Query: Get All Categories Source: https://github.com/fesiong/anqicms/blob/master/controller/graphql/README.md Retrieve a list of all available categories. ```APIDOC ## Query: Get All Categories ### Description Fetches a list of all categories available in the system. ### GraphQL Query ```graphql query { categories { id title } } ``` ``` -------------------------------- ### AI Writing Configuration and Trigger Source: https://context7.com/fesiong/anqicms/llms.txt Manages AI automatic writing configurations and triggers article generation. Includes endpoints to get, save configurations, and manually trigger generation. ```APIDOC ## AI Writing Management Endpoints ### GET /manage/plugin/aigenerate #### Description Retrieves the AI automatic writing configuration. #### Method GET #### Endpoint /manage/plugin/aigenerate #### Request Example ```bash curl "https://example.com/manage/plugin/aigenerate" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" ``` ### POST /manage/plugin/aigenerate #### Description Saves or updates the AI automatic writing configuration. #### Method POST #### Endpoint /manage/plugin/aigenerate #### Request Body (Details of configuration fields would be listed here if provided in the source) #### Request Example ```bash curl -X POST "https://example.com/manage/plugin/aigenerate" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ ... configuration data ... }' ``` ### POST /manage/plugin/aigenerate/generate #### Description Manually triggers AI article generation based on keywords. This operation is executed asynchronously in the background. #### Method POST #### Endpoint /manage/plugin/aigenerate/generate #### Request Body - **keywords** (string) - Required - Keywords to guide the AI generation. #### Request Example ```bash curl -X POST "https://example.com/manage/plugin/aigenerate/generate" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{"keywords": "AI in content creation"}' ``` ``` -------------------------------- ### Save System Settings Source: https://context7.com/fesiong/anqicms/llms.txt This endpoint allows you to save system-wide settings for your AnQiCMS installation. It accepts a JSON payload with various configuration options. ```APIDOC ## POST /manage/setting/system ### Description Saves system settings including base URL, site name, logo, language, and time zone. ### Method POST ### Endpoint https://example.com/manage/setting/system ### Request Body - **base_url** (string) - Required - The base URL of the website. - **site_name** (string) - Required - The name of the website. - **site_logo** (string) - Optional - The path to the site logo. - **language** (string) - Required - The default language of the site (e.g., "zh-CN"). - **time_zone** (string) - Required - The time zone of the server (e.g., "Asia/Shanghai"). ### Request Example ```json { "base_url": "https://example.com", "site_name": "企业官网", "site_logo": "/uploads/logo.png", "language": "zh-CN", "time_zone": "Asia/Shanghai" } ``` ### Response #### Success Response (200) - **code** (integer) - 0 for success. - **msg** (string) - Success message (e.g., "保存成功"). #### Response Example ```json {"code":0,"msg":"保存成功"} ``` ``` -------------------------------- ### Get Single-Page Categories Source: https://context7.com/fesiong/anqicms/llms.txt Retrieves categories designated for single pages. Requires administrator authentication. ```bash curl "https://example.com/manage/category/list?type=2" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" ``` -------------------------------- ### Get All Document Categories (Tree Structure) Source: https://context7.com/fesiong/anqicms/llms.txt Retrieves all document categories, presented in a hierarchical tree structure. Requires administrator authentication. ```bash curl "https://example.com/manage/category/list?type=1&show_type=0" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" ``` -------------------------------- ### Get Multilingual Site Configuration Source: https://context7.com/fesiong/anqicms/llms.txt Retrieves the current configuration for multilingual site settings, including whether it's enabled, the type (directory, subdomain, or independent domain), and auto-translation status. Requires an administrator JWT token. ```bash curl "https://example.com/manage/plugin/multilang" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" ``` -------------------------------- ### Save Translation Configuration (DeepL) Source: https://context7.com/fesiong/anqicms/llms.txt Saves the translation plugin configuration, specifying the provider, API key, source language, and target languages. This example uses DeepL. Requires an administrator JWT token. ```bash curl -X POST "https://example.com/manage/plugin/translate" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "open": true, "provider": "deepl", "api_key": "YOUR_DEEPL_KEY", "source_language": "zh", "target_languages": ["en", "ja", "ko"] }' ``` -------------------------------- ### Get Sitemap Configuration Source: https://context7.com/fesiong/anqicms/llms.txt Retrieves the current Sitemap configuration, including the type (XML/TXT), auto-build status, sitemap URL, last updated time, and exclusion rules for modules, categories, and pages. Requires an administrator JWT token. ```bash curl "https://example.com/manage/plugin/sitemap" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" ``` -------------------------------- ### Query: Get Articles List Source: https://github.com/fesiong/anqicms/blob/master/controller/graphql/README.md Retrieve a list of articles, with options for filtering and pagination. ```APIDOC ## Query: Get Articles List ### Description Fetches a list of articles, allowing filtering by category and controlling the number of results and offset. ### GraphQL Query ```graphql query { archives(category_id: 1, limit: 10, offset: 0) { id title logo } } ``` ``` -------------------------------- ### Get Translation Configuration Source: https://context7.com/fesiong/anqicms/llms.txt Retrieves the current configuration for the translation plugin, including the provider (e.g., DeepL, Baidu, Google), API key, and source/target languages. Requires an administrator JWT token. ```bash curl "https://example.com/manage/plugin/translate" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" ``` -------------------------------- ### Get Categories Source: https://context7.com/fesiong/anqicms/llms.txt Retrieves a list of available categories for content organization. Requires an API token and a module ID. ```APIDOC ## GET /api/import/categories ### Description Retrieves a list of categories available for content import. ### Method GET ### Endpoint /api/import/categories ### Parameters #### Query Parameters - **token** (string) - Required - API Token for authentication. - **module_id** (integer) - Required - The ID of the module to get categories for. ### Response #### Success Response (200) - **code** (integer) - Response code, 200 indicates success. - **msg** (string) - Success message. - **data** (array) - A list of category objects. - **id** (integer) - The ID of the category. - **parent_id** (integer) - The ID of the parent category. - **title** (string) - The name of the category. #### Response Example ```json {"code":200,"msg":"获取成功","data":[{"id":5,"parent_id":0,"title":"技术文章"}]} ``` ``` -------------------------------- ### Execute GraphQL Query via cURL Source: https://context7.com/fesiong/anqicms/llms.txt Example of executing a GraphQL query using cURL. The query and variables are sent as a JSON payload. ```bash curl -X POST "https://example.com/graphql" \ -H "Content-Type: application/json" \ -d '{ "query": "query GetArchive($urlToken: String!) { archive(url_token: $urlToken, render: true) { id title content views } }", "variables": { "urlToken": "go-concurrency" } }' ``` -------------------------------- ### Get Document List (Paginated, Filtered, Searched) Source: https://context7.com/fesiong/anqicms/llms.txt Retrieves a paginated list of documents with options for category filtering, keyword search, and status filtering. Requires administrator authentication. ```bash curl "https://example.com/manage/archive/list?current=1&pageSize=20&category_id=5&status=ok&sort=id&order=desc" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" ``` -------------------------------- ### Get Favorite Archives (Paginated) Source: https://context7.com/fesiong/anqicms/llms.txt Retrieves a paginated list of user's favorite archives. Requires authentication via a JWT token in the Cookie. ```bash curl "https://example.com/api/archive/favorites?current=1&pageSize=10" \ -H "Cookie: token=USER_JWT_TOKEN" ``` -------------------------------- ### Report Page View Statistics (JavaScript) Source: https://context7.com/fesiong/anqicms/llms.txt Frontend JavaScript example to report page views to the statistics API. The API responds with a 204 No Content status. ```javascript fetch('/api/statistic', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ action: 'views', // 浏览量动作 type: 'archive', // 内容类型:archive=文档 id: 123 // 文档 ID }) }).then(res => { // 正常响应 204 No Content,无需处理返回值 }); ``` -------------------------------- ### Document Collection API Source: https://context7.com/fesiong/anqicms/llms.txt Manage user document collections using frontend APIs. `GET /api/archive/favorites` retrieves favorites, `POST /api/archive/favorite` adds one, and `DELETE /api/archive/favorite` removes one. `POST /api/archive/favorites/check` allows batch checking of favorite status. All these require a valid user login token. ```bash # GET /api/archive/favorites # POST /api/archive/favorite # DELETE /api/archive/favorite # POST /api/archive/favorites/check ``` -------------------------------- ### Import Archive Source: https://context7.com/fesiong/anqicms/llms.txt The POST /api/import/archive endpoint is used to import articles into the CMS. It supports various parameters for content, categorization, and publishing options. It also allows checking for existing articles via a GET request. ```APIDOC ## POST /api/import/archive ### Description Imports an article into the CMS. Supports deduplication by title or URL, with options to overwrite or skip duplicates. Allows specifying custom fields, categories, publish time, and draft mode. ### Method POST ### Endpoint /api/import/archive ### Parameters #### Path Parameters None #### Query Parameters - **token** (string) - Required - API Token for authentication. - **title** (string) - Optional - Title of the article to check for existence. #### Request Body - **token** (string) - Required - API Token for authentication. - **title** (string) - Required - The title of the article. - **category_id** (integer) - Optional - The ID of the category to assign. - **keywords** (string) - Optional - Comma-separated keywords for the article. - **description** (string) - Optional - A short description or excerpt of the article. - **content** (string) - Required - The main content of the article. - **publish_time** (string) - Optional - The desired publish time in 'YYYY-MM-DD HH:MM:SS' format. - **tag** (string) - Optional - Comma-separated tags for the article. - **cover** (integer) - Optional - Strategy for handling duplicate covers: 0 (default, skip), 1 (overwrite). ### Request Example ```bash curl -X POST "https://example.com/api/import/archive" \ -F "token=YOUR_API_TOKEN" \ -F "title=Go 语言并发编程实战" \ -F "category_id=5" \ -F "keywords=Go,并发,goroutine" \ -F "description=深入讲解 Go 语言 goroutine 与 channel 的使用" \ -F "content=
正文内容...
" \ -F "publish_time=2025-06-01 09:00:00" \ -F "tag=Go语言,并发编程" \ -F "cover=0" ``` ### Response #### Success Response (200) - **code** (integer) - Response code, 0 indicates success. - **msg** (string) - Success message. - **data** (object) - Contains details of the published article. - **url** (string) - The URL of the newly published article. - **id** (integer) - The ID of the newly published article. #### Response Example ```json {"code":0,"msg":"发布成功","data":{"url":"/article/123.html","id":123}} ``` ## GET /api/import/archive ### Description Checks if an article with the given title already exists. ### Method GET ### Endpoint /api/import/archive ### Parameters #### Query Parameters - **token** (string) - Required - API Token for authentication. - **title** (string) - Required - The title of the article to check. ### Response #### Success Response (200) - **code** (integer) - Response code, 0 indicates success. - **data** (object) - Contains details if the article exists. - **id** (integer) - The ID of the existing article. - **title** (string) - The title of the existing article. ``` -------------------------------- ### Save System Settings via API Source: https://context7.com/fesiong/anqicms/llms.txt Use this POST request to save system settings. Ensure you include the correct Authorization header and Content-Type. ```bash curl -X POST "https://example.com/manage/setting/system" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "base_url": "https://example.com", "site_name": "企业官网", "site_logo": "/uploads/logo.png", "language": "zh-CN", "time_zone": "Asia/Shanghai" }' ``` -------------------------------- ### Create Category Source: https://context7.com/fesiong/anqicms/llms.txt Creates a new category with specified details including title, parent, module binding, URL token, and SEO fields. Requires administrator authentication. ```bash curl -X POST "https://example.com/manage/category/detail" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "title": "Rust 语言", "parent_id": 1, "module_id": 1, "url_token": "rust", "seo_title": "Rust 语言教程", "keywords": "Rust,系统编程", "description": "Rust 语言相关技术文章", "status": 1 }' ``` -------------------------------- ### Query: Get Category Source: https://github.com/fesiong/anqicms/blob/master/controller/graphql/README.md Retrieve a single category by its ID. ```APIDOC ## Query: Get Category ### Description Fetches a specific category using its unique identifier. ### GraphQL Query ```graphql query { category(id: 1) { id title description } } ``` ``` -------------------------------- ### Dynamic image storage path configuration Source: https://github.com/fesiong/anqicms/blob/master/CHANGELOG.md The system allows for dynamic configuration of the image storage path. ```html 支持动态更改图片存储路径 ``` -------------------------------- ### Query: Get Article Source: https://github.com/fesiong/anqicms/blob/master/controller/graphql/README.md Retrieve a single article by its ID. ```APIDOC ## Query: Get Article ### Description Fetches a specific article using its unique identifier. ### GraphQL Query ```graphql query { archive(id: 1) { id title content publish_time } } ``` ``` -------------------------------- ### AI Writing Configuration Source: https://context7.com/fesiong/anqicms/llms.txt Manage AI writing configurations, including retrieving current settings and saving new configurations. ```APIDOC ## GET /manage/plugin/aigenerate ### Description Retrieves the current AI writing configuration. ### Method GET ### Endpoint /manage/plugin/aigenerate ### Request Example ```bash curl "https://example.com/manage/plugin/aigenerate" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" ``` ### Response #### Success Response (200) - **data** (object) - Contains AI writing configuration details like open status, API type, model, etc. ### Response Example ```json { "code": 0, "data": { "open": true, "api_type": "openai", "model": "gpt-4o", "auto_publish": true, "...": "..." } } ``` ``` ```APIDOC ## POST /manage/plugin/aigenerate ### Description Saves the AI writing configuration. ### Method POST ### Endpoint /manage/plugin/aigenerate ### Parameters #### Request Body - **open** (boolean) - Required - Whether to open AI writing. - **api_type** (string) - Required - The type of API to use (e.g., "openai"). - **api_key** (string) - Required - The API key for the AI service. - **model** (string) - Required - The AI model to use. - **auto_publish** (boolean) - Required - Whether to auto-publish generated content. - **daily_limit** (integer) - Optional - The daily limit for AI generation. ### Request Example ```bash curl -X POST "https://example.com/manage/plugin/aigenerate" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "open": true, "api_type": "openai", "api_key": "sk-xxxx", "model": "gpt-4o", "auto_publish": true, "daily_limit": 50 }' ``` ### Response #### Success Response (200) - **msg** (string) - Success message. ### Response Example ```json { "code": 0, "msg": "保存成功" } ``` ``` ```APIDOC ## POST /manage/plugin/aigenerate/generate ### Description Manually triggers AI generation for a specified keyword. ### Method POST ### Endpoint /manage/plugin/aigenerate/generate ### Parameters #### Request Body - **id** (integer) - Required - The ID of the keyword to trigger generation for. ### Request Example ```bash curl -X POST "https://example.com/manage/plugin/aigenerate/generate" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{"id": 23}' ``` ### Response #### Success Response (200) - **msg** (string) - Success message indicating the task has been triggered. ### Response Example ```json { "code": 0, "msg": "AI 生成任务已触发" } ``` ``` -------------------------------- ### Token Authentication for Content Import API Source: https://context7.com/fesiong/anqicms/llms.txt Demonstrates three methods for authenticating API requests using tokens: as a form parameter, a URL parameter, or a custom header for friend links. ```bash # 方式一:表单参数传 token curl -X POST "https://example.com/api/import/archive" \ -F "token=abc123secret" \ -F "title=测试文章" ... ``` ```bash # 方式二:URL 参数传 token curl "https://example.com/api/import/categories?token=abc123secret" ``` ```bash # 方式三:友链接口使用 didi-token 请求头 curl -X POST "https://example.com/api/import/friendlink" \ -H "didi-token: link_secret_token" \ -F "title=合作伙伴" \ -F "link=https://partner.com" ``` -------------------------------- ### Read System Settings Source: https://context7.com/fesiong/anqicms/llms.txt Reads the basic system settings of the site, including the base URL, site name, language, and favicon. It also retrieves the list of available language packages. Requires an administrator JWT token. ```bash curl "https://example.com/manage/setting/system" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" ``` -------------------------------- ### System tag header parameter support Source: https://github.com/fesiong/anqicms/blob/master/CHANGELOG.md The `system` tag now supports reading header parameters, providing more dynamic data access. ```html [新增] system标签增加支持读取Header参数 ``` -------------------------------- ### GraphQL API - Get Archive Source: https://context7.com/fesiong/anqicms/llms.txt This GraphQL query retrieves detailed information about a specific archive (document) and its associated page metadata. ```APIDOC ## GraphQL Query: GetArchive ### Description Retrieves detailed information for a specific archive using its URL token, including page metadata like title, keywords, and description, as well as archive content, creation time, and views. ### Method POST ### Endpoint https://example.com/graphql ### Query Parameters - **query** (string) - Required - The GraphQL query string. - **variables** (object) - Optional - Variables to be used in the query. - **urlToken** (string) - Required - The unique token identifying the archive. ### Request Example ```json { "query": "query GetArchive($urlToken: String!) { archive(url_token: $urlToken, render: true) { id title content views } }", "variables": { "urlToken": "go-concurrency" } } ``` ### Response #### Success Response (200) - **data** (object) - Contains the query results. - **archive** (object) - Details of the archive. - **id** (integer) - The unique identifier of the archive. - **title** (string) - The title of the archive. - **content** (string) - The HTML content of the archive. - **views** (integer) - The number of views the archive has received. #### Response Example ```json {"data":{"archive":{"id":123,"title":"Go 语言并发编程实战","content":"...
","views":1024}}} ``` ``` -------------------------------- ### Order process enhancement for guest checkout Source: https://github.com/fesiong/anqicms/blob/master/CHANGELOG.md Optimized the order placement process to support guest checkout and payment without requiring login. ```html 优化 下单流程,支持免登录下单及支付。 ``` -------------------------------- ### System Settings Source: https://context7.com/fesiong/anqicms/llms.txt Manage global system settings, including site information and available languages. ```APIDOC ## GET /manage/setting/system ### Description Reads basic site information (domain, logo, language) and the list of available language packs. ### Method GET ### Endpoint /manage/setting/system ### Request Example ```bash curl "https://example.com/manage/setting/system" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" ``` ### Response #### Success Response (200) - **data** (object) - Contains system settings including base URL, site name, language, favicon, and a list of available languages. ### Response Example ```json { "code": 0, "data": { "system": { "base_url": "https://example.com", "site_name": "我的站点", "language": "zh-CN", "favicon": "https://example.com/favicon.ico" }, "languages": [ "zh-CN", "en-US", "ja-JP" ] } } ``` ``` ```APIDOC ## POST /manage/setting/system ### Description Saves the global site configuration. ### Method POST ### Endpoint /manage/setting/system ### Parameters #### Request Body - **system** (object) - Required - Contains system configuration fields like `base_url`, `site_name`, `language`, `favicon`. - **languages** (array of strings) - Required - A list of available language codes for the site. ### Request Example ```bash curl -X POST "https://example.com/manage/setting/system" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "system": { "base_url": "https://example.com", "site_name": "我的站点", "language": "zh-CN", "favicon": "https://example.com/favicon.ico" }, "languages": ["zh-CN", "en-US", "ja-JP"] }' ``` ### Response #### Success Response (200) - **msg** (string) - Success message. ### Response Example ```json { "code": 0, "msg": "保存成功" } ``` ``` -------------------------------- ### Dynamic image storage path Source: https://github.com/fesiong/anqicms/blob/master/CHANGELOG.md The system now supports dynamically changing the storage path for images, offering flexibility in asset management. ```html Supports dynamically changing image storage path ``` -------------------------------- ### Get Favorites List (Paginated) Source: https://context7.com/fesiong/anqicms/llms.txt Retrieves a paginated list of the user's favorite archives. Supports specifying current page and page size. ```APIDOC ## GET /api/archive/favorites ### Description Retrieves a paginated list of the user's favorite archives. ### Method GET ### Endpoint /api/archive/favorites ### Query Parameters - **current** (integer) - Required - The current page number. - **pageSize** (integer) - Required - The number of items per page. ### Request Example ```bash curl "https://example.com/api/archive/favorites?current=1&pageSize=10" \ -H "Cookie: token=USER_JWT_TOKEN" ``` ### Response #### Success Response (200) - **code** (integer) - Response code. - **data** (array) - List of favorite archives. - **archive_id** (integer) - The ID of the archive. - **title** (string) - The title of the archive. - **total** (integer) - The total number of favorite archives. ``` -------------------------------- ### Import Article via API Source: https://context7.com/fesiong/anqicms/llms.txt Use the `POST /api/import/archive` endpoint to import articles. Authentication is done via a `token`. The `cover` parameter controls whether to overwrite existing articles (1) or skip them (2). Custom fields, multiple categories, scheduled publishing, and draft mode are supported. ```bash # 导入一篇文章(使用 API Token 鉴权) curl -X POST "https://example.com/api/import/archive" \ -F "token=YOUR_API_TOKEN" \ -F "title=Go 语言并发编程实战" \ -F "category_id=5" \ -F "keywords=Go,并发,goroutine" \ -F "description=深入讲解 Go 语言 goroutine 与 channel 的使用" \ -F "content=正文内容...
" \ -F "publish_time=2025-06-01 09:00:00" \ -F "tag=Go语言,并发编程" \ -F "cover=0" ``` ```json # 成功响应 # {"code":0,"msg":"发布成功","data":{"url":"/article/123.html","id":123}} ``` ```bash # 查询文章是否已存在(GET 方式) curl "https://example.com/api/import/archive?token=YOUR_API_TOKEN&title=Go+语言并发编程实战" ``` ```json # {"code":0,"data":{"id":123,"title":"Go 语言并发编程实战",...}} ``` ```bash # 获取分类列表 curl "https://example.com/api/import/categories?token=YOUR_API_TOKEN&module_id=1" ``` ```json # {"code":200,"msg":"获取成功","data":[{"id":5,"parent_id":0,"title":"技术文章"}]} ``` -------------------------------- ### Enhance navigation with custom styles and multi-level configuration Source: https://github.com/fesiong/anqicms/blob/master/CHANGELOG.md Navigation functionality is enhanced to support custom styles and multi-level configurations. ```html 增强 导航功能,现支持自定义样式与配置多级导航。 ``` -------------------------------- ### Sitemap Configuration Source: https://context7.com/fesiong/anqicms/llms.txt Configure Sitemap generation, including type, build settings, and exclusions. ```APIDOC ## GET /manage/plugin/sitemap ### Description Retrieves the current Sitemap configuration and last update time. ### Method GET ### Endpoint /manage/plugin/sitemap ### Request Example ```bash curl "https://example.com/manage/plugin/sitemap" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" ``` ### Response #### Success Response (200) - **data** (object) - Contains Sitemap configuration details like type, auto_build status, sitemap URL, updated time, and exclusion rules. ### Response Example ```json { "code": 0, "data": { "type": "xml", "auto_build": true, "sitemap_url": "https://example.com/sitemap.xml", "updated_time": 1748390400, "exclude_module_ids": [], "exclude_category_ids": [10] } } ``` ``` ```APIDOC ## POST /manage/plugin/sitemap ### Description Saves the Sitemap configuration. ### Method POST ### Endpoint /manage/plugin/sitemap ### Parameters #### Request Body - **type** (string) - Required - The type of sitemap (e.g., "xml", "txt"). - **auto_build** (boolean) - Required - Whether to automatically build the sitemap. - **exclude_tag** (boolean) - Optional - Whether to exclude tags. - **exclude_module_ids** (array of integers) - Optional - IDs of modules to exclude. - **exclude_category_ids** (array of integers) - Optional - IDs of categories to exclude. - **exclude_page_ids** (array of integers) - Optional - IDs of pages to exclude. ### Request Example ```bash curl -X POST "https://example.com/manage/plugin/sitemap" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "type": "xml", "auto_build": true, "exclude_tag": false, "exclude_module_ids": [], "exclude_category_ids": [10, 11], "exclude_page_ids": [] }' ``` ### Response #### Success Response (200) - **msg** (string) - Success message. ### Response Example ```json { "code": 0, "msg": "保存成功" } ``` ``` -------------------------------- ### Get attachment details with attachment tag Source: https://github.com/fesiong/anqicms/blob/master/CHANGELOG.md The `attachment` tag retrieves comprehensive information about an attachment, including its path, filename, dimensions, and size, for use in templates. ```html {% attachment %} ``` -------------------------------- ### Enable Directory Mode Multilingual Site (Auto-Translate) Source: https://context7.com/fesiong/anqicms/llms.txt Enables multilingual site support using the directory mode and enables automatic translation. This configuration sets the default language and specifies how sub-sites are handled. Requires an administrator JWT token. ```bash curl -X POST "https://example.com/manage/plugin/multilang" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "open": true, "type": "directory", "site_type": "multi", "auto_translate": true, "default_language": "zh-CN", "show_main_dir": false }' ``` -------------------------------- ### Mutation: Create Article Source: https://github.com/fesiong/anqicms/blob/master/controller/graphql/README.md Create a new article with specified title, content, and category. ```APIDOC ## Mutation: Create Article ### Description Creates a new article entry in the system. ### GraphQL Mutation ```graphql mutation { createArchive( title: "New Article Title", content: "Article content", category_id: 1 ) { id title } } ``` ``` -------------------------------- ### Get Document List (Management) Source: https://context7.com/fesiong/anqicms/llms.txt Retrieves a list of documents with pagination, filtering by category, keyword search, and status. Supports full-text search and filtering for collected articles. ```APIDOC ## GET /manage/archive/list ### Description Retrieves a list of documents with pagination, filtering by category, keyword search, and status. Supports full-text search and filtering for collected articles. ### Method GET ### Endpoint /manage/archive/list ### Query Parameters - **current** (integer) - Optional - The current page number. - **pageSize** (integer) - Optional - The number of items per page. - **category_id** (integer) - Optional - Filter by category ID. - **status** (string) - Optional - Filter by document status (e.g., 'ok', 'draft', 'recycle'). - **sort** (string) - Optional - Field to sort by (e.g., 'id'). - **order** (string) - Optional - Sort order ('asc' or 'desc'). - **title** (string) - Optional - Search by document title (full-text search). - **recycle** (boolean) - Optional - Set to true to view documents in the recycle bin. ### Request Example ```bash # Get page 1, 20 items per page, category ID 5, sorted by ID descending curl "https://example.com/manage/archive/list?current=1&pageSize=20&category_id=5&status=ok&sort=id&order=desc" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" # Full-text search for 'Go concurrency' curl "https://example.com/manage/archive/list?current=1&pageSize=10&title=Go+并发" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" # View drafts curl "https://example.com/manage/archive/list?status=draft" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" # View recycle bin curl "https://example.com/manage/archive/list?recycle=true" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" ``` ### Response #### Success Response (200) - **code** (integer) - Response code. - **total** (integer) - Total number of documents found. - **data** (array) - List of documents. - **id** (integer) - Document ID. - **title** (string) - Document title. - **status** (integer) - Document status. - **created_time** (integer) - Creation timestamp. ``` -------------------------------- ### GraphQL Playground Source: https://github.com/fesiong/anqicms/blob/master/controller/graphql/README.md Access the interactive GraphQL Playground for development and debugging. ```APIDOC ## GraphQL Playground ### Endpoint `/api/v2/playground` ### Description Use this endpoint to interactively test GraphQL queries and mutations, and browse the API schema. ``` -------------------------------- ### Add cwebp executable permission check Source: https://github.com/fesiong/anqicms/blob/master/CHANGELOG.md Added a check for executable permissions for the `cwebp` binary to ensure proper operation. ```html 增加 `cwebp` 可执行权限检查 ``` -------------------------------- ### User Registration and Login API Source: https://context7.com/fesiong/anqicms/llms.txt The `POST /api/register` endpoint creates new user accounts, supporting email verification. `POST /api/login` handles password-based login and third-party authentications (WeChat, Google). Successful logins set a Token in cookies, valid for 24 hours or 30 days if 'remember me' is selected. ```bash # 用户名密码注册 curl -X POST "https://example.com/api/register" \ -H "Content-Type: application/json" \ -d '{ "user_name": "zhangsan", "password": "Abc12345", "email": "zhangsan@example.com" }' ``` ```json # {"code":0,"msg":"","data":{"id":10,"user_name":"zhangsan","token":"eyJ..."}} ``` ```bash # 密码登录(记住30天) curl -X POST "https://example.com/api/login" \ -H "Content-Type: application/json" \ -d '{ "user_name": "zhangsan", "password": "Abc12345", "remember": true }' ``` ```json # {"code":0,"msg":"","data":{"id":10,"user_name":"zhangsan","token":"eyJ..."}} ``` ```bash # 微信小程序登录 curl -X POST "https://example.com/api/login" \ -H "Content-Type: application/json" \ -d '{ "platform": "weapp", "code": "wx_oauth_code_from_client" }' ``` ```json # {"code":0,"msg":"","data":{"id":11,"user_name":"wx_user_xxx","token":"eyJ..."}} ``` -------------------------------- ### Flexible rewrite rules for pseudo-static Source: https://github.com/fesiong/anqicms/blob/master/CHANGELOG.md The pseudo-static processing rules have been rewritten for more flexible configuration, including support for custom rules per model. ```html Rewritten pseudo-static processing rules for more flexible configuration, supporting custom rules per model. ``` -------------------------------- ### Website migration from Xunrui CMS Source: https://github.com/fesiong/anqicms/blob/master/CHANGELOG.md Added support for migrating data from Xunrui CMS to AnQiCMS. ```html 新增支持从迅睿 CMS 迁移数据到 AnQiCMS。 ``` -------------------------------- ### Generate Sitemap via API Source: https://context7.com/fesiong/anqicms/llms.txt Trigger Sitemap regeneration using `POST /api/import/sitemap`. Set `async=true` for asynchronous execution, which returns immediately. Otherwise, it waits for completion and returns the Sitemap URL and update time. ```bash # 同步生成 Sitemap curl -X POST "https://example.com/api/import/sitemap" \ -F "token=YOUR_API_TOKEN" ``` ```json # { # "code": 0, # "msg": "Sitemap 已更新", # "data": { # "type": "xml", # "sitemap_url": "https://example.com/sitemap.xml", # "updated_time": 1748390400 # } # } ``` ```bash # 异步生成(适合文章量大的站点) curl -X POST "https://example.com/api/import/sitemap" \ -F "token=YOUR_API_TOKEN" \ -F "async=true" ``` ```json # {"code":0,"msg":"已提交后台处理"} ``` -------------------------------- ### Implement underlying system optimization Source: https://github.com/fesiong/anqicms/blob/master/CHANGELOG.md Implemented underlying system optimizations to effectively improve page loading speed and reduce system IO resource consumption. ```html 实施底层系统优化:有效提升页面加载速度,并降低系统IO资源占用。 ``` -------------------------------- ### View Draft Documents Source: https://context7.com/fesiong/anqicms/llms.txt Retrieves a list of documents currently in draft status. Requires administrator authentication. ```bash curl "https://example.com/manage/archive/list?status=draft" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" ``` -------------------------------- ### Batch document operations Source: https://github.com/fesiong/anqicms/blob/master/CHANGELOG.md Supports batch adding tags to documents. ```html 支持批量添加文档标签。 ``` -------------------------------- ### Customizable navigation styles and multi-level support Source: https://github.com/fesiong/anqicms/blob/master/CHANGELOG.md Navigation features are enhanced to support custom styling and multi-level configurations, including up to 4 levels. ```html Enhanced navigation functionality, now supporting custom styles and multi-level configurations (up to 4 levels). ``` -------------------------------- ### Navigation thumbnail and level support Source: https://github.com/fesiong/anqicms/blob/master/CHANGELOG.md Navigation menus now support thumbnails and can be structured up to 4 levels deep. ```html 导航支持缩略图及 4 级层级结构 ``` -------------------------------- ### Optimize document preview stability and display Source: https://github.com/fesiong/anqicms/blob/master/CHANGELOG.md Enhanced the document preview function for improved stability and display effects. ```html 优化文档预览功能:提升预览页面的稳定性和显示效果。 ``` -------------------------------- ### Customizable robots.txt Source: https://github.com/fesiong/anqicms/blob/master/CHANGELOG.md Removed automatic generation logic for robots.txt, allowing users to customize the file for more flexible search engine crawling control. ```html 移除自动生成逻辑,用户可自定义 robots.txt 文件,更灵活地控制搜索引擎抓取。 ``` -------------------------------- ### Multilingual Site Configuration Source: https://context7.com/fesiong/anqicms/llms.txt Configure multilingual site settings, including mode and automatic translation. ```APIDOC ## GET /manage/plugin/multilang ### Description Retrieves the multilingual site configuration. ### Method GET ### Endpoint /manage/plugin/multilang ### Request Example ```bash curl "https://example.com/manage/plugin/multilang" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" ``` ### Response #### Success Response (200) - **data** (object) - Contains multilingual site configuration details like open status, type, auto-translate setting, default language, and sub-site configurations. ### Response Example ```json { "code": 0, "data": { "open": true, "type": "directory", "auto_translate": true, "site_type": "multi", "default_language": "zh-CN", "sub_sites": [ "..." ] } } ``` ``` ```APIDOC ## POST /manage/plugin/multilang ### Description Saves the multilingual site configuration. ### Method POST ### Endpoint /manage/plugin/multilang ### Parameters #### Request Body - **open** (boolean) - Required - Whether to enable multilingual sites. - **type** (string) - Required - The mode for multilingual sites (e.g., "directory", "subdomain", "domain"). - **site_type** (string) - Required - Type of site, e.g., "multi". - **auto_translate** (boolean) - Required - Whether to enable automatic translation. - **default_language** (string) - Required - The default language code. - **show_main_dir** (boolean) - Optional - Whether to show the main directory. ### Request Example ```bash curl -X POST "https://example.com/manage/plugin/multilang" \ -H "Authorization: Bearer ADMIN_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "open": true, "type": "directory", "site_type": "multi", "auto_translate": true, "default_language": "zh-CN", "show_main_dir": false }' ``` ### Response #### Success Response (200) - **msg** (string) - Success message. ### Response Example ```json { "code": 0, "msg": "保存成功" } ``` ``` -------------------------------- ### AI writing prompt logic optimization Source: https://github.com/fesiong/anqicms/blob/master/CHANGELOG.md Optimized the AI writing prompt logic, prioritizing user-defined requirements. ```html 优化 AI写作提示词逻辑,优先采用用户自定义的要求。 ``` -------------------------------- ### Query All Categories Source: https://github.com/fesiong/anqicms/blob/master/controller/graphql/README.md Fetch a list of all available categories, including their IDs and titles. ```graphql query { categories { id title } } ```