互动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.3 KiB

package pc
import (
"hudongzhuanjia/controllers"
"hudongzhuanjia/models"
"hudongzhuanjia/utils/code"
"hudongzhuanjia/utils/define"
)
type PadSignCtl struct {
controllers.AuthorCtl
}
func (t *PadSignCtl) Setting() {
activityId := t.MustGetInt("activity_id")
// rehearsalId := t.MustGetInt("rehearsal_id")
// 平板签约信息
padSigning := &models.PadSigning{}
exist, err := padSigning.GetByActivityId(activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_PAD_SIGNING_NOT_EXIST, "平板签约信息异常")
signers, err := models.ListPadSignerByActivityId(activityId)
t.CheckErr(err)
t.JSON(map[string]interface{}{
"pad_signing": padSigning,
"pad_signers": signers,
})
}
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)
return
}
padSigning := &models.PadSigning{}
exist, err := padSigning.GetByActivityId(activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_PAD_SIGNING_NOT_EXIST, "平板签约信息异常")
padSigning.PadSignStatus = status
_, err = padSigning.Update(padSigning, padSigning.Id, "pad_sign_status")
t.CheckErr(err)
t.DisplayBySuccess("已" + status)
}