package services import ( "errors" "fmt" "hongze/hongze_task/models/yb" ) // YbWxConf 研报小程序AppId配置 type YbWxConf struct { AppId string `description:"AppID"` MsgRedirectType int `description:"公共模板消息跳转类型: 1-研报小程序; 4-备用小程序"` } func init() { confKey := "use_copy_yb" conf, e := yb.GetConfigByCode(confKey) if e != nil { fmt.Println(e.Error()) return } fmt.Println("conf.ConfigValue", conf.ConfigValue) } // 根据研报配置获取研报小程序AppID信息 func GetYbAppIdInfo() (ybConf *YbWxConf, err error) { confKey := "use_copy_yb" conf, e := yb.GetConfigByCode(confKey) if e != nil { err = errors.New("获取研报小程序配置信息失败, Err: " + e.Error()) return } ybConf = &YbWxConf{ AppId: "wxb059c872d79b9967", MsgRedirectType: 1, } if conf.ConfigValue == "true" { ybConf.AppId = "wx9a2a9b49a00513a0" ybConf.MsgRedirectType = 4 } return }