|
- package hdl
-
- import (
- "applet/app/db"
- "applet/app/e"
- "applet/app/enum"
- "applet/app/lib/validate"
- "applet/app/md"
- "github.com/gin-gonic/gin"
- )
-
- func GetSysCfg(c *gin.Context) {
- sysCfgDb := db.SysCfgDb{}
- sysCfgDb.Set()
- res := sysCfgDb.SysCfgFindWithDb(enum.WxMchApiV3Key, enum.WxMchCertificateSerialNumber, enum.WxMchId, enum.WxOfficialAccountAppId, enum.WxOfficialAccountAppSecret)
- e.OutSuc(c, res, nil)
- return
- }
-
- func SetSysCfg(c *gin.Context) {
- var req md.SetSysCfgReq
- err := c.ShouldBindJSON(&req)
- if err != nil {
- err = validate.HandleValidateErr(err)
- err1 := err.(e.E)
- e.OutErr(c, err1.Code, err1.Error())
- return
- }
- sysCfgDb := db.SysCfgDb{}
- sysCfgDb.Set()
- sysCfgDb.SysCfgUpdate(enum.WxMchApiV3Key, req.WxMchApiV3Key)
- sysCfgDb.SysCfgUpdate(enum.WxMchCertificateSerialNumber, req.WxMchCertificateSerialNumber)
- sysCfgDb.SysCfgUpdate(enum.WxMchId, req.WxMchId)
- sysCfgDb.SysCfgUpdate(enum.WxOfficialAccountAppId, req.WxOfficialAccountAppId)
- sysCfgDb.SysCfgUpdate(enum.WxOfficialAccountAppSecret, req.WxOfficialAccountAppSecret)
- //res := sysCfgDb.SysCfgFindWithDb(enum.WxMchApiV3Key, enum.WxMchCertificateSerialNumber, enum.WxMchId, enum.WxOfficialAccountAppId, enum.WxOfficialAccountAppSecret)
- e.OutSuc(c, nil, nil)
- return
- }
|