wechat.go 651B

123456789101112131415161718192021222324252627282930313233
  1. package wechat
  2. import (
  3. "wechat-conf/models"
  4. "wechat-conf/models/model"
  5. "wechat-conf/models/wechat"
  6. "wechat-conf/utils"
  7. )
  8. // WechatServ 用户
  9. type WechatServ struct {
  10. ctx *utils.Context
  11. dao *wechat.WechatDAO
  12. }
  13. // NewWechatServ 初始化
  14. func NewWechatServ(ctx *utils.Context) *WechatServ {
  15. return &WechatServ{
  16. ctx: ctx,
  17. dao: wechat.NewWechatDAO(ctx),
  18. }
  19. }
  20. // SaveWechatConf 保存微信配置
  21. func (s *WechatServ) SaveWechatConf(conf model.SysWechatConf) error {
  22. err := s.dao.SaveWechatConf(conf)
  23. return err
  24. }
  25. // UpdateToken 更新微信token
  26. func (s *WechatServ) UpdateToken(token map[string]string) {
  27. models.UpdateToken(token)
  28. }