- 优化API参考文档的段落排版和表格对齐 - 补充签名机制和支付接口的详细说明- 完善错误码与解决方案的描述 - 统一文档中的代码引用和示例格式 docs(beego):优化Beego框架集成文档结构 - 改进Beego框架文档的换行和段落布局 - 完善控制器继承和中间件集成的说明 - 优化ORM模型注册和路由机制的描述- 统一文档中的技术术语表达方式 docs(docker): 改进Docker部署指南文档格式 - 优化Dockerfile多阶段构建的描述 - 完善docker-compose配置文件说明 - 改进本地部署步骤和故障排除指南- 统一文档中的命令行示例格式feat(supplier): 新增LianIns卡发送任务类型- 在枚举中添加SendCardTaskTypeEnumLianIns类型 - 更新GetAllSendCardTaskType函数返回值 - 实现LianIns任务类型的工厂方法 chore(deps): 更新项目依赖版本 - 升级github.com/bytedance/sonic至v1.14.2 - 升级github.com/duke-git/lancet/v2至v2.3.8 - 升级github.com/bytedance/sonic/loader至v0.4.0 - 移除natefinch/lumberjack和yaml.v2依赖- 清理间接依赖中的toml库引用
5.3 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
This is a payment gateway system built with Go using the Beego framework. It handles payment processing, order management, and supplier integration for various payment methods including gift cards and other payment channels.
Development Commands
Building and Running
# Build the application
./build.sh
# Run the application
go run main.go
# Run tests
go test ./...
# Run tests with coverage
go test -cover ./...
# Run specific test
go test ./internal/service/supplier/third_party -run TestAppleSupplier
Docker Operations
# Build Docker image
docker build -f deploy/Dockerfile -t kami-gateway .
# Run with Docker (adjust environment variables as needed)
docker run -p 12309:12309 \
-e serverName="Development" \
-e gatewayAddr="http://localhost:12309" \
-e portalAddr="http://localhost:12310" \
-e shopAddr="http://localhost:12311" \
kami-gateway
Architecture Overview
Core Components
-
Controllers (
internal/controllers/): HTTP request handlersbase_controller.go: Base controller with common functionalitypayfor_controller.go: Payment processing endpoints
-
Services (
internal/service/): Business logic layerbackend/: Backend management servicespay_for/: Payment processing servicessupplier/: Third-party supplier integrationsnotify/: Order notification handling
-
Models (
internal/models/): Data models and database operationsorder/: Order-related modelsmerchant/: Merchant managementaccounts/: Account managementsystem/: System configuration
-
Supplier Integration (
internal/service/supplier/third_party/):- Multiple payment supplier implementations (Apple, Walmart, etc.)
- Pool-based order processing system
- Queue-based task management
Key Dependencies
- Beego v2: Web framework
- OpenTelemetry: Distributed tracing
- Redis: Caching and session management
- MySQL: Primary database
- Prometheus: Metrics collection
Configuration
The application uses environment variables for configuration:
serverName: Server identifiergatewayAddr: Gateway service addressportalAddr: Portal service addressshopAddr: Shop service addressproxy*: Proxy configuration for external requests
Database Schema
The system uses MySQL with the following main entities:
- Orders and order settlements
- Merchant accounts and configurations
- Agent profit tracking
- Payment channel management
Testing
The project includes unit tests for critical components:
- Supplier integration tests (
*_test.gofiles) - Utility function tests
- Service layer tests
CLAUDE.md (中文版本)
此文件为 Claude Code (claude.ai/code) 在此代码库中工作时提供指导。
项目概述
这是一个使用 Go 和 Beego 框架构建的支付网关系统。它处理支付处理、订单管理和供应商集成,支持各种支付方式包括礼品卡和其他支付渠道。
开发命令
构建和运行
# 构建应用程序
./build.sh
# 运行应用程序
go run main.go
# 运行测试
go test ./...
# 运行测试并生成覆盖率报告
go test -cover ./...
# 运行特定测试
go test ./internal/service/supplier/third_party -run TestAppleSupplier
Docker 操作
# 构建 Docker 镜像
docker build -f deploy/Dockerfile -t kami-gateway .
# 使用 Docker 运行(根据需要调整环境变量)
docker run -p 12309:12309 \
-e serverName="Development" \
-e gatewayAddr="http://localhost:12309" \
-e portalAddr="http://localhost:12310" \
-e shopAddr="http://localhost:12311" \
kami-gateway
架构概述
核心组件
-
控制器 (
internal/controllers/): HTTP 请求处理器base_controller.go: 具有通用功能的基础控制器payfor_controller.go: 支付处理端点
-
服务层 (
internal/service/): 业务逻辑层backend/: 后台管理服务pay_for/: 支付处理服务supplier/: 第三方供应商集成notify/: 订单通知处理
-
模型 (
internal/models/): 数据模型和数据库操作order/: 订单相关模型merchant/: 商户管理accounts/: 账户管理system/: 系统配置
-
供应商集成 (
internal/service/supplier/third_party/):- 多个支付供应商实现(Apple、Walmart 等)
- 基于池的订单处理系统
- 基于队列的任务管理
主要依赖项
- Beego v2: Web 框架
- OpenTelemetry: 分布式追踪
- Redis: 缓存和会话管理
- MySQL: 主数据库
- Prometheus: 指标收集
配置
应用程序使用环境变量进行配置:
serverName: 服务器标识符gatewayAddr: 网关服务地址portalAddr: 门户服务地址shopAddr: 商店服务地址proxy*: 外部请求的代理配置
数据库架构
系统使用 MySQL,包含以下主要实体:
- 订单和订单结算
- 商户账户和配置
- 代理商利润跟踪
- 支付渠道管理
测试
项目包含关键组件的单元测试:
- 供应商集成测试(
*_test.go文件) - 工具函数测试
- 服务层测试