This commit is contained in:
yangduo 2024-12-06 23:02:19 +08:00
parent c03212df1c
commit 9e77777f81

View File

@ -163,27 +163,20 @@ func (this *User) UpdateName() error {
func (this *User) AddAwardGrid(gridid int32) error { func (this *User) AddAwardGrid(gridid int32) error {
awardGridsList := this.GetAwardGrids() awardGridsList := this.GetAwardGrids()
if len(awardGridsList) > 1 { if len(awardGridsList) > 0 {
this.awardGrids += "," this.awardGrids += ","
} }
this.awardGrids += q5.SafeToString(gridid) this.awardGrids += q5.SafeToString(gridid)
if err := this.UpdateFields([]string{"award_grids"}); err != nil { return this.UpdateFields([]string{"award_grids"})
return err
}
return nil
} }
func (this *User) ClearAwardGrid() error { func (this *User) ClearAwardGrid() error {
this.awardGrids = "" this.awardGrids = ""
if err := this.UpdateFields([]string{"award_grids"}); err != nil { return this.UpdateFields([]string{"award_grids"})
return err
}
return nil
} }
func (this *User) GetAwardGrids() []int32 { func (this *User) GetAwardGrids() []int32 {
gridstr := strings.Split(this.awardGrids, ",") gridstr := strings.Split(this.awardGrids, ",")
awardGridsList := []int32{} awardGridsList := []int32{}
for _, item := range gridstr { for _, item := range gridstr {