添加微信支付支持,重构资源创建逻辑,更新支付宝相关配置,移除账单状态字段
This commit is contained in:
@@ -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,返回其组成部分
|
||||
|
||||
Reference in New Issue
Block a user