Some checks failed
Build docker and publish / linux (1.24.5) (push) Failing after 40s
feat(pay): 添加支付API基础结构 feat(miniapp): 创建支付测试小程序页面与配置 feat(wechatpay): 配置微信支付参数与证书 fix(guild): 修复成员列表查询条件 docs: 更新代码规范文档与需求文档 style: 统一前后端枚举显示与注释格式 refactor(admin): 重构用户奖励发放接口参数处理 test(title): 添加称号效果参数验证测试
28 lines
881 B
Go
28 lines
881 B
Go
package app
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
"bindbox-game/internal/pkg/core"
|
|
"bindbox-game/internal/repository/mysql/model"
|
|
)
|
|
|
|
type createTestOrderResponse struct {
|
|
OrderNo string `json:"order_no"`
|
|
}
|
|
|
|
func (h *handler) CreateTestOrder() core.HandlerFunc {
|
|
return func(ctx core.Context) {
|
|
userID := int64(ctx.SessionUserInfo().Id)
|
|
now := time.Now()
|
|
orderNo := fmt.Sprintf("T%s%03d", now.Format("20060102150405"), now.Nanosecond()/1e6)
|
|
err := h.writeDB.Orders.WithContext(ctx.RequestContext()).Omit(h.writeDB.Orders.PaidAt, h.writeDB.Orders.CancelledAt).Create(&model.Orders{UserID: userID, OrderNo: orderNo, SourceType: 1, TotalAmount: 10, DiscountAmount: 0, PointsAmount: 0, ActualAmount: 10, Status: 1, IsConsumed: 0})
|
|
if err != nil {
|
|
ctx.AbortWithError(core.Error(400, 120001, err.Error()))
|
|
return
|
|
}
|
|
ctx.Payload(&createTestOrderResponse{OrderNo: orderNo})
|
|
}
|
|
}
|