From 3e017cfb90a40800733f02d65ae7fee45fc3412d Mon Sep 17 00:00:00 2001 From: Ray <141715925+ray-monica@users.noreply.github.com> Date: Fri, 12 Jan 2024 14:37:18 +0800 Subject: [PATCH] Update template.go change Context actiontype in main function --- go/patterns/template/template.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/go/patterns/template/template.go b/go/patterns/template/template.go index 364f34e..a28f82a 100644 --- a/go/patterns/template/template.go +++ b/go/patterns/template/template.go @@ -161,11 +161,7 @@ func (lottery *Lottery) Run(ctx *Context) (err error) { // checkSerialNo 校验活动编号(serial_no)是否存在 func (lottery *Lottery) checkSerialNo(ctx *Context) (err error) { fmt.Println(runFuncName(), "校验活动编号(serial_no)是否存在、并获取活动信息...") - // 获取活动信息伪代码 - ctx.ActInfo = &ActInfo{ - // 假设当前的活动类型为按抽奖次数抽奖 - ActivityType: ConstActTypeTimes, - } + // 获取当前抽奖类型的具体行为 switch ctx.ActInfo.ActivityType { @@ -247,6 +243,7 @@ func (lottery *Lottery) packagePrizeInfo(ctx *Context) (err error) { } func main() { + ctx:=&Context{&ActInfo{ActivityType: ConstActTypeAmount} } (&Lottery{}).Run(&Context{}) }