蛋蛋星球 后台端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 3 седмици
преди 3 седмици
преди 1 седмица
преди 3 седмици
преди 1 седмица
преди 3 седмици
преди 3 седмици
преди 3 седмици
преди 3 седмици
преди 3 седмици
преди 2 седмици
преди 3 седмици
преди 3 седмици
преди 1 седмица
преди 1 седмица
преди 1 седмица
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. package advertising
  2. import (
  3. "applet/app/db"
  4. "applet/app/e"
  5. "applet/app/md"
  6. "applet/app/svc"
  7. "applet/app/svc/sys_cfg"
  8. "applet/app/utils"
  9. "code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
  10. "code.fnuoos.com/EggPlanet/egg_models.git/src/model"
  11. "github.com/gin-gonic/gin"
  12. "github.com/tidwall/gjson"
  13. )
  14. func GetBasic(c *gin.Context) {
  15. NewAdvertisingBasicDb := implement.NewAdvertisingBasicDb(db.Db)
  16. data, _ := NewAdvertisingBasicDb.GetAdvertisingBasicDb()
  17. if data == nil {
  18. data = &model.AdvertisingBasic{}
  19. db.Db.Insert(data)
  20. }
  21. selsctData := md.AdvertisingPlatform
  22. AdvertisingBase := md.AdvertisingBase{
  23. AndroidAdIsOpen: utils.IntToStr(data.AndroidAdIsOpen),
  24. IosAdIsOpen: utils.IntToStr(data.IosAdIsOpen),
  25. AndroidOpenAdIsOpen: utils.IntToStr(data.AndroidOpenAdIsOpen),
  26. IosOpenAdIsOpen: utils.IntToStr(data.IosOpenAdIsOpen),
  27. Voice: data.Voice,
  28. VoiceUrl: svc.GetOssUrl(data.Voice),
  29. Info: data.Info,
  30. }
  31. res := md.AdvertisingBaseResp{
  32. SelectData: selsctData,
  33. AdvertisingBase: AdvertisingBase,
  34. }
  35. e.OutSuc(c, res, nil)
  36. return
  37. }
  38. func SetBasic(c *gin.Context) {
  39. var req *md.AdvertisingBase
  40. if err := c.ShouldBindJSON(&req); err != nil {
  41. e.OutErr(c, e.ERR_INVALID_ARGS, err)
  42. return
  43. }
  44. NewAdvertisingBasicDb := implement.NewAdvertisingBasicDb(db.Db)
  45. data, _ := NewAdvertisingBasicDb.GetAdvertisingBasicDb()
  46. data.AndroidAdIsOpen = utils.StrToInt(req.AndroidAdIsOpen)
  47. data.IosAdIsOpen = utils.StrToInt(req.IosAdIsOpen)
  48. data.AndroidOpenAdIsOpen = utils.StrToInt(req.AndroidOpenAdIsOpen)
  49. data.IosOpenAdIsOpen = utils.StrToInt(req.IosOpenAdIsOpen)
  50. data.Voice = req.Voice
  51. data.Info = req.Info
  52. db.Db.Where("id=?", data.Id).AllCols().Update(data)
  53. e.OutSuc(c, "success", nil)
  54. return
  55. }
  56. func GetPlayletBasic(c *gin.Context) {
  57. playletBase := svc.GetSysCfgStr("playlet_incentive_base")
  58. var res = md.PlayletIncentiveBaseData{
  59. AndroidAdvId: gjson.Get(playletBase, "android_adv_id").String(),
  60. AndroidAdvSecret: gjson.Get(playletBase, "android_adv_secret").String(),
  61. IosAdvId: gjson.Get(playletBase, "ios_adv_id").String(),
  62. IosAdvSecret: gjson.Get(playletBase, "ios_adv_secret").String(),
  63. }
  64. e.OutSuc(c, res, nil)
  65. return
  66. }
  67. func SetPlayletBasic(c *gin.Context) {
  68. var req md.PlayletIncentiveBaseData
  69. err := c.ShouldBindJSON(&req)
  70. if err != nil {
  71. err = svc.HandleValidateErr(err)
  72. err1 := err.(e.E)
  73. e.OutErr(c, err1.Code, err1.Error())
  74. return
  75. }
  76. sysCfgDb := sys_cfg.NewSysCfgDb(db.Db)
  77. sysCfgDb.SysCfgUpdate("playlet_incentive_base", utils.SerializeStr(req))
  78. e.OutSuc(c, "success", nil)
  79. return
  80. }