- 添加新的订单确认页面模板 (order_confirm.html) - 启用 remixicon 图标库的样式引用 - 将成功图标从 ri-check-line 更新为 ri-check-double-fill- 添加 CLAUDE.md 开发指南文件 - 添加 Claude Code 本地设置文件
3.3 KiB
3.3 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Development Commands
Build and Run
# Build for production (Linux AMD64)
./build.sh
# Development mode
go run main.go
# Docker build
docker build -t kami_shop . -f deploy/Dockerfile
Testing
# Run all tests
go test ./...
# Run specific test file
go test ./internal/service/scan_shop_test.go
# Run tests with verbose output
go test -v ./...
Docker Deployment
# Build and deploy with Docker Compose
export VERSION=latest
docker-compose -f deploy/docker-compose.yaml up -d
Project Architecture
This is a payment processing platform built with Go and Beego framework, supporting multiple payment methods including WeChat Pay, Alipay, JD.com, Taobao, Pinduoduo, Apple Pay, Walmart, and various gift cards.
Key Components
Application Structure:
main.go- Application entry point with OpenTelemetry initializationinternal/controllers/- HTTP handlers for payment processinginternal/service/- Business logic layerinternal/models/- Data models and database operationsinternal/routers/- Route definitionsviews/- HTML templates for payment pages (30+ payment method templates)conf/- Configuration files (app.conf for production, app.local.conf for development)
External Dependencies:
- Database: MySQL (development:
juhe_pay, production:kami) - Cache: Redis for session management and caching
- Gateway Service:
http://localhost:12309(development) /http://127.0.0.1:12309(production) - Partial Service:
http://localhost:12310(development) /http://127.0.0.1:12310(production)
Configuration
Development (conf/app.local.conf):
- Port: 12305, Host: localhost
- Database: MySQL on localhost:3306
- Redis: localhost:6379
- Run mode: dev
Production (conf/app.conf):
- Port: 12305, Host: 0.0.0.0
- Database: MySQL on 127.0.0.1:3306
- Redis: redis:6379 (Docker service)
- Run mode: prod
Technology Stack
- Framework: Beego v2.3.7
- Language: Go 1.23.0
- Observability: Complete OpenTelemetry stack (tracing, metrics, logging)
- Logging: Zap structured logging
- Concurrency: Goroutine pooling with ants/v2
- Security: AES encryption, Edwards25519 cryptographic operations
Development Patterns
Code Organization:
- Controllers handle HTTP requests and validation
- Service layer implements business logic
- Models manage data persistence
- Utils provide common functionality
- Schema defines request/response structures
Testing Strategy:
- Unit tests focused on service layer
- Test files follow
*_test.gonaming convention - Use standard Go testing package
Payment Processing Flow
- Order creation through controller endpoints
- Service layer processes payment logic
- Integration with external payment gateways
- Notification handling for payment callbacks
- Template-based payment page generation
- Profit margin calculation and reporting
Deployment
Docker Environment:
- Multi-stage build using golang:1.23 builder
- Alpine Linux runtime image
- Volume mounts for configuration and logs
- Network: 1panel-network
- Health checks and automatic restarts
CI/CD:
- Drone CI pipeline with SSH deployment
- Docker image registry push
- Production server deployment via Docker Compose