|
@ -0,0 +1,49 @@ |
|
|
|
|
|
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") |
|
|
|
|
|
|
|
|
|
|
|
// 平板签约信息
|
|
|
|
|
|
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") |
|
|
|
|
|
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, "status") |
|
|
|
|
|
t.CheckErr(err) |
|
|
|
|
|
t.DisplayBySuccess("已" + status) |
|
|
|
|
|
} |