1
0

add egg_at

This commit is contained in:
syui 2023-07-23 23:40:24 +09:00
parent 1615c253ba
commit 6116d5a076
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56
22 changed files with 744 additions and 161 deletions

View File

@ -72,6 +72,7 @@ var (
{Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true},
{Name: "updated_at", Type: field.TypeTime, Nullable: true}, {Name: "updated_at", Type: field.TypeTime, Nullable: true},
{Name: "raid_at", Type: field.TypeTime, Nullable: true}, {Name: "raid_at", Type: field.TypeTime, Nullable: true},
{Name: "egg_at", Type: field.TypeTime, Nullable: true},
{Name: "luck", Type: field.TypeInt, Nullable: true}, {Name: "luck", Type: field.TypeInt, Nullable: true},
{Name: "luck_at", Type: field.TypeTime, Nullable: true}, {Name: "luck_at", Type: field.TypeTime, Nullable: true},
{Name: "like", Type: field.TypeInt, Nullable: true}, {Name: "like", Type: field.TypeInt, Nullable: true},
@ -87,7 +88,7 @@ var (
{Name: "ten_post", Type: field.TypeString, Nullable: true}, {Name: "ten_post", Type: field.TypeString, Nullable: true},
{Name: "ten_get", Type: field.TypeString, Nullable: true}, {Name: "ten_get", Type: field.TypeString, Nullable: true},
{Name: "ten_at", Type: field.TypeTime, Nullable: true}, {Name: "ten_at", Type: field.TypeTime, Nullable: true},
{Name: "next", Type: field.TypeString, Nullable: true, Default: "20230720"}, {Name: "next", Type: field.TypeString, Nullable: true, Default: "20230801"},
{Name: "group_users", Type: field.TypeInt, Nullable: true}, {Name: "group_users", Type: field.TypeInt, Nullable: true},
} }
// UsersTable holds the schema information for the "users" table. // UsersTable holds the schema information for the "users" table.
@ -98,7 +99,7 @@ var (
ForeignKeys: []*schema.ForeignKey{ ForeignKeys: []*schema.ForeignKey{
{ {
Symbol: "users_groups_users", Symbol: "users_groups_users",
Columns: []*schema.Column{UsersColumns[32]}, Columns: []*schema.Column{UsersColumns[33]},
RefColumns: []*schema.Column{GroupsColumns[0]}, RefColumns: []*schema.Column{GroupsColumns[0]},
OnDelete: schema.SetNull, OnDelete: schema.SetNull,
}, },

View File

@ -1503,6 +1503,7 @@ type UserMutation struct {
created_at *time.Time created_at *time.Time
updated_at *time.Time updated_at *time.Time
raid_at *time.Time raid_at *time.Time
egg_at *time.Time
luck *int luck *int
addluck *int addluck *int
luck_at *time.Time luck_at *time.Time
@ -2342,6 +2343,55 @@ func (m *UserMutation) ResetRaidAt() {
delete(m.clearedFields, user.FieldRaidAt) delete(m.clearedFields, user.FieldRaidAt)
} }
// SetEggAt sets the "egg_at" field.
func (m *UserMutation) SetEggAt(t time.Time) {
m.egg_at = &t
}
// EggAt returns the value of the "egg_at" field in the mutation.
func (m *UserMutation) EggAt() (r time.Time, exists bool) {
v := m.egg_at
if v == nil {
return
}
return *v, true
}
// OldEggAt returns the old "egg_at" field's value of the User entity.
// If the User object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *UserMutation) OldEggAt(ctx context.Context) (v time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldEggAt is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldEggAt requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldEggAt: %w", err)
}
return oldValue.EggAt, nil
}
// ClearEggAt clears the value of the "egg_at" field.
func (m *UserMutation) ClearEggAt() {
m.egg_at = nil
m.clearedFields[user.FieldEggAt] = struct{}{}
}
// EggAtCleared returns if the "egg_at" field was cleared in this mutation.
func (m *UserMutation) EggAtCleared() bool {
_, ok := m.clearedFields[user.FieldEggAt]
return ok
}
// ResetEggAt resets all changes to the "egg_at" field.
func (m *UserMutation) ResetEggAt() {
m.egg_at = nil
delete(m.clearedFields, user.FieldEggAt)
}
// SetLuck sets the "luck" field. // SetLuck sets the "luck" field.
func (m *UserMutation) SetLuck(i int) { func (m *UserMutation) SetLuck(i int) {
m.luck = &i m.luck = &i
@ -3361,7 +3411,7 @@ func (m *UserMutation) Type() string {
// order to get all numeric fields that were incremented/decremented, call // order to get all numeric fields that were incremented/decremented, call
// AddedFields(). // AddedFields().
func (m *UserMutation) Fields() []string { func (m *UserMutation) Fields() []string {
fields := make([]string, 0, 31) fields := make([]string, 0, 32)
if m.username != nil { if m.username != nil {
fields = append(fields, user.FieldUsername) fields = append(fields, user.FieldUsername)
} }
@ -3407,6 +3457,9 @@ func (m *UserMutation) Fields() []string {
if m.raid_at != nil { if m.raid_at != nil {
fields = append(fields, user.FieldRaidAt) fields = append(fields, user.FieldRaidAt)
} }
if m.egg_at != nil {
fields = append(fields, user.FieldEggAt)
}
if m.luck != nil { if m.luck != nil {
fields = append(fields, user.FieldLuck) fields = append(fields, user.FieldLuck)
} }
@ -3493,6 +3546,8 @@ func (m *UserMutation) Field(name string) (ent.Value, bool) {
return m.UpdatedAt() return m.UpdatedAt()
case user.FieldRaidAt: case user.FieldRaidAt:
return m.RaidAt() return m.RaidAt()
case user.FieldEggAt:
return m.EggAt()
case user.FieldLuck: case user.FieldLuck:
return m.Luck() return m.Luck()
case user.FieldLuckAt: case user.FieldLuckAt:
@ -3564,6 +3619,8 @@ func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, er
return m.OldUpdatedAt(ctx) return m.OldUpdatedAt(ctx)
case user.FieldRaidAt: case user.FieldRaidAt:
return m.OldRaidAt(ctx) return m.OldRaidAt(ctx)
case user.FieldEggAt:
return m.OldEggAt(ctx)
case user.FieldLuck: case user.FieldLuck:
return m.OldLuck(ctx) return m.OldLuck(ctx)
case user.FieldLuckAt: case user.FieldLuckAt:
@ -3710,6 +3767,13 @@ func (m *UserMutation) SetField(name string, value ent.Value) error {
} }
m.SetRaidAt(v) m.SetRaidAt(v)
return nil return nil
case user.FieldEggAt:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetEggAt(v)
return nil
case user.FieldLuck: case user.FieldLuck:
v, ok := value.(int) v, ok := value.(int)
if !ok { if !ok {
@ -3978,6 +4042,9 @@ func (m *UserMutation) ClearedFields() []string {
if m.FieldCleared(user.FieldRaidAt) { if m.FieldCleared(user.FieldRaidAt) {
fields = append(fields, user.FieldRaidAt) fields = append(fields, user.FieldRaidAt)
} }
if m.FieldCleared(user.FieldEggAt) {
fields = append(fields, user.FieldEggAt)
}
if m.FieldCleared(user.FieldLuck) { if m.FieldCleared(user.FieldLuck) {
fields = append(fields, user.FieldLuck) fields = append(fields, user.FieldLuck)
} }
@ -4079,6 +4146,9 @@ func (m *UserMutation) ClearField(name string) error {
case user.FieldRaidAt: case user.FieldRaidAt:
m.ClearRaidAt() m.ClearRaidAt()
return nil return nil
case user.FieldEggAt:
m.ClearEggAt()
return nil
case user.FieldLuck: case user.FieldLuck:
m.ClearLuck() m.ClearLuck()
return nil return nil
@ -4180,6 +4250,9 @@ func (m *UserMutation) ResetField(name string) error {
case user.FieldRaidAt: case user.FieldRaidAt:
m.ResetRaidAt() m.ResetRaidAt()
return nil return nil
case user.FieldEggAt:
m.ResetEggAt()
return nil
case user.FieldLuck: case user.FieldLuck:
m.ResetLuck() m.ResetLuck()
return nil return nil

View File

@ -503,6 +503,12 @@ func (s *CardOwnerRead) encodeFields(e *jx.Encoder) {
s.RaidAt.Encode(e, json.EncodeDateTime) s.RaidAt.Encode(e, json.EncodeDateTime)
} }
} }
{
if s.EggAt.Set {
e.FieldStart("egg_at")
s.EggAt.Encode(e, json.EncodeDateTime)
}
}
{ {
if s.Luck.Set { if s.Luck.Set {
e.FieldStart("luck") e.FieldStart("luck")
@ -601,7 +607,7 @@ func (s *CardOwnerRead) encodeFields(e *jx.Encoder) {
} }
} }
var jsonFieldsNameOfCardOwnerRead = [30]string{ var jsonFieldsNameOfCardOwnerRead = [31]string{
0: "id", 0: "id",
1: "username", 1: "username",
2: "did", 2: "did",
@ -616,22 +622,23 @@ var jsonFieldsNameOfCardOwnerRead = [30]string{
11: "created_at", 11: "created_at",
12: "updated_at", 12: "updated_at",
13: "raid_at", 13: "raid_at",
14: "luck", 14: "egg_at",
15: "luck_at", 15: "luck",
16: "like", 16: "luck_at",
17: "like_rank", 17: "like",
18: "like_at", 18: "like_rank",
19: "fav", 19: "like_at",
20: "ten", 20: "fav",
21: "ten_su", 21: "ten",
22: "ten_kai", 22: "ten_su",
23: "aiten", 23: "ten_kai",
24: "ten_card", 24: "aiten",
25: "ten_delete", 25: "ten_card",
26: "ten_post", 26: "ten_delete",
27: "ten_get", 27: "ten_post",
28: "ten_at", 28: "ten_get",
29: "next", 29: "ten_at",
30: "next",
} }
// Decode decodes CardOwnerRead from json. // Decode decodes CardOwnerRead from json.
@ -787,6 +794,16 @@ func (s *CardOwnerRead) Decode(d *jx.Decoder) error {
}(); err != nil { }(); err != nil {
return errors.Wrap(err, "decode field \"raid_at\"") return errors.Wrap(err, "decode field \"raid_at\"")
} }
case "egg_at":
if err := func() error {
s.EggAt.Reset()
if err := s.EggAt.Decode(d, json.DecodeDateTime); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"egg_at\"")
}
case "luck": case "luck":
if err := func() error { if err := func() error {
s.Luck.Reset() s.Luck.Reset()
@ -1881,6 +1898,12 @@ func (s *CreateUserReq) encodeFields(e *jx.Encoder) {
s.RaidAt.Encode(e, json.EncodeDateTime) s.RaidAt.Encode(e, json.EncodeDateTime)
} }
} }
{
if s.EggAt.Set {
e.FieldStart("egg_at")
s.EggAt.Encode(e, json.EncodeDateTime)
}
}
{ {
if s.Luck.Set { if s.Luck.Set {
e.FieldStart("luck") e.FieldStart("luck")
@ -1989,7 +2012,7 @@ func (s *CreateUserReq) encodeFields(e *jx.Encoder) {
} }
} }
var jsonFieldsNameOfCreateUserReq = [32]string{ var jsonFieldsNameOfCreateUserReq = [33]string{
0: "username", 0: "username",
1: "did", 1: "did",
2: "member", 2: "member",
@ -2005,23 +2028,24 @@ var jsonFieldsNameOfCreateUserReq = [32]string{
12: "created_at", 12: "created_at",
13: "updated_at", 13: "updated_at",
14: "raid_at", 14: "raid_at",
15: "luck", 15: "egg_at",
16: "luck_at", 16: "luck",
17: "like", 17: "luck_at",
18: "like_rank", 18: "like",
19: "like_at", 19: "like_rank",
20: "fav", 20: "like_at",
21: "ten", 21: "fav",
22: "ten_su", 22: "ten",
23: "ten_kai", 23: "ten_su",
24: "aiten", 24: "ten_kai",
25: "ten_card", 25: "aiten",
26: "ten_delete", 26: "ten_card",
27: "ten_post", 27: "ten_delete",
28: "ten_get", 28: "ten_post",
29: "ten_at", 29: "ten_get",
30: "next", 30: "ten_at",
31: "card", 31: "next",
32: "card",
} }
// Decode decodes CreateUserReq from json. // Decode decodes CreateUserReq from json.
@ -2029,7 +2053,7 @@ func (s *CreateUserReq) Decode(d *jx.Decoder) error {
if s == nil { if s == nil {
return errors.New("invalid: unable to decode CreateUserReq to nil") return errors.New("invalid: unable to decode CreateUserReq to nil")
} }
var requiredBitSet [4]uint8 var requiredBitSet [5]uint8
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
switch string(k) { switch string(k) {
@ -2187,6 +2211,16 @@ func (s *CreateUserReq) Decode(d *jx.Decoder) error {
}(); err != nil { }(); err != nil {
return errors.Wrap(err, "decode field \"raid_at\"") return errors.Wrap(err, "decode field \"raid_at\"")
} }
case "egg_at":
if err := func() error {
s.EggAt.Reset()
if err := s.EggAt.Decode(d, json.DecodeDateTime); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"egg_at\"")
}
case "luck": case "luck":
if err := func() error { if err := func() error {
s.Luck.Reset() s.Luck.Reset()
@ -2375,11 +2409,12 @@ func (s *CreateUserReq) Decode(d *jx.Decoder) error {
} }
// Validate required fields. // Validate required fields.
var failures []validate.FieldError var failures []validate.FieldError
for i, mask := range [4]uint8{ for i, mask := range [5]uint8{
0b00000001, 0b00000001,
0b00001000, 0b00001000,
0b00000000, 0b00000000,
0b00000000, 0b00000000,
0b00000000,
} { } {
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
// Mask only required fields and check equality to mask using XOR. // Mask only required fields and check equality to mask using XOR.
@ -2976,6 +3011,12 @@ func (s *GroupUsersList) encodeFields(e *jx.Encoder) {
s.RaidAt.Encode(e, json.EncodeDateTime) s.RaidAt.Encode(e, json.EncodeDateTime)
} }
} }
{
if s.EggAt.Set {
e.FieldStart("egg_at")
s.EggAt.Encode(e, json.EncodeDateTime)
}
}
{ {
if s.Luck.Set { if s.Luck.Set {
e.FieldStart("luck") e.FieldStart("luck")
@ -3074,7 +3115,7 @@ func (s *GroupUsersList) encodeFields(e *jx.Encoder) {
} }
} }
var jsonFieldsNameOfGroupUsersList = [30]string{ var jsonFieldsNameOfGroupUsersList = [31]string{
0: "id", 0: "id",
1: "username", 1: "username",
2: "did", 2: "did",
@ -3089,22 +3130,23 @@ var jsonFieldsNameOfGroupUsersList = [30]string{
11: "created_at", 11: "created_at",
12: "updated_at", 12: "updated_at",
13: "raid_at", 13: "raid_at",
14: "luck", 14: "egg_at",
15: "luck_at", 15: "luck",
16: "like", 16: "luck_at",
17: "like_rank", 17: "like",
18: "like_at", 18: "like_rank",
19: "fav", 19: "like_at",
20: "ten", 20: "fav",
21: "ten_su", 21: "ten",
22: "ten_kai", 22: "ten_su",
23: "aiten", 23: "ten_kai",
24: "ten_card", 24: "aiten",
25: "ten_delete", 25: "ten_card",
26: "ten_post", 26: "ten_delete",
27: "ten_get", 27: "ten_post",
28: "ten_at", 28: "ten_get",
29: "next", 29: "ten_at",
30: "next",
} }
// Decode decodes GroupUsersList from json. // Decode decodes GroupUsersList from json.
@ -3260,6 +3302,16 @@ func (s *GroupUsersList) Decode(d *jx.Decoder) error {
}(); err != nil { }(); err != nil {
return errors.Wrap(err, "decode field \"raid_at\"") return errors.Wrap(err, "decode field \"raid_at\"")
} }
case "egg_at":
if err := func() error {
s.EggAt.Reset()
if err := s.EggAt.Decode(d, json.DecodeDateTime); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"egg_at\"")
}
case "luck": case "luck":
if err := func() error { if err := func() error {
s.Luck.Reset() s.Luck.Reset()
@ -4727,6 +4779,12 @@ func (s *UpdateUserReq) encodeFields(e *jx.Encoder) {
s.RaidAt.Encode(e, json.EncodeDateTime) s.RaidAt.Encode(e, json.EncodeDateTime)
} }
} }
{
if s.EggAt.Set {
e.FieldStart("egg_at")
s.EggAt.Encode(e, json.EncodeDateTime)
}
}
{ {
if s.Luck.Set { if s.Luck.Set {
e.FieldStart("luck") e.FieldStart("luck")
@ -4835,7 +4893,7 @@ func (s *UpdateUserReq) encodeFields(e *jx.Encoder) {
} }
} }
var jsonFieldsNameOfUpdateUserReq = [29]string{ var jsonFieldsNameOfUpdateUserReq = [30]string{
0: "did", 0: "did",
1: "member", 1: "member",
2: "book", 2: "book",
@ -4848,23 +4906,24 @@ var jsonFieldsNameOfUpdateUserReq = [29]string{
9: "token", 9: "token",
10: "updated_at", 10: "updated_at",
11: "raid_at", 11: "raid_at",
12: "luck", 12: "egg_at",
13: "luck_at", 13: "luck",
14: "like", 14: "luck_at",
15: "like_rank", 15: "like",
16: "like_at", 16: "like_rank",
17: "fav", 17: "like_at",
18: "ten", 18: "fav",
19: "ten_su", 19: "ten",
20: "ten_kai", 20: "ten_su",
21: "aiten", 21: "ten_kai",
22: "ten_card", 22: "aiten",
23: "ten_delete", 23: "ten_card",
24: "ten_post", 24: "ten_delete",
25: "ten_get", 25: "ten_post",
26: "ten_at", 26: "ten_get",
27: "next", 27: "ten_at",
28: "card", 28: "next",
29: "card",
} }
// Decode decodes UpdateUserReq from json. // Decode decodes UpdateUserReq from json.
@ -4995,6 +5054,16 @@ func (s *UpdateUserReq) Decode(d *jx.Decoder) error {
}(); err != nil { }(); err != nil {
return errors.Wrap(err, "decode field \"raid_at\"") return errors.Wrap(err, "decode field \"raid_at\"")
} }
case "egg_at":
if err := func() error {
s.EggAt.Reset()
if err := s.EggAt.Decode(d, json.DecodeDateTime); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"egg_at\"")
}
case "luck": case "luck":
if err := func() error { if err := func() error {
s.Luck.Reset() s.Luck.Reset()
@ -5488,6 +5557,12 @@ func (s *UserCreate) encodeFields(e *jx.Encoder) {
s.RaidAt.Encode(e, json.EncodeDateTime) s.RaidAt.Encode(e, json.EncodeDateTime)
} }
} }
{
if s.EggAt.Set {
e.FieldStart("egg_at")
s.EggAt.Encode(e, json.EncodeDateTime)
}
}
{ {
if s.Luck.Set { if s.Luck.Set {
e.FieldStart("luck") e.FieldStart("luck")
@ -5586,7 +5661,7 @@ func (s *UserCreate) encodeFields(e *jx.Encoder) {
} }
} }
var jsonFieldsNameOfUserCreate = [30]string{ var jsonFieldsNameOfUserCreate = [31]string{
0: "id", 0: "id",
1: "username", 1: "username",
2: "did", 2: "did",
@ -5601,22 +5676,23 @@ var jsonFieldsNameOfUserCreate = [30]string{
11: "created_at", 11: "created_at",
12: "updated_at", 12: "updated_at",
13: "raid_at", 13: "raid_at",
14: "luck", 14: "egg_at",
15: "luck_at", 15: "luck",
16: "like", 16: "luck_at",
17: "like_rank", 17: "like",
18: "like_at", 18: "like_rank",
19: "fav", 19: "like_at",
20: "ten", 20: "fav",
21: "ten_su", 21: "ten",
22: "ten_kai", 22: "ten_su",
23: "aiten", 23: "ten_kai",
24: "ten_card", 24: "aiten",
25: "ten_delete", 25: "ten_card",
26: "ten_post", 26: "ten_delete",
27: "ten_get", 27: "ten_post",
28: "ten_at", 28: "ten_get",
29: "next", 29: "ten_at",
30: "next",
} }
// Decode decodes UserCreate from json. // Decode decodes UserCreate from json.
@ -5772,6 +5848,16 @@ func (s *UserCreate) Decode(d *jx.Decoder) error {
}(); err != nil { }(); err != nil {
return errors.Wrap(err, "decode field \"raid_at\"") return errors.Wrap(err, "decode field \"raid_at\"")
} }
case "egg_at":
if err := func() error {
s.EggAt.Reset()
if err := s.EggAt.Decode(d, json.DecodeDateTime); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"egg_at\"")
}
case "luck": case "luck":
if err := func() error { if err := func() error {
s.Luck.Reset() s.Luck.Reset()
@ -6082,6 +6168,12 @@ func (s *UserList) encodeFields(e *jx.Encoder) {
s.RaidAt.Encode(e, json.EncodeDateTime) s.RaidAt.Encode(e, json.EncodeDateTime)
} }
} }
{
if s.EggAt.Set {
e.FieldStart("egg_at")
s.EggAt.Encode(e, json.EncodeDateTime)
}
}
{ {
if s.Luck.Set { if s.Luck.Set {
e.FieldStart("luck") e.FieldStart("luck")
@ -6180,7 +6272,7 @@ func (s *UserList) encodeFields(e *jx.Encoder) {
} }
} }
var jsonFieldsNameOfUserList = [30]string{ var jsonFieldsNameOfUserList = [31]string{
0: "id", 0: "id",
1: "username", 1: "username",
2: "did", 2: "did",
@ -6195,22 +6287,23 @@ var jsonFieldsNameOfUserList = [30]string{
11: "created_at", 11: "created_at",
12: "updated_at", 12: "updated_at",
13: "raid_at", 13: "raid_at",
14: "luck", 14: "egg_at",
15: "luck_at", 15: "luck",
16: "like", 16: "luck_at",
17: "like_rank", 17: "like",
18: "like_at", 18: "like_rank",
19: "fav", 19: "like_at",
20: "ten", 20: "fav",
21: "ten_su", 21: "ten",
22: "ten_kai", 22: "ten_su",
23: "aiten", 23: "ten_kai",
24: "ten_card", 24: "aiten",
25: "ten_delete", 25: "ten_card",
26: "ten_post", 26: "ten_delete",
27: "ten_get", 27: "ten_post",
28: "ten_at", 28: "ten_get",
29: "next", 29: "ten_at",
30: "next",
} }
// Decode decodes UserList from json. // Decode decodes UserList from json.
@ -6366,6 +6459,16 @@ func (s *UserList) Decode(d *jx.Decoder) error {
}(); err != nil { }(); err != nil {
return errors.Wrap(err, "decode field \"raid_at\"") return errors.Wrap(err, "decode field \"raid_at\"")
} }
case "egg_at":
if err := func() error {
s.EggAt.Reset()
if err := s.EggAt.Decode(d, json.DecodeDateTime); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"egg_at\"")
}
case "luck": case "luck":
if err := func() error { if err := func() error {
s.Luck.Reset() s.Luck.Reset()
@ -6676,6 +6779,12 @@ func (s *UserRead) encodeFields(e *jx.Encoder) {
s.RaidAt.Encode(e, json.EncodeDateTime) s.RaidAt.Encode(e, json.EncodeDateTime)
} }
} }
{
if s.EggAt.Set {
e.FieldStart("egg_at")
s.EggAt.Encode(e, json.EncodeDateTime)
}
}
{ {
if s.Luck.Set { if s.Luck.Set {
e.FieldStart("luck") e.FieldStart("luck")
@ -6774,7 +6883,7 @@ func (s *UserRead) encodeFields(e *jx.Encoder) {
} }
} }
var jsonFieldsNameOfUserRead = [30]string{ var jsonFieldsNameOfUserRead = [31]string{
0: "id", 0: "id",
1: "username", 1: "username",
2: "did", 2: "did",
@ -6789,22 +6898,23 @@ var jsonFieldsNameOfUserRead = [30]string{
11: "created_at", 11: "created_at",
12: "updated_at", 12: "updated_at",
13: "raid_at", 13: "raid_at",
14: "luck", 14: "egg_at",
15: "luck_at", 15: "luck",
16: "like", 16: "luck_at",
17: "like_rank", 17: "like",
18: "like_at", 18: "like_rank",
19: "fav", 19: "like_at",
20: "ten", 20: "fav",
21: "ten_su", 21: "ten",
22: "ten_kai", 22: "ten_su",
23: "aiten", 23: "ten_kai",
24: "ten_card", 24: "aiten",
25: "ten_delete", 25: "ten_card",
26: "ten_post", 26: "ten_delete",
27: "ten_get", 27: "ten_post",
28: "ten_at", 28: "ten_get",
29: "next", 29: "ten_at",
30: "next",
} }
// Decode decodes UserRead from json. // Decode decodes UserRead from json.
@ -6960,6 +7070,16 @@ func (s *UserRead) Decode(d *jx.Decoder) error {
}(); err != nil { }(); err != nil {
return errors.Wrap(err, "decode field \"raid_at\"") return errors.Wrap(err, "decode field \"raid_at\"")
} }
case "egg_at":
if err := func() error {
s.EggAt.Reset()
if err := s.EggAt.Decode(d, json.DecodeDateTime); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"egg_at\"")
}
case "luck": case "luck":
if err := func() error { if err := func() error {
s.Luck.Reset() s.Luck.Reset()
@ -7270,6 +7390,12 @@ func (s *UserUpdate) encodeFields(e *jx.Encoder) {
s.RaidAt.Encode(e, json.EncodeDateTime) s.RaidAt.Encode(e, json.EncodeDateTime)
} }
} }
{
if s.EggAt.Set {
e.FieldStart("egg_at")
s.EggAt.Encode(e, json.EncodeDateTime)
}
}
{ {
if s.Luck.Set { if s.Luck.Set {
e.FieldStart("luck") e.FieldStart("luck")
@ -7368,7 +7494,7 @@ func (s *UserUpdate) encodeFields(e *jx.Encoder) {
} }
} }
var jsonFieldsNameOfUserUpdate = [30]string{ var jsonFieldsNameOfUserUpdate = [31]string{
0: "id", 0: "id",
1: "username", 1: "username",
2: "did", 2: "did",
@ -7383,22 +7509,23 @@ var jsonFieldsNameOfUserUpdate = [30]string{
11: "created_at", 11: "created_at",
12: "updated_at", 12: "updated_at",
13: "raid_at", 13: "raid_at",
14: "luck", 14: "egg_at",
15: "luck_at", 15: "luck",
16: "like", 16: "luck_at",
17: "like_rank", 17: "like",
18: "like_at", 18: "like_rank",
19: "fav", 19: "like_at",
20: "ten", 20: "fav",
21: "ten_su", 21: "ten",
22: "ten_kai", 22: "ten_su",
23: "aiten", 23: "ten_kai",
24: "ten_card", 24: "aiten",
25: "ten_delete", 25: "ten_card",
26: "ten_post", 26: "ten_delete",
27: "ten_get", 27: "ten_post",
28: "ten_at", 28: "ten_get",
29: "next", 29: "ten_at",
30: "next",
} }
// Decode decodes UserUpdate from json. // Decode decodes UserUpdate from json.
@ -7554,6 +7681,16 @@ func (s *UserUpdate) Decode(d *jx.Decoder) error {
}(); err != nil { }(); err != nil {
return errors.Wrap(err, "decode field \"raid_at\"") return errors.Wrap(err, "decode field \"raid_at\"")
} }
case "egg_at":
if err := func() error {
s.EggAt.Reset()
if err := s.EggAt.Decode(d, json.DecodeDateTime); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"egg_at\"")
}
case "luck": case "luck":
if err := func() error { if err := func() error {
s.Luck.Reset() s.Luck.Reset()

View File

@ -188,6 +188,7 @@ type CardOwnerRead struct {
CreatedAt OptDateTime `json:"created_at"` CreatedAt OptDateTime `json:"created_at"`
UpdatedAt OptDateTime `json:"updated_at"` UpdatedAt OptDateTime `json:"updated_at"`
RaidAt OptDateTime `json:"raid_at"` RaidAt OptDateTime `json:"raid_at"`
EggAt OptDateTime `json:"egg_at"`
Luck OptInt `json:"luck"` Luck OptInt `json:"luck"`
LuckAt OptDateTime `json:"luck_at"` LuckAt OptDateTime `json:"luck_at"`
Like OptInt `json:"like"` Like OptInt `json:"like"`
@ -276,6 +277,11 @@ func (s *CardOwnerRead) GetRaidAt() OptDateTime {
return s.RaidAt return s.RaidAt
} }
// GetEggAt returns the value of EggAt.
func (s *CardOwnerRead) GetEggAt() OptDateTime {
return s.EggAt
}
// GetLuck returns the value of Luck. // GetLuck returns the value of Luck.
func (s *CardOwnerRead) GetLuck() OptInt { func (s *CardOwnerRead) GetLuck() OptInt {
return s.Luck return s.Luck
@ -426,6 +432,11 @@ func (s *CardOwnerRead) SetRaidAt(val OptDateTime) {
s.RaidAt = val s.RaidAt = val
} }
// SetEggAt sets the value of EggAt.
func (s *CardOwnerRead) SetEggAt(val OptDateTime) {
s.EggAt = val
}
// SetLuck sets the value of Luck. // SetLuck sets the value of Luck.
func (s *CardOwnerRead) SetLuck(val OptInt) { func (s *CardOwnerRead) SetLuck(val OptInt) {
s.Luck = val s.Luck = val
@ -828,6 +839,7 @@ type CreateUserReq struct {
CreatedAt OptDateTime `json:"created_at"` CreatedAt OptDateTime `json:"created_at"`
UpdatedAt OptDateTime `json:"updated_at"` UpdatedAt OptDateTime `json:"updated_at"`
RaidAt OptDateTime `json:"raid_at"` RaidAt OptDateTime `json:"raid_at"`
EggAt OptDateTime `json:"egg_at"`
Luck OptInt `json:"luck"` Luck OptInt `json:"luck"`
LuckAt OptDateTime `json:"luck_at"` LuckAt OptDateTime `json:"luck_at"`
Like OptInt `json:"like"` Like OptInt `json:"like"`
@ -922,6 +934,11 @@ func (s *CreateUserReq) GetRaidAt() OptDateTime {
return s.RaidAt return s.RaidAt
} }
// GetEggAt returns the value of EggAt.
func (s *CreateUserReq) GetEggAt() OptDateTime {
return s.EggAt
}
// GetLuck returns the value of Luck. // GetLuck returns the value of Luck.
func (s *CreateUserReq) GetLuck() OptInt { func (s *CreateUserReq) GetLuck() OptInt {
return s.Luck return s.Luck
@ -1082,6 +1099,11 @@ func (s *CreateUserReq) SetRaidAt(val OptDateTime) {
s.RaidAt = val s.RaidAt = val
} }
// SetEggAt sets the value of EggAt.
func (s *CreateUserReq) SetEggAt(val OptDateTime) {
s.EggAt = val
}
// SetLuck sets the value of Luck. // SetLuck sets the value of Luck.
func (s *CreateUserReq) SetLuck(val OptInt) { func (s *CreateUserReq) SetLuck(val OptInt) {
s.Luck = val s.Luck = val
@ -1314,6 +1336,7 @@ type GroupUsersList struct {
CreatedAt OptDateTime `json:"created_at"` CreatedAt OptDateTime `json:"created_at"`
UpdatedAt OptDateTime `json:"updated_at"` UpdatedAt OptDateTime `json:"updated_at"`
RaidAt OptDateTime `json:"raid_at"` RaidAt OptDateTime `json:"raid_at"`
EggAt OptDateTime `json:"egg_at"`
Luck OptInt `json:"luck"` Luck OptInt `json:"luck"`
LuckAt OptDateTime `json:"luck_at"` LuckAt OptDateTime `json:"luck_at"`
Like OptInt `json:"like"` Like OptInt `json:"like"`
@ -1402,6 +1425,11 @@ func (s *GroupUsersList) GetRaidAt() OptDateTime {
return s.RaidAt return s.RaidAt
} }
// GetEggAt returns the value of EggAt.
func (s *GroupUsersList) GetEggAt() OptDateTime {
return s.EggAt
}
// GetLuck returns the value of Luck. // GetLuck returns the value of Luck.
func (s *GroupUsersList) GetLuck() OptInt { func (s *GroupUsersList) GetLuck() OptInt {
return s.Luck return s.Luck
@ -1552,6 +1580,11 @@ func (s *GroupUsersList) SetRaidAt(val OptDateTime) {
s.RaidAt = val s.RaidAt = val
} }
// SetEggAt sets the value of EggAt.
func (s *GroupUsersList) SetEggAt(val OptDateTime) {
s.EggAt = val
}
// SetLuck sets the value of Luck. // SetLuck sets the value of Luck.
func (s *GroupUsersList) SetLuck(val OptInt) { func (s *GroupUsersList) SetLuck(val OptInt) {
s.Luck = val s.Luck = val
@ -2160,6 +2193,7 @@ type UpdateUserReq struct {
Token OptString `json:"token"` Token OptString `json:"token"`
UpdatedAt OptDateTime `json:"updated_at"` UpdatedAt OptDateTime `json:"updated_at"`
RaidAt OptDateTime `json:"raid_at"` RaidAt OptDateTime `json:"raid_at"`
EggAt OptDateTime `json:"egg_at"`
Luck OptInt `json:"luck"` Luck OptInt `json:"luck"`
LuckAt OptDateTime `json:"luck_at"` LuckAt OptDateTime `json:"luck_at"`
Like OptInt `json:"like"` Like OptInt `json:"like"`
@ -2239,6 +2273,11 @@ func (s *UpdateUserReq) GetRaidAt() OptDateTime {
return s.RaidAt return s.RaidAt
} }
// GetEggAt returns the value of EggAt.
func (s *UpdateUserReq) GetEggAt() OptDateTime {
return s.EggAt
}
// GetLuck returns the value of Luck. // GetLuck returns the value of Luck.
func (s *UpdateUserReq) GetLuck() OptInt { func (s *UpdateUserReq) GetLuck() OptInt {
return s.Luck return s.Luck
@ -2384,6 +2423,11 @@ func (s *UpdateUserReq) SetRaidAt(val OptDateTime) {
s.RaidAt = val s.RaidAt = val
} }
// SetEggAt sets the value of EggAt.
func (s *UpdateUserReq) SetEggAt(val OptDateTime) {
s.EggAt = val
}
// SetLuck sets the value of Luck. // SetLuck sets the value of Luck.
func (s *UpdateUserReq) SetLuck(val OptInt) { func (s *UpdateUserReq) SetLuck(val OptInt) {
s.Luck = val s.Luck = val
@ -2566,6 +2610,7 @@ type UserCreate struct {
CreatedAt OptDateTime `json:"created_at"` CreatedAt OptDateTime `json:"created_at"`
UpdatedAt OptDateTime `json:"updated_at"` UpdatedAt OptDateTime `json:"updated_at"`
RaidAt OptDateTime `json:"raid_at"` RaidAt OptDateTime `json:"raid_at"`
EggAt OptDateTime `json:"egg_at"`
Luck OptInt `json:"luck"` Luck OptInt `json:"luck"`
LuckAt OptDateTime `json:"luck_at"` LuckAt OptDateTime `json:"luck_at"`
Like OptInt `json:"like"` Like OptInt `json:"like"`
@ -2654,6 +2699,11 @@ func (s *UserCreate) GetRaidAt() OptDateTime {
return s.RaidAt return s.RaidAt
} }
// GetEggAt returns the value of EggAt.
func (s *UserCreate) GetEggAt() OptDateTime {
return s.EggAt
}
// GetLuck returns the value of Luck. // GetLuck returns the value of Luck.
func (s *UserCreate) GetLuck() OptInt { func (s *UserCreate) GetLuck() OptInt {
return s.Luck return s.Luck
@ -2804,6 +2854,11 @@ func (s *UserCreate) SetRaidAt(val OptDateTime) {
s.RaidAt = val s.RaidAt = val
} }
// SetEggAt sets the value of EggAt.
func (s *UserCreate) SetEggAt(val OptDateTime) {
s.EggAt = val
}
// SetLuck sets the value of Luck. // SetLuck sets the value of Luck.
func (s *UserCreate) SetLuck(val OptInt) { func (s *UserCreate) SetLuck(val OptInt) {
s.Luck = val s.Luck = val
@ -2902,6 +2957,7 @@ type UserList struct {
CreatedAt OptDateTime `json:"created_at"` CreatedAt OptDateTime `json:"created_at"`
UpdatedAt OptDateTime `json:"updated_at"` UpdatedAt OptDateTime `json:"updated_at"`
RaidAt OptDateTime `json:"raid_at"` RaidAt OptDateTime `json:"raid_at"`
EggAt OptDateTime `json:"egg_at"`
Luck OptInt `json:"luck"` Luck OptInt `json:"luck"`
LuckAt OptDateTime `json:"luck_at"` LuckAt OptDateTime `json:"luck_at"`
Like OptInt `json:"like"` Like OptInt `json:"like"`
@ -2990,6 +3046,11 @@ func (s *UserList) GetRaidAt() OptDateTime {
return s.RaidAt return s.RaidAt
} }
// GetEggAt returns the value of EggAt.
func (s *UserList) GetEggAt() OptDateTime {
return s.EggAt
}
// GetLuck returns the value of Luck. // GetLuck returns the value of Luck.
func (s *UserList) GetLuck() OptInt { func (s *UserList) GetLuck() OptInt {
return s.Luck return s.Luck
@ -3140,6 +3201,11 @@ func (s *UserList) SetRaidAt(val OptDateTime) {
s.RaidAt = val s.RaidAt = val
} }
// SetEggAt sets the value of EggAt.
func (s *UserList) SetEggAt(val OptDateTime) {
s.EggAt = val
}
// SetLuck sets the value of Luck. // SetLuck sets the value of Luck.
func (s *UserList) SetLuck(val OptInt) { func (s *UserList) SetLuck(val OptInt) {
s.Luck = val s.Luck = val
@ -3236,6 +3302,7 @@ type UserRead struct {
CreatedAt OptDateTime `json:"created_at"` CreatedAt OptDateTime `json:"created_at"`
UpdatedAt OptDateTime `json:"updated_at"` UpdatedAt OptDateTime `json:"updated_at"`
RaidAt OptDateTime `json:"raid_at"` RaidAt OptDateTime `json:"raid_at"`
EggAt OptDateTime `json:"egg_at"`
Luck OptInt `json:"luck"` Luck OptInt `json:"luck"`
LuckAt OptDateTime `json:"luck_at"` LuckAt OptDateTime `json:"luck_at"`
Like OptInt `json:"like"` Like OptInt `json:"like"`
@ -3324,6 +3391,11 @@ func (s *UserRead) GetRaidAt() OptDateTime {
return s.RaidAt return s.RaidAt
} }
// GetEggAt returns the value of EggAt.
func (s *UserRead) GetEggAt() OptDateTime {
return s.EggAt
}
// GetLuck returns the value of Luck. // GetLuck returns the value of Luck.
func (s *UserRead) GetLuck() OptInt { func (s *UserRead) GetLuck() OptInt {
return s.Luck return s.Luck
@ -3474,6 +3546,11 @@ func (s *UserRead) SetRaidAt(val OptDateTime) {
s.RaidAt = val s.RaidAt = val
} }
// SetEggAt sets the value of EggAt.
func (s *UserRead) SetEggAt(val OptDateTime) {
s.EggAt = val
}
// SetLuck sets the value of Luck. // SetLuck sets the value of Luck.
func (s *UserRead) SetLuck(val OptInt) { func (s *UserRead) SetLuck(val OptInt) {
s.Luck = val s.Luck = val
@ -3572,6 +3649,7 @@ type UserUpdate struct {
CreatedAt OptDateTime `json:"created_at"` CreatedAt OptDateTime `json:"created_at"`
UpdatedAt OptDateTime `json:"updated_at"` UpdatedAt OptDateTime `json:"updated_at"`
RaidAt OptDateTime `json:"raid_at"` RaidAt OptDateTime `json:"raid_at"`
EggAt OptDateTime `json:"egg_at"`
Luck OptInt `json:"luck"` Luck OptInt `json:"luck"`
LuckAt OptDateTime `json:"luck_at"` LuckAt OptDateTime `json:"luck_at"`
Like OptInt `json:"like"` Like OptInt `json:"like"`
@ -3660,6 +3738,11 @@ func (s *UserUpdate) GetRaidAt() OptDateTime {
return s.RaidAt return s.RaidAt
} }
// GetEggAt returns the value of EggAt.
func (s *UserUpdate) GetEggAt() OptDateTime {
return s.EggAt
}
// GetLuck returns the value of Luck. // GetLuck returns the value of Luck.
func (s *UserUpdate) GetLuck() OptInt { func (s *UserUpdate) GetLuck() OptInt {
return s.Luck return s.Luck
@ -3810,6 +3893,11 @@ func (s *UserUpdate) SetRaidAt(val OptDateTime) {
s.RaidAt = val s.RaidAt = val
} }
// SetEggAt sets the value of EggAt.
func (s *UserUpdate) SetEggAt(val OptDateTime) {
s.EggAt = val
}
// SetLuck sets the value of Luck. // SetLuck sets the value of Luck.
func (s *UserUpdate) SetLuck(val OptInt) { func (s *UserUpdate) SetLuck(val OptInt) {
s.Luck = val s.Luck = val

View File

@ -183,6 +183,7 @@ func (h *OgentHandler) UpdateCard(ctx context.Context, req *UpdateCardReq, param
// DeleteCard handles DELETE /cards/{id} requests. // DeleteCard handles DELETE /cards/{id} requests.
func (h *OgentHandler) DeleteCard(ctx context.Context, params DeleteCardParams) (DeleteCardRes, error) { func (h *OgentHandler) DeleteCard(ctx context.Context, params DeleteCardParams) (DeleteCardRes, error) {
err := h.client.Card.DeleteOneID(0).Exec(ctx) err := h.client.Card.DeleteOneID(0).Exec(ctx)
//err := h.client.Card.DeleteOneID(params.ID).Exec(ctx)
if err != nil { if err != nil {
switch { switch {
case ent.IsNotFound(err): case ent.IsNotFound(err):
@ -523,6 +524,9 @@ func (h *OgentHandler) CreateUser(ctx context.Context, req *CreateUserReq) (Crea
if v, ok := req.Token.Get(); ok { if v, ok := req.Token.Get(); ok {
b.SetToken(v) b.SetToken(v)
} }
if v, ok := req.EggAt.Get(); ok {
b.SetEggAt(v)
}
if v, ok := req.CreatedAt.Get(); ok { if v, ok := req.CreatedAt.Get(); ok {
b.SetCreatedAt(v) b.SetCreatedAt(v)
} }
@ -674,6 +678,9 @@ func (h *OgentHandler) UpdateUser(ctx context.Context, req *UpdateUserReq, param
if v, ok := req.Handle.Get(); ok { if v, ok := req.Handle.Get(); ok {
b.SetHandle(v) b.SetHandle(v)
} }
if v, ok := req.EggAt.Get(); ok {
b.SetEggAt(v)
}
if v, ok := req.UpdatedAt.Get(); ok { if v, ok := req.UpdatedAt.Get(); ok {
b.SetUpdatedAt(v) b.SetUpdatedAt(v)
} }

View File

@ -155,6 +155,7 @@ func NewCardOwnerRead(e *ent.User) *CardOwnerRead {
ret.CreatedAt = NewOptDateTime(e.CreatedAt) ret.CreatedAt = NewOptDateTime(e.CreatedAt)
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt) ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
ret.RaidAt = NewOptDateTime(e.RaidAt) ret.RaidAt = NewOptDateTime(e.RaidAt)
ret.EggAt = NewOptDateTime(e.EggAt)
ret.Luck = NewOptInt(e.Luck) ret.Luck = NewOptInt(e.Luck)
ret.LuckAt = NewOptDateTime(e.LuckAt) ret.LuckAt = NewOptDateTime(e.LuckAt)
ret.Like = NewOptInt(e.Like) ret.Like = NewOptInt(e.Like)
@ -323,6 +324,7 @@ func NewGroupUsersList(e *ent.User) *GroupUsersList {
ret.CreatedAt = NewOptDateTime(e.CreatedAt) ret.CreatedAt = NewOptDateTime(e.CreatedAt)
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt) ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
ret.RaidAt = NewOptDateTime(e.RaidAt) ret.RaidAt = NewOptDateTime(e.RaidAt)
ret.EggAt = NewOptDateTime(e.EggAt)
ret.Luck = NewOptInt(e.Luck) ret.Luck = NewOptInt(e.Luck)
ret.LuckAt = NewOptDateTime(e.LuckAt) ret.LuckAt = NewOptDateTime(e.LuckAt)
ret.Like = NewOptInt(e.Like) ret.Like = NewOptInt(e.Like)
@ -379,6 +381,7 @@ func NewUserCreate(e *ent.User) *UserCreate {
ret.CreatedAt = NewOptDateTime(e.CreatedAt) ret.CreatedAt = NewOptDateTime(e.CreatedAt)
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt) ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
ret.RaidAt = NewOptDateTime(e.RaidAt) ret.RaidAt = NewOptDateTime(e.RaidAt)
ret.EggAt = NewOptDateTime(e.EggAt)
ret.Luck = NewOptInt(e.Luck) ret.Luck = NewOptInt(e.Luck)
ret.LuckAt = NewOptDateTime(e.LuckAt) ret.LuckAt = NewOptDateTime(e.LuckAt)
ret.Like = NewOptInt(e.Like) ret.Like = NewOptInt(e.Like)
@ -435,6 +438,7 @@ func NewUserList(e *ent.User) *UserList {
ret.CreatedAt = NewOptDateTime(e.CreatedAt) ret.CreatedAt = NewOptDateTime(e.CreatedAt)
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt) ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
ret.RaidAt = NewOptDateTime(e.RaidAt) ret.RaidAt = NewOptDateTime(e.RaidAt)
ret.EggAt = NewOptDateTime(e.EggAt)
ret.Luck = NewOptInt(e.Luck) ret.Luck = NewOptInt(e.Luck)
ret.LuckAt = NewOptDateTime(e.LuckAt) ret.LuckAt = NewOptDateTime(e.LuckAt)
ret.Like = NewOptInt(e.Like) ret.Like = NewOptInt(e.Like)
@ -491,6 +495,7 @@ func NewUserRead(e *ent.User) *UserRead {
ret.CreatedAt = NewOptDateTime(e.CreatedAt) ret.CreatedAt = NewOptDateTime(e.CreatedAt)
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt) ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
ret.RaidAt = NewOptDateTime(e.RaidAt) ret.RaidAt = NewOptDateTime(e.RaidAt)
ret.EggAt = NewOptDateTime(e.EggAt)
ret.Luck = NewOptInt(e.Luck) ret.Luck = NewOptInt(e.Luck)
ret.LuckAt = NewOptDateTime(e.LuckAt) ret.LuckAt = NewOptDateTime(e.LuckAt)
ret.Like = NewOptInt(e.Like) ret.Like = NewOptInt(e.Like)
@ -547,6 +552,7 @@ func NewUserUpdate(e *ent.User) *UserUpdate {
ret.CreatedAt = NewOptDateTime(e.CreatedAt) ret.CreatedAt = NewOptDateTime(e.CreatedAt)
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt) ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
ret.RaidAt = NewOptDateTime(e.RaidAt) ret.RaidAt = NewOptDateTime(e.RaidAt)
ret.EggAt = NewOptDateTime(e.EggAt)
ret.Luck = NewOptInt(e.Luck) ret.Luck = NewOptInt(e.Luck)
ret.LuckAt = NewOptDateTime(e.LuckAt) ret.LuckAt = NewOptDateTime(e.LuckAt)
ret.Like = NewOptInt(e.Like) ret.Like = NewOptInt(e.Like)

View File

@ -808,6 +808,10 @@
"type": "string", "type": "string",
"format": "date-time" "format": "date-time"
}, },
"egg_at": {
"type": "string",
"format": "date-time"
},
"luck": { "luck": {
"type": "integer" "type": "integer"
}, },
@ -1041,6 +1045,10 @@
"type": "string", "type": "string",
"format": "date-time" "format": "date-time"
}, },
"egg_at": {
"type": "string",
"format": "date-time"
},
"luck": { "luck": {
"type": "integer" "type": "integer"
}, },
@ -1431,6 +1439,10 @@
"type": "string", "type": "string",
"format": "date-time" "format": "date-time"
}, },
"egg_at": {
"type": "string",
"format": "date-time"
},
"luck": { "luck": {
"type": "integer" "type": "integer"
}, },
@ -1621,6 +1633,10 @@
"type": "string", "type": "string",
"format": "date-time" "format": "date-time"
}, },
"egg_at": {
"type": "string",
"format": "date-time"
},
"luck": { "luck": {
"type": "integer" "type": "integer"
}, },
@ -1732,6 +1748,10 @@
"type": "string", "type": "string",
"format": "date-time" "format": "date-time"
}, },
"egg_at": {
"type": "string",
"format": "date-time"
},
"luck": { "luck": {
"type": "integer" "type": "integer"
}, },
@ -1844,6 +1864,10 @@
"type": "string", "type": "string",
"format": "date-time" "format": "date-time"
}, },
"egg_at": {
"type": "string",
"format": "date-time"
},
"luck": { "luck": {
"type": "integer" "type": "integer"
}, },
@ -1949,6 +1973,10 @@
"type": "string", "type": "string",
"format": "date-time" "format": "date-time"
}, },
"egg_at": {
"type": "string",
"format": "date-time"
},
"luck": { "luck": {
"type": "integer" "type": "integer"
}, },
@ -2054,6 +2082,10 @@
"type": "string", "type": "string",
"format": "date-time" "format": "date-time"
}, },
"egg_at": {
"type": "string",
"format": "date-time"
},
"luck": { "luck": {
"type": "integer" "type": "integer"
}, },
@ -2159,6 +2191,10 @@
"type": "string", "type": "string",
"format": "date-time" "format": "date-time"
}, },
"egg_at": {
"type": "string",
"format": "date-time"
},
"luck": { "luck": {
"type": "integer" "type": "integer"
}, },

View File

@ -118,20 +118,24 @@ func init() {
userDescRaidAt := userFields[14].Descriptor() userDescRaidAt := userFields[14].Descriptor()
// user.DefaultRaidAt holds the default value on creation for the raid_at field. // user.DefaultRaidAt holds the default value on creation for the raid_at field.
user.DefaultRaidAt = userDescRaidAt.Default.(func() time.Time) user.DefaultRaidAt = userDescRaidAt.Default.(func() time.Time)
// userDescEggAt is the schema descriptor for egg_at field.
userDescEggAt := userFields[15].Descriptor()
// user.DefaultEggAt holds the default value on creation for the egg_at field.
user.DefaultEggAt = userDescEggAt.Default.(func() time.Time)
// userDescLuckAt is the schema descriptor for luck_at field. // userDescLuckAt is the schema descriptor for luck_at field.
userDescLuckAt := userFields[16].Descriptor() userDescLuckAt := userFields[17].Descriptor()
// user.DefaultLuckAt holds the default value on creation for the luck_at field. // user.DefaultLuckAt holds the default value on creation for the luck_at field.
user.DefaultLuckAt = userDescLuckAt.Default.(func() time.Time) user.DefaultLuckAt = userDescLuckAt.Default.(func() time.Time)
// userDescLikeAt is the schema descriptor for like_at field. // userDescLikeAt is the schema descriptor for like_at field.
userDescLikeAt := userFields[19].Descriptor() userDescLikeAt := userFields[20].Descriptor()
// user.DefaultLikeAt holds the default value on creation for the like_at field. // user.DefaultLikeAt holds the default value on creation for the like_at field.
user.DefaultLikeAt = userDescLikeAt.Default.(func() time.Time) user.DefaultLikeAt = userDescLikeAt.Default.(func() time.Time)
// userDescTenAt is the schema descriptor for ten_at field. // userDescTenAt is the schema descriptor for ten_at field.
userDescTenAt := userFields[29].Descriptor() userDescTenAt := userFields[30].Descriptor()
// user.DefaultTenAt holds the default value on creation for the ten_at field. // user.DefaultTenAt holds the default value on creation for the ten_at field.
user.DefaultTenAt = userDescTenAt.Default.(func() time.Time) user.DefaultTenAt = userDescTenAt.Default.(func() time.Time)
// userDescNext is the schema descriptor for next field. // userDescNext is the schema descriptor for next field.
userDescNext := userFields[30].Descriptor() userDescNext := userFields[31].Descriptor()
// user.DefaultNext holds the default value on creation for the next field. // user.DefaultNext holds the default value on creation for the next field.
user.DefaultNext = userDescNext.Default.(string) user.DefaultNext = userDescNext.Default.(string)
} }

View File

@ -38,7 +38,7 @@ func (Card) Fields() []ent.Field {
} }
if card == 13 { if card == 13 {
card = 2 card = 29
} }
// 2023/04/09 premium card id:15 // 2023/04/09 premium card id:15
@ -103,19 +103,19 @@ func (Card) Fields() []ent.Field {
//Immutable(). //Immutable().
DefaultFunc(func() int { DefaultFunc(func() int {
rand.Seed(time.Now().UnixNano()) rand.Seed(time.Now().UnixNano())
var cp = 1 + rand.Intn(100) var cp = 1 + rand.Intn(200)
if cp == 2 { if cp == 2 {
cp = 50 + rand.Intn(150) cp = 50 + rand.Intn(300)
} }
if card >= 1 { if card >= 1 {
cp = 150 + cp + rand.Intn(300) cp = 200 + cp + rand.Intn(500)
} }
if super == "super" { if super == "super" {
cp = 300 + cp + rand.Intn(500) cp = 400 + cp + rand.Intn(700)
} }
if skill == "critical" { if skill == "critical" {
cp = 300 + cp + rand.Intn(500) cp = 400 + cp + rand.Intn(700)
} }
if card == 22 { if card == 22 {

View File

@ -98,6 +98,12 @@ func (User) Fields() []ent.Field {
return time.Now().In(jst) return time.Now().In(jst)
}), }),
field.Time("egg_at").
Optional().
Default(func() time.Time {
return time.Now().In(jst)
}),
field.Int("luck"). field.Int("luck").
Optional(), Optional(),

View File

@ -46,6 +46,8 @@ type User struct {
UpdatedAt time.Time `json:"updated_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"`
// RaidAt holds the value of the "raid_at" field. // RaidAt holds the value of the "raid_at" field.
RaidAt time.Time `json:"raid_at,omitempty"` RaidAt time.Time `json:"raid_at,omitempty"`
// EggAt holds the value of the "egg_at" field.
EggAt time.Time `json:"egg_at,omitempty"`
// Luck holds the value of the "luck" field. // Luck holds the value of the "luck" field.
Luck int `json:"luck,omitempty"` Luck int `json:"luck,omitempty"`
// LuckAt holds the value of the "luck_at" field. // LuckAt holds the value of the "luck_at" field.
@ -113,7 +115,7 @@ func (*User) scanValues(columns []string) ([]any, error) {
values[i] = new(sql.NullInt64) values[i] = new(sql.NullInt64)
case user.FieldUsername, user.FieldDid, user.FieldToken, user.FieldPassword, user.FieldTenCard, user.FieldTenDelete, user.FieldTenPost, user.FieldTenGet, user.FieldNext: case user.FieldUsername, user.FieldDid, user.FieldToken, user.FieldPassword, user.FieldTenCard, user.FieldTenDelete, user.FieldTenPost, user.FieldTenGet, user.FieldNext:
values[i] = new(sql.NullString) values[i] = new(sql.NullString)
case user.FieldCreatedAt, user.FieldUpdatedAt, user.FieldRaidAt, user.FieldLuckAt, user.FieldLikeAt, user.FieldTenAt: case user.FieldCreatedAt, user.FieldUpdatedAt, user.FieldRaidAt, user.FieldEggAt, user.FieldLuckAt, user.FieldLikeAt, user.FieldTenAt:
values[i] = new(sql.NullTime) values[i] = new(sql.NullTime)
case user.ForeignKeys[0]: // group_users case user.ForeignKeys[0]: // group_users
values[i] = new(sql.NullInt64) values[i] = new(sql.NullInt64)
@ -228,6 +230,12 @@ func (u *User) assignValues(columns []string, values []any) error {
} else if value.Valid { } else if value.Valid {
u.RaidAt = value.Time u.RaidAt = value.Time
} }
case user.FieldEggAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field egg_at", values[i])
} else if value.Valid {
u.EggAt = value.Time
}
case user.FieldLuck: case user.FieldLuck:
if value, ok := values[i].(*sql.NullInt64); !ok { if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field luck", values[i]) return fmt.Errorf("unexpected type %T for field luck", values[i])
@ -407,6 +415,9 @@ func (u *User) String() string {
builder.WriteString("raid_at=") builder.WriteString("raid_at=")
builder.WriteString(u.RaidAt.Format(time.ANSIC)) builder.WriteString(u.RaidAt.Format(time.ANSIC))
builder.WriteString(", ") builder.WriteString(", ")
builder.WriteString("egg_at=")
builder.WriteString(u.EggAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("luck=") builder.WriteString("luck=")
builder.WriteString(fmt.Sprintf("%v", u.Luck)) builder.WriteString(fmt.Sprintf("%v", u.Luck))
builder.WriteString(", ") builder.WriteString(", ")

View File

@ -41,6 +41,8 @@ const (
FieldUpdatedAt = "updated_at" FieldUpdatedAt = "updated_at"
// FieldRaidAt holds the string denoting the raid_at field in the database. // FieldRaidAt holds the string denoting the raid_at field in the database.
FieldRaidAt = "raid_at" FieldRaidAt = "raid_at"
// FieldEggAt holds the string denoting the egg_at field in the database.
FieldEggAt = "egg_at"
// FieldLuck holds the string denoting the luck field in the database. // FieldLuck holds the string denoting the luck field in the database.
FieldLuck = "luck" FieldLuck = "luck"
// FieldLuckAt holds the string denoting the luck_at field in the database. // FieldLuckAt holds the string denoting the luck_at field in the database.
@ -104,6 +106,7 @@ var Columns = []string{
FieldCreatedAt, FieldCreatedAt,
FieldUpdatedAt, FieldUpdatedAt,
FieldRaidAt, FieldRaidAt,
FieldEggAt,
FieldLuck, FieldLuck,
FieldLuckAt, FieldLuckAt,
FieldLike, FieldLike,
@ -170,6 +173,8 @@ var (
DefaultUpdatedAt func() time.Time DefaultUpdatedAt func() time.Time
// DefaultRaidAt holds the default value on creation for the "raid_at" field. // DefaultRaidAt holds the default value on creation for the "raid_at" field.
DefaultRaidAt func() time.Time DefaultRaidAt func() time.Time
// DefaultEggAt holds the default value on creation for the "egg_at" field.
DefaultEggAt func() time.Time
// DefaultLuckAt holds the default value on creation for the "luck_at" field. // DefaultLuckAt holds the default value on creation for the "luck_at" field.
DefaultLuckAt func() time.Time DefaultLuckAt func() time.Time
// DefaultLikeAt holds the default value on creation for the "like_at" field. // DefaultLikeAt holds the default value on creation for the "like_at" field.

View File

@ -130,6 +130,11 @@ func RaidAt(v time.Time) predicate.User {
return predicate.User(sql.FieldEQ(FieldRaidAt, v)) return predicate.User(sql.FieldEQ(FieldRaidAt, v))
} }
// EggAt applies equality check predicate on the "egg_at" field. It's identical to EggAtEQ.
func EggAt(v time.Time) predicate.User {
return predicate.User(sql.FieldEQ(FieldEggAt, v))
}
// Luck applies equality check predicate on the "luck" field. It's identical to LuckEQ. // Luck applies equality check predicate on the "luck" field. It's identical to LuckEQ.
func Luck(v int) predicate.User { func Luck(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldLuck, v)) return predicate.User(sql.FieldEQ(FieldLuck, v))
@ -800,6 +805,56 @@ func RaidAtNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldRaidAt)) return predicate.User(sql.FieldNotNull(FieldRaidAt))
} }
// EggAtEQ applies the EQ predicate on the "egg_at" field.
func EggAtEQ(v time.Time) predicate.User {
return predicate.User(sql.FieldEQ(FieldEggAt, v))
}
// EggAtNEQ applies the NEQ predicate on the "egg_at" field.
func EggAtNEQ(v time.Time) predicate.User {
return predicate.User(sql.FieldNEQ(FieldEggAt, v))
}
// EggAtIn applies the In predicate on the "egg_at" field.
func EggAtIn(vs ...time.Time) predicate.User {
return predicate.User(sql.FieldIn(FieldEggAt, vs...))
}
// EggAtNotIn applies the NotIn predicate on the "egg_at" field.
func EggAtNotIn(vs ...time.Time) predicate.User {
return predicate.User(sql.FieldNotIn(FieldEggAt, vs...))
}
// EggAtGT applies the GT predicate on the "egg_at" field.
func EggAtGT(v time.Time) predicate.User {
return predicate.User(sql.FieldGT(FieldEggAt, v))
}
// EggAtGTE applies the GTE predicate on the "egg_at" field.
func EggAtGTE(v time.Time) predicate.User {
return predicate.User(sql.FieldGTE(FieldEggAt, v))
}
// EggAtLT applies the LT predicate on the "egg_at" field.
func EggAtLT(v time.Time) predicate.User {
return predicate.User(sql.FieldLT(FieldEggAt, v))
}
// EggAtLTE applies the LTE predicate on the "egg_at" field.
func EggAtLTE(v time.Time) predicate.User {
return predicate.User(sql.FieldLTE(FieldEggAt, v))
}
// EggAtIsNil applies the IsNil predicate on the "egg_at" field.
func EggAtIsNil() predicate.User {
return predicate.User(sql.FieldIsNull(FieldEggAt))
}
// EggAtNotNil applies the NotNil predicate on the "egg_at" field.
func EggAtNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldEggAt))
}
// LuckEQ applies the EQ predicate on the "luck" field. // LuckEQ applies the EQ predicate on the "luck" field.
func LuckEQ(v int) predicate.User { func LuckEQ(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldLuck, v)) return predicate.User(sql.FieldEQ(FieldLuck, v))

View File

@ -215,6 +215,20 @@ func (uc *UserCreate) SetNillableRaidAt(t *time.Time) *UserCreate {
return uc return uc
} }
// SetEggAt sets the "egg_at" field.
func (uc *UserCreate) SetEggAt(t time.Time) *UserCreate {
uc.mutation.SetEggAt(t)
return uc
}
// SetNillableEggAt sets the "egg_at" field if the given value is not nil.
func (uc *UserCreate) SetNillableEggAt(t *time.Time) *UserCreate {
if t != nil {
uc.SetEggAt(*t)
}
return uc
}
// SetLuck sets the "luck" field. // SetLuck sets the "luck" field.
func (uc *UserCreate) SetLuck(i int) *UserCreate { func (uc *UserCreate) SetLuck(i int) *UserCreate {
uc.mutation.SetLuck(i) uc.mutation.SetLuck(i)
@ -533,6 +547,10 @@ func (uc *UserCreate) defaults() {
v := user.DefaultRaidAt() v := user.DefaultRaidAt()
uc.mutation.SetRaidAt(v) uc.mutation.SetRaidAt(v)
} }
if _, ok := uc.mutation.EggAt(); !ok {
v := user.DefaultEggAt()
uc.mutation.SetEggAt(v)
}
if _, ok := uc.mutation.LuckAt(); !ok { if _, ok := uc.mutation.LuckAt(); !ok {
v := user.DefaultLuckAt() v := user.DefaultLuckAt()
uc.mutation.SetLuckAt(v) uc.mutation.SetLuckAt(v)
@ -655,6 +673,10 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
_spec.SetField(user.FieldRaidAt, field.TypeTime, value) _spec.SetField(user.FieldRaidAt, field.TypeTime, value)
_node.RaidAt = value _node.RaidAt = value
} }
if value, ok := uc.mutation.EggAt(); ok {
_spec.SetField(user.FieldEggAt, field.TypeTime, value)
_node.EggAt = value
}
if value, ok := uc.mutation.Luck(); ok { if value, ok := uc.mutation.Luck(); ok {
_spec.SetField(user.FieldLuck, field.TypeInt, value) _spec.SetField(user.FieldLuck, field.TypeInt, value)
_node.Luck = value _node.Luck = value

View File

@ -269,6 +269,26 @@ func (uu *UserUpdate) ClearRaidAt() *UserUpdate {
return uu return uu
} }
// SetEggAt sets the "egg_at" field.
func (uu *UserUpdate) SetEggAt(t time.Time) *UserUpdate {
uu.mutation.SetEggAt(t)
return uu
}
// SetNillableEggAt sets the "egg_at" field if the given value is not nil.
func (uu *UserUpdate) SetNillableEggAt(t *time.Time) *UserUpdate {
if t != nil {
uu.SetEggAt(*t)
}
return uu
}
// ClearEggAt clears the value of the "egg_at" field.
func (uu *UserUpdate) ClearEggAt() *UserUpdate {
uu.mutation.ClearEggAt()
return uu
}
// SetLuck sets the "luck" field. // SetLuck sets the "luck" field.
func (uu *UserUpdate) SetLuck(i int) *UserUpdate { func (uu *UserUpdate) SetLuck(i int) *UserUpdate {
uu.mutation.ResetLuck() uu.mutation.ResetLuck()
@ -790,6 +810,12 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
if uu.mutation.RaidAtCleared() { if uu.mutation.RaidAtCleared() {
_spec.ClearField(user.FieldRaidAt, field.TypeTime) _spec.ClearField(user.FieldRaidAt, field.TypeTime)
} }
if value, ok := uu.mutation.EggAt(); ok {
_spec.SetField(user.FieldEggAt, field.TypeTime, value)
}
if uu.mutation.EggAtCleared() {
_spec.ClearField(user.FieldEggAt, field.TypeTime)
}
if value, ok := uu.mutation.Luck(); ok { if value, ok := uu.mutation.Luck(); ok {
_spec.SetField(user.FieldLuck, field.TypeInt, value) _spec.SetField(user.FieldLuck, field.TypeInt, value)
} }
@ -1212,6 +1238,26 @@ func (uuo *UserUpdateOne) ClearRaidAt() *UserUpdateOne {
return uuo return uuo
} }
// SetEggAt sets the "egg_at" field.
func (uuo *UserUpdateOne) SetEggAt(t time.Time) *UserUpdateOne {
uuo.mutation.SetEggAt(t)
return uuo
}
// SetNillableEggAt sets the "egg_at" field if the given value is not nil.
func (uuo *UserUpdateOne) SetNillableEggAt(t *time.Time) *UserUpdateOne {
if t != nil {
uuo.SetEggAt(*t)
}
return uuo
}
// ClearEggAt clears the value of the "egg_at" field.
func (uuo *UserUpdateOne) ClearEggAt() *UserUpdateOne {
uuo.mutation.ClearEggAt()
return uuo
}
// SetLuck sets the "luck" field. // SetLuck sets the "luck" field.
func (uuo *UserUpdateOne) SetLuck(i int) *UserUpdateOne { func (uuo *UserUpdateOne) SetLuck(i int) *UserUpdateOne {
uuo.mutation.ResetLuck() uuo.mutation.ResetLuck()
@ -1763,6 +1809,12 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error)
if uuo.mutation.RaidAtCleared() { if uuo.mutation.RaidAtCleared() {
_spec.ClearField(user.FieldRaidAt, field.TypeTime) _spec.ClearField(user.FieldRaidAt, field.TypeTime)
} }
if value, ok := uuo.mutation.EggAt(); ok {
_spec.SetField(user.FieldEggAt, field.TypeTime, value)
}
if uuo.mutation.EggAtCleared() {
_spec.ClearField(user.FieldEggAt, field.TypeTime)
}
if value, ok := uuo.mutation.Luck(); ok { if value, ok := uuo.mutation.Luck(); ok {
_spec.SetField(user.FieldLuck, field.TypeInt, value) _spec.SetField(user.FieldLuck, field.TypeInt, value)
} }

View File

@ -18,5 +18,5 @@ id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$1\")
card=$2 card=$2
cp=$3 cp=$3
s=super s=super
skill=normal skill=dragon
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\",\"skill\":\"$skill\"}" -sL $host/cards curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\",\"skill\":\"$skill\"}" -sL $host/cards

15
tmp/card_add_book1.zsh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/zsh
host=https://api.syui.ai
pass=`cat ~/.config/atr/api_card.json|jq -r .password`
if [ -z "$1" ];then
exit
fi
echo username
read
id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$1\")"|jq -r .id`
card=43
cp=0
s=book
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\"}" -sL $host/cards

21
tmp/card_add_change.zsh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/zsh
case $OSTYPE in
darwin*)
alias date="/opt/homebrew/bin/gdate"
;;
esac
echo cid
read cid
card_status=book
host=https://api.syui.ai
token=`cat ~/.config/atr/api_card.json|jq -r .token`
data=`curl -sL "https://api.syui.ai/users?itemsPerPage=2555"`
book=`echo $data|jq ".[]|select(.book == true)|.book"`
id=`echo $data|jq ".[]|select(.fav != 0)|.id"`
echo $book
curl -X PATCH -H "Content-Type: application/json" -d "{\"status\":\"$card_status\",\"token\":\"$token\"}" $host/cards/$cid

View File

@ -31,6 +31,3 @@ do
fi fi
done done
aki3
967

View File

@ -20,9 +20,10 @@ n=$((n - 1))
if [ -n "$1" ];then if [ -n "$1" ];then
id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$1\")"|jq -r .id` id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$1\")"|jq -r .id`
if [ "ai" = "$1" ] || [ "yui" = "$1" ];then if [ "ai" = "$1" ] || [ "yui" = "$1" ];then
curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\", \"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"token\":\"$token\", \"luck_at\": \"$now_at\", \"luck\": 7, \"like\":0,\"aiten\":1000}" -s $host/users/$id curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\", \"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"token\":\"$token\", \"luck_at\": \"$now_at\"}" -s $host/users/$id
else else
curl -X PATCH -H "Content-Type: application/json" -d "{\"raid_at\": \"$updated_at_n\",\"token\": \"$token\"}" -s $host/users/$id curl -X PATCH -H "Content-Type: application/json" -d "{\"ten_at\":\"$updated_at_n\", \"token\": \"$token\"}" -s $host/users/$id
#curl -X PATCH -H "Content-Type: application/json" -d "{\"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"luck_at\": \"$updated_at_n\",\"egg_at\": \"$updated_at_n\", \"token\": \"$token\"}" -s $host/users/$id
#curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\", \"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"luck_at\": \"$updated_at_n\", \"ten_at\": \"$updated_at_n\",\"token\": \"$token\"}" -s $host/users/$id #curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\", \"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"luck_at\": \"$updated_at_n\", \"ten_at\": \"$updated_at_n\",\"token\": \"$token\"}" -s $host/users/$id
fi fi
exit exit
@ -36,7 +37,8 @@ do
if [ "ai" = "$1" ];then if [ "ai" = "$1" ];then
curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\", \"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"token\":\"$token\", \"luck_at\": \"$now_at\", \"luck\": 7}" -s $host/users/$id curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\", \"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"token\":\"$token\", \"luck_at\": \"$now_at\", \"luck\": 7}" -s $host/users/$id
else else
curl -X PATCH -H "Content-Type: application/json" -d "{\"raid_at\":\"$raid_at_n\",\"token\": \"$token\", \"ten_at\": \"$updated_at_n\"}" -s $host/users/$id #curl -X PATCH -H "Content-Type: application/json" -d "{\"egg_at\":\"$raid_at_n\", \"raid_at\":\"$raid_at_n\",\"token\": \"$token\"}" -s $host/users/$id
curl -X PATCH -H "Content-Type: application/json" -d "{\"ten_at\":\"$updated_at_n\", \"token\": \"$token\"}" -s $host/users/$id
#curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\", \"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"token\":\"$token\", \"luck_at\": \"$now_at\", \"ten_at\": \"$updated_at_n\"}" -s $host/users/$id #curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\", \"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"token\":\"$token\", \"luck_at\": \"$now_at\", \"ten_at\": \"$updated_at_n\"}" -s $host/users/$id
fi fi
done done

38
tmp/card_search.zsh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/zsh
case $OSTYPE in
darwin*)
alias date="/opt/homebrew/bin/gdate"
;;
esac
host=https://api.syui.ai
token=`cat ~/.config/atr/api_card.json|jq -r .token`
host_users="$host/users?itemsPerPage=2550"
updated_at_n=`date --iso-8601=seconds -d '1 days ago'`
now_at=`date --iso-8601=seconds`
raid_at_n=`date --iso-8601=seconds -d '1 days ago'`
data=`curl -sL "$host_users"|jq .`
nd=`date +"%Y%m%d"`
n=`echo $data|jq length`
n=$((n - 1))
if [ -z "$1" ];then
echo card
read card
else
echo card=$1
read
card=$1
fi
for ((i=0;i<=$n;i++))
do
name=`echo $data|jq ".[$i]"|jq -r .username`
id=`echo $data|jq ".[$i]"|jq -r .id`
data_uu=`curl -sL "$host/users/$id/card?itemsPerPage=4000"`
card_check=`echo $data_uu|jq -r ".[]|select(.card == $card)"`
if [ -n "$card_check" ];then
echo $name
fi
done

View File

@ -183,6 +183,7 @@ func (h *OgentHandler) UpdateCard(ctx context.Context, req *UpdateCardReq, param
// DeleteCard handles DELETE /cards/{id} requests. // DeleteCard handles DELETE /cards/{id} requests.
func (h *OgentHandler) DeleteCard(ctx context.Context, params DeleteCardParams) (DeleteCardRes, error) { func (h *OgentHandler) DeleteCard(ctx context.Context, params DeleteCardParams) (DeleteCardRes, error) {
err := h.client.Card.DeleteOneID(0).Exec(ctx) err := h.client.Card.DeleteOneID(0).Exec(ctx)
//err := h.client.Card.DeleteOneID(params.ID).Exec(ctx)
if err != nil { if err != nil {
switch { switch {
case ent.IsNotFound(err): case ent.IsNotFound(err):
@ -523,6 +524,9 @@ func (h *OgentHandler) CreateUser(ctx context.Context, req *CreateUserReq) (Crea
if v, ok := req.Token.Get(); ok { if v, ok := req.Token.Get(); ok {
b.SetToken(v) b.SetToken(v)
} }
if v, ok := req.EggAt.Get(); ok {
b.SetEggAt(v)
}
if v, ok := req.CreatedAt.Get(); ok { if v, ok := req.CreatedAt.Get(); ok {
b.SetCreatedAt(v) b.SetCreatedAt(v)
} }
@ -674,6 +678,9 @@ func (h *OgentHandler) UpdateUser(ctx context.Context, req *UpdateUserReq, param
if v, ok := req.Handle.Get(); ok { if v, ok := req.Handle.Get(); ok {
b.SetHandle(v) b.SetHandle(v)
} }
if v, ok := req.EggAt.Get(); ok {
b.SetEggAt(v)
}
if v, ok := req.UpdatedAt.Get(); ok { if v, ok := req.UpdatedAt.Get(); ok {
b.SetUpdatedAt(v) b.SetUpdatedAt(v)
} }