Tooooommy
4 years ago
4 changed files with 97 additions and 0 deletions
@ -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) |
|||
} |
@ -0,0 +1,24 @@ |
|||
package models |
|||
|
|||
import "github.com/ouxuanserver/osmanthuswine/src/core" |
|||
|
|||
const PadSignerTN = TableNamePrefix + "pad_signer" |
|||
|
|||
type PadSigner struct { |
|||
Model `xorm:"extends"` |
|||
|
|||
ActivityId int `json:"activity_id" xorm:"not null default 0 comment('互动id') INT(11)"` |
|||
PadSignerName string `json:"pad_signer_name" xorm:"not null default '' comment('签约方名称')"` |
|||
PadBgUrl string `json:"pad_bg_url" xorm:"not null default '' comment('平板背景链接') VARCHAR(255)"` |
|||
Sid int `json:"sid" xorm:"not null default 0 comment('排序') INT(11)"` |
|||
WsId int `json:"ws_id" xorm:"not null default '' comment('websocket连接标识id') VARCHAR(255)"` |
|||
} |
|||
|
|||
func (t *PadSigner) TableName() string { |
|||
return PadSigningTN |
|||
} |
|||
|
|||
func ListPadSignerByActivityId(activityId int) (signers []*PadSigner, err error) { |
|||
err = core.GetXormAuto().Where("activity_id=? and is_delete=0", activityId).Find(&signers) |
|||
return |
|||
} |
@ -0,0 +1,23 @@ |
|||
package models |
|||
|
|||
import "github.com/ouxuanserver/osmanthuswine/src/core" |
|||
|
|||
const PadSigningTN = TableNamePrefix + "pad_signing" |
|||
|
|||
type PadSigning struct { |
|||
Model `xorm:"extends"` |
|||
|
|||
ActivityId int `json:"activity_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)"` |
|||
PadSignStatus string `json:"pad_sign_status" xorm:"not null default '关闭' comment('平板签约状态开启或关闭') VARCHAR(128)" ` |
|||
} |
|||
|
|||
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) |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue