v1.2.3 template (clean feature not done)

This commit is contained in:
2025-01-13 17:21:37 +08:00
parent 508d03c073
commit 9a31ec15a4
5 changed files with 41 additions and 23 deletions

View File

@@ -8,14 +8,12 @@ import (
"github.com/pkg/errors"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"math"
"qnc-server/app/user/cmd/api/internal/svc"
"qnc-server/app/user/cmd/api/internal/types"
"qnc-server/app/user/model"
"qnc-server/common/ctxdata"
"qnc-server/common/xerr"
"qnc-server/pkg/lzkit/crypto"
"time"
)
type PaymentLogic struct {
@@ -78,28 +76,10 @@ func (l *PaymentLogic) Payment(req *types.PaymentReq) (resp *types.PaymentResp,
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "生成订单, 获取用户信息失败: %+v", err)
}
currentTime := time.Now()
var mhour int
if user.Inside == 1 {
mhour = 0
amount = 0.01
} else {
mhour = 12
}
// 设置时间范围2025年1月1日中午12点到2025年1月2日中午12点
startTime := time.Date(2025, 1, 1, mhour, 0, 0, 0, time.Local)
endTime := time.Date(2025, 1, 2, 12, 0, 0, 0, time.Local)
if currentTime.After(startTime) && currentTime.Before(endTime) {
// 打两折
amount = product.SellPrice * 0.2
amount = math.Round(amount*100) / 100
} else {
if user.Inside == 1 {
amount = 0.01
} else {
amount = product.SellPrice
}
amount = product.SellPrice
}
var createOrderErr error
if req.PayMethod == "wechatpay" {