This commit is contained in:
@@ -145,6 +145,22 @@ func (s *CdkService) GetByID(id uint32) *model.CDKConfig {
|
||||
return item
|
||||
}
|
||||
|
||||
func (s *CdkService) GetRewardByIDIncludeDeleted(id uint32) *model.CDKConfig {
|
||||
if id == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var item *model.CDKConfig
|
||||
dbm_nocache_noenable(s.Model).Unscoped().Where("id", id).Where("type", CDKTypeReward).Scan(&item)
|
||||
return item
|
||||
}
|
||||
|
||||
func (s *CdkService) SignRewardOptions() []model.CDKConfig {
|
||||
var items []model.CDKConfig
|
||||
dbm_nocache_noenable(s.Model).Unscoped().Where("type", CDKTypeReward).OrderDesc("id").Scan(&items)
|
||||
return items
|
||||
}
|
||||
|
||||
func (s *CdkService) All() []model.CDKConfig {
|
||||
var item []model.CDKConfig
|
||||
dbm_notenable(s.Model).WhereLT("exchange_remain_count", 0).Scan(&item)
|
||||
|
||||
@@ -58,8 +58,8 @@ func (s *SignInService) ModifyBefore(ctx context.Context, method string, param g
|
||||
if cdkID == 0 {
|
||||
return fmt.Errorf("cdk_id不能为空")
|
||||
}
|
||||
if NewCdkService().GetByID(cdkID) == nil {
|
||||
return fmt.Errorf("绑定的CDK不存在")
|
||||
if NewCdkService().GetRewardByIDIncludeDeleted(cdkID) == nil {
|
||||
return fmt.Errorf("绑定的CDK不存在或不是普通奖励类型")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user