Browse Source

fix:bug

dev
Tooooommy 4 years ago
parent
commit
548ac9d9e8
  1. 8
      controllers/pc/pad_sign.go
  2. 5
      models/pad_signing.go

8
controllers/pc/pad_sign.go

@ -13,10 +13,11 @@ type PadSignCtl struct {
func (t *PadSignCtl) Setting() {
activityId := t.MustGetInt("activity_id")
rehearsalId := t.MustGetInt("rehearsal_id")
// 平板签约信息
padSigning := &models.PadSigning{}
exist, err := padSigning.GetByActivityId(activityId)
exist, err := padSigning.GetByActivityId(activityId, rehearsalId)
t.CheckErr(err)
t.Assert(exist, code.MSG_PAD_SIGNING_NOT_EXIST, "平板签约信息异常")
@ -31,6 +32,7 @@ func (t *PadSignCtl) Setting() {
func (t *PadSignCtl) Switch() {
activityId := t.MustGetInt("activity_id")
rehearsalId := t.MustGetInt("rehearsal_id")
status := t.MustGet("status")
if status != define.StatusOpen && status != define.StatusClose {
t.DisplayByError("status值为开启或关闭", code.MSG_ERR_Param)
@ -38,12 +40,12 @@ func (t *PadSignCtl) Switch() {
}
padSigning := &models.PadSigning{}
exist, err := padSigning.GetByActivityId(activityId)
exist, err := padSigning.GetByActivityId(activityId, rehearsalId)
t.CheckErr(err)
t.Assert(exist, code.MSG_PAD_SIGNING_NOT_EXIST, "平板签约信息异常")
padSigning.PadSignStatus = status
_, err = padSigning.Update(padSigning, padSigning.Id, "status")
_, err = padSigning.Update(padSigning, padSigning.Id, "pad_sign_status")
t.CheckErr(err)
t.DisplayBySuccess("已" + status)
}

5
models/pad_signing.go

@ -8,6 +8,7 @@ type PadSigning struct {
Model `xorm:"extends"`
ActivityId int `json:"activity_id" xorm:"not null default 0 comment('互动id') INT(11)"`
RehearsalId int `json:"rehearsal_id" xorm:"not null default 0 comment('彩排id') INT(11)"`
CustomerId int `json:"customer_id" xorm:"not null default 0 comment('客户id') INT(11)"`
SignTheme string `json:"sign_theme" xorm:"not null default '' comment('签约主题') VARCHAR(255)"`
MaxBgUrl string `json:"max_bg_url" xorm:"not null default '' comment('大屏幕链接') VARCHAR(255)"`
@ -18,6 +19,6 @@ func (t *PadSigning) TableName() string {
return PadSigningTN
}
func (t *PadSigning) GetByActivityId(activityId int) (bool, error) {
return core.GetXormAuto().Where("activity_id=? and is_delete=0", activityId).Get(t)
func (t *PadSigning) GetByActivityId(activityId, rehearsalId int) (bool, error) {
return core.GetXormAuto().Where("activity_id=? and rehearsal_id=? and is_delete=0", activityId, rehearsalId).Get(t)
}
Loading…
Cancel
Save