package controllers import ( "apigame/configs-db/confcardholder" "apigame/models" "apigame/service/code-msg" "encoding/json" "fmt" ) // DemoController 绑定控制器 type DemoController struct { BaseController } // Demo demo func (c *DemoController) Demo() { req := new(models.ReqDemo) if !c.GetPostData(req) { return } rsp := models.RspDemo{} fmt.Println("DemoController.demo") //lxalilog.Errors("DemoController.demo") //{ // gameId := "10149" // { // conf := new(confdemo.DemoConfig) // has := confbase.LoadData[*confdemo.DemoConfig, confdemo.DemoConfigRaw](gameId, 1, conf) // fmt.Println(has) // fmt.Println(conf) // // confbase.SaveCache(gameId, conf) // } // { // conf := &confdemo.DemoConfig{Id: 1} // has := confbase.LoadCache(gameId, conf) // fmt.Println(has) // fmt.Println(conf) // } //} { //cs := configs.GetTable(configs.AbTestCfg{}).Items() //for _, dt := range cs { // conf := dt.(*configs.AbTestCfg) // fmt.Println(conf) //} //fmt.Println("cs", zjson.Str(cs)) //rsp.Data = cs } { config, hasConfig := confcardholder.GetCurrent("10149") if hasConfig { fmt.Println(config.ListSequenceId) } } c.RetRspCodeData(code_msg.RECODE_OK, rsp) } // Dump Dump func (c *DemoController) Dump() { req := new(models.ReqDump) err := json.Unmarshal(c.Ctx.Input.RequestBody, &req) if err != nil { c.RetCode(code_msg.RECODE_PARAMERROR) return } rsp := models.RspDump{} rsp.Text = "hello" c.RetRspCodeData(code_msg.RECODE_OK, rsp) }