6da6964451
- Go/Gin/GORM + 纯 Go SQLite(无 cgo) - Channel 多渠道接口:支付宝当面付(precreate)/电脑网站支付(page.pay) 已实现,微信占位 - 多商户 merchants 表,回调验签+金额核对+幂等+查单兜底 - 收款页/结果页/二维码端点;docs/ 设计文档与部署 Runbook - 密钥走环境变量/Bitwarden,不入库 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
18 lines
389 B
Go
18 lines
389 B
Go
package util
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// RespondError 结构化错误:{"code":..,"message":..}
|
|
func RespondError(c *gin.Context, status int, code, msg string) {
|
|
c.JSON(status, gin.H{"code": code, "message": msg})
|
|
}
|
|
|
|
// RespondSuccess 成功:{"data":..}
|
|
func RespondSuccess(c *gin.Context, data interface{}) {
|
|
c.JSON(http.StatusOK, gin.H{"data": data})
|
|
}
|