diff --git a/controllers/pc/tug_war.go b/controllers/pc/tug_war.go index 3968099..52aa06c 100644 --- a/controllers/pc/tug_war.go +++ b/controllers/pc/tug_war.go @@ -164,7 +164,7 @@ func (t *TugOfWarCtl) Team() { func (t *TugOfWarCtl) Member() { baheId := t.MustGetInt64("bahe_activity_id") - bahe := models.TugOfWar{} + bahe := &models.TugOfWar{} exist, err := models.Get(bahe, baheId) t.CheckErr(err) t.Assert(exist, code.MSG_TUGWAR_NOT_EXIST, "拔河不存在") @@ -207,7 +207,7 @@ type BaheScoreResult struct { func (t *TugOfWarCtl) Score() { baheId := t.MustGetInt64("bahe_activity_id") - bahe := models.TugOfWar{} + bahe := &models.TugOfWar{} exist, err := models.Get(bahe, baheId) t.CheckErr(err) t.Assert(exist, code.MSG_TUGWAR_NOT_EXIST, "拔河不存在") diff --git a/models/arch.go b/models/arch.go index 710af9f..7e2ffb6 100644 --- a/models/arch.go +++ b/models/arch.go @@ -8,7 +8,7 @@ import ( const ArchTableName = TableNamePrefix + "arch" type Arch struct { - Id int `json:"id"` + Id int `json:"id" xorm:"not null pk INT(11)"` CustomerId int `json:"customer_id"` ActivityId int `json:"activity_id"` Date string `json:"date"` diff --git a/models/base.go b/models/base.go index 905516b..eca50eb 100644 --- a/models/base.go +++ b/models/base.go @@ -140,7 +140,7 @@ func Alias(bean interface{}, alias string) string { } func Get(bean interface{}, id int64) (bool, error) { - return core.GetXormAuto().Where("is_delete=0 and id=?", id).Get(bean) + return core.GetXormAuto().NoAutoCondition().Where("is_delete=0 and id=?", id).Get(bean) } func Del(bean interface{}, id interface{}) (int64, error) { @@ -153,9 +153,9 @@ func Add(bean interface{}) (int64, error) { func Update(id, bean interface{}, field ...string) (int64, error) { if len(field) > 0 { - return core.GetXormAuto().ID(id).Cols(field...).Update(bean) + return core.GetXormAuto().NoAutoCondition().ID(id).Cols(field...).Update(bean) } else { - return core.GetXormAuto().ID(id).Update(bean) + return core.GetXormAuto().NoAutoCondition().ID(id).Update(bean) } } diff --git a/models/reward_history.go b/models/reward_history.go index 3a2d157..1e5595f 100644 --- a/models/reward_history.go +++ b/models/reward_history.go @@ -23,7 +23,7 @@ type RewardHistory struct { RehearsalId int64 `json:"rehearsal_id" xorm:"not null default 0 comment('彩排id/0正式') INT(11)"` UserId int64 `json:"user_id" xorm:"not null default 0 comment('用户得id') INT(11)"` Content string `json:"content" xorm:"not null comment('内容') text"` - Amount float64 `json:"amount" xorm:"not null default(0.00) comment('金额') DECIMAL(18)"` + Amount float64 `json:"amount" xorm:"not null default(0.00) comment('金额')"` Status int `json:"status" xorm:"not null default(0) comment('-1未支付,0未审核,1未通过,2已通过,3已推送,4已退款') INT(11)"` ReviewTime int64 `json:"review_time" xorm:"not null default(0) comment('审核时间') INT(11)"` ExpireTime int64 `json:"expire_time" xorm:"not null default(0) comment('过期时间') INT(11)"`