|
- package content_reward
-
- import (
- "applet/app/db"
- "applet/app/e"
- "applet/app/md"
- "applet/app/svc"
- "applet/app/svc/sys_cfg"
- "applet/app/utils"
- "github.com/gin-gonic/gin"
- "github.com/tidwall/gjson"
- )
-
- func PlayletBase(c *gin.Context) {
- playletBase := svc.GetSysCfgStr("playlet_base")
- var res = md.PlayletBaseData{
- Reward: gjson.Get(playletBase, "reward").String(),
- Total: gjson.Get(playletBase, "total").String(),
- FirstCount: gjson.Get(playletBase, "first_count").String(),
- SecondCount: gjson.Get(playletBase, "second_count").String(),
- DayOneCount: gjson.Get(playletBase, "day_one_count").String(),
- }
- e.OutSuc(c, res, nil)
- return
- }
-
- func PlayletBaseSave(c *gin.Context) {
- var req md.PlayletBaseData
- err := c.ShouldBindJSON(&req)
- if err != nil {
- err = svc.HandleValidateErr(err)
- err1 := err.(e.E)
- e.OutErr(c, err1.Code, err1.Error())
- return
- }
-
- sysCfgDb := sys_cfg.NewSysCfgDb(db.Db)
- sysCfgDb.SysCfgUpdate("playlet_base", utils.SerializeStr(req))
- e.OutSuc(c, "success", nil)
- return
- }
|