Name: zero-gateway Host: 0.0.0.0 Port: 8889 Log: Encoding: plain Mode: console # system-rpc 连接(用于写入操作日志) SystemRpc: Etcd: Hosts: - 192.168.100.127:2379 Key: system.rpc # JWT 密钥(与各 API 服务 Auth.AccessSecret 一致) JwtSecret: "9149f2eb-d517-4a50-a03a-231dbcf0d872" # 跨域配置 Cors: AllowOrigins: - "*" AllowMethods: - GET - POST - PUT - DELETE - OPTIONS AllowHeaders: - Content-Type - Authorization - X-Requested-With - X-Client-Id # 鉴权白名单(无需 Token 的路径,精确匹配) AuthWhitelist: - /api/auth/login - /api/auth/loginByPhone - /api/auth/miniLogin - /api/auth/captcha - /api/plant/callback/wechatpay # 上游服务路由表(使用 go-zero 官方 HTTP 网关配置) Upstreams: # ==================== Auth API (9001) ==================== - Name: auth-api Http: Target: 192.168.100.4:9001 Prefix: /api/auth Timeout: 5000 Mappings: # 无需鉴权 - Method: POST Path: /miniLogin - Method: POST Path: /loginByPhone - Method: POST Path: /login - Method: GET Path: /captcha # 需要鉴权 - Method: GET Path: /info - Method: POST Path: /update - Method: POST Path: /changePassword - Method: GET Path: /location - Method: GET Path: /weather # ==================== File API (9002) ==================== - Name: file-api Http: Target: 192.168.100.4:9002 Prefix: /api/file Timeout: 30000 Mappings: - Method: POST Path: /upload - Method: POST Path: /delete - Method: POST Path: /list - Method: GET Path: /:id # ==================== System API (9003) ==================== - Name: system-api Http: Target: 192.168.100.4:9003 Prefix: /api/sys Timeout: 5000 Mappings: # 客户端管理 - Method: POST Path: /client/create - Method: POST Path: /client/update - Method: POST Path: /client/delete - Method: POST Path: /client/list # 角色管理 - Method: POST Path: /role/create - Method: POST Path: /role/update - Method: POST Path: /role/delete - Method: POST Path: /role/list # 菜单管理 - Method: POST Path: /menu/create - Method: POST Path: /menu/update - Method: POST Path: /menu/delete - Method: GET Path: /menu/list - Method: POST Path: /menu/byRole # 操作日志 - Method: POST Path: /log/list - Method: POST Path: /log/delete # 字典管理 - Method: POST Path: /dict/create - Method: POST Path: /dict/update - Method: POST Path: /dict/delete - Method: POST Path: /dict/list # 用户管理 - Method: POST Path: /user/list - Method: POST Path: /user/create - Method: POST Path: /user/update - Method: POST Path: /user/delete - Method: POST Path: /user/resetPassword # ==================== Plant API (9004) ==================== - Name: plant-api Http: Target: 192.168.100.4:9004 Prefix: /api/plant Timeout: 10000 Mappings: # 回调(无鉴权) - Method: POST Path: /callback/wechatpay # 我的植物 - Method: POST Path: /my/create - Method: POST Path: /my/update - Method: POST Path: /my/delete - Method: POST Path: /my/list - Method: GET Path: /my/:id - Method: POST Path: /my/carePlan - Method: POST Path: /my/careRecord - Method: POST Path: /my/growthRecord # 百科 - Method: POST Path: /wiki/list - Method: GET Path: /wiki/:id - Method: GET Path: /wiki/class/list - Method: POST Path: /wiki/class/create - Method: POST Path: /wiki/star # 帖子 - Method: POST Path: /post/create - Method: POST Path: /post/list - Method: GET Path: /post/:id - Method: POST Path: /post/delete - Method: POST Path: /post/comment - Method: POST Path: /post/like # 话题 - Method: GET Path: /topic/list - Method: POST Path: /topic/create - Method: POST Path: /topic/delete # OCR - Method: POST Path: /ocr/classify # 兑换 - Method: POST Path: /exchange/list - Method: POST Path: /exchange/order # AI - Method: POST Path: /ai/chat - Method: GET Path: /ai/history # 用户资料 - Method: GET Path: /profile/info - Method: POST Path: /profile/update # 等级/徽章配置 - Method: POST Path: /config/level/list - Method: POST Path: /config/badge/list