添加微信支付支持,重构资源创建逻辑,更新支付宝相关配置,移除账单状态字段

This commit is contained in:
2025-04-17 18:29:44 +08:00
parent 2146887f95
commit f6a97545c5
20 changed files with 607 additions and 495 deletions

View File

@@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"platform/pkg/rds"
"strconv"
"strings"
"time"
@@ -42,7 +43,7 @@ var (
ErrSequenceOverflow = errors.New("sequence overflow")
)
func (s *IdService) GenSerial(ctx context.Context) (uint64, error) {
func (s *IdService) GenSerial(ctx context.Context) (string, error) {
// 构造Redis键
now := time.Now().Unix()
key := idSerialKey(now)
@@ -74,13 +75,15 @@ func (s *IdService) GenSerial(ctx context.Context) (uint64, error) {
return err
}, key)
if err != nil {
return 0, err
return "", err
}
// 组装最终ID
id := uint64((now << timestampShift) | sequence)
return id, nil
idStr := strconv.FormatUint(id, 10)
return idStr, nil
}
// ParseSerial 解析ID返回其组成部分