一物一码
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

40 行
1.2 KiB

  1. package hdl
  2. import (
  3. "applet/app/db"
  4. "applet/app/e"
  5. "applet/app/enum"
  6. "applet/app/lib/validate"
  7. "applet/app/md"
  8. "github.com/gin-gonic/gin"
  9. )
  10. func GetSysCfg(c *gin.Context) {
  11. sysCfgDb := db.SysCfgDb{}
  12. sysCfgDb.Set()
  13. res := sysCfgDb.SysCfgFindWithDb(enum.WxMchApiV3Key, enum.WxMchCertificateSerialNumber, enum.WxMchId, enum.WxOfficialAccountAppId, enum.WxOfficialAccountAppSecret)
  14. e.OutSuc(c, res, nil)
  15. return
  16. }
  17. func SetSysCfg(c *gin.Context) {
  18. var req md.SetSysCfgReq
  19. err := c.ShouldBindJSON(&req)
  20. if err != nil {
  21. err = validate.HandleValidateErr(err)
  22. err1 := err.(e.E)
  23. e.OutErr(c, err1.Code, err1.Error())
  24. return
  25. }
  26. sysCfgDb := db.SysCfgDb{}
  27. sysCfgDb.Set()
  28. sysCfgDb.SysCfgUpdate(enum.WxMchApiV3Key, req.WxMchApiV3Key)
  29. sysCfgDb.SysCfgUpdate(enum.WxMchCertificateSerialNumber, req.WxMchCertificateSerialNumber)
  30. sysCfgDb.SysCfgUpdate(enum.WxMchId, req.WxMchId)
  31. sysCfgDb.SysCfgUpdate(enum.WxOfficialAccountAppId, req.WxOfficialAccountAppId)
  32. sysCfgDb.SysCfgUpdate(enum.WxOfficialAccountAppSecret, req.WxOfficialAccountAppSecret)
  33. //res := sysCfgDb.SysCfgFindWithDb(enum.WxMchApiV3Key, enum.WxMchCertificateSerialNumber, enum.WxMchId, enum.WxOfficialAccountAppId, enum.WxOfficialAccountAppSecret)
  34. e.OutSuc(c, nil, nil)
  35. return
  36. }