add: 打手初始化接口

This commit is contained in:
zetaloop
2026-04-04 03:35:36 +08:00
parent 85ce6a45c5
commit 32d58ef462
12 changed files with 224 additions and 21 deletions
+5 -7
View File
@@ -3,9 +3,9 @@
package models
import (
"encoding/json"
"fmt"
"juwan-backend/app/player/rpc/internal/models/players"
"juwan-backend/pkg/types"
"strings"
"time"
@@ -51,7 +51,7 @@ func (*Players) scanValues(columns []string) ([]any, error) {
for i := range columns {
switch columns[i] {
case players.FieldTags:
values[i] = new([]byte)
values[i] = new(types.TextArray)
case players.FieldRating:
values[i] = new(decimal.Decimal)
case players.FieldGames:
@@ -129,12 +129,10 @@ func (_m *Players) assignValues(columns []string, values []any) error {
*_m.ShopID = value.Int64
}
case players.FieldTags:
if value, ok := values[i].(*[]byte); !ok {
if value, ok := values[i].(*types.TextArray); !ok {
return fmt.Errorf("unexpected type %T for field tags", values[i])
} else if value != nil && len(*value) > 0 {
if err := json.Unmarshal(*value, &_m.Tags); err != nil {
return fmt.Errorf("unmarshal field tags: %w", err)
}
} else if value != nil {
_m.Tags = append([]string{}, value.Elements...)
}
case players.FieldGames:
if value, ok := values[i].(*pq.Int64Array); !ok {