|
123456789101112131415161718192021222324252627 |
- package db
-
- import (
- "applet/app/db/model"
- "applet/app/utils/logx"
- "xorm.io/xorm"
- )
-
- type UserFollowWxOfficialAccountDb struct {
- Db *xorm.Engine `json:"db"`
- }
-
- func (userFollowWxOfficialAccountDb *UserFollowWxOfficialAccountDb) Set() { // set方法
- userFollowWxOfficialAccountDb.Db = Db
- }
-
- func (userFollowWxOfficialAccountDb *UserFollowWxOfficialAccountDb) GetUserFollowWxOfficialAccountByOpenId(openId string) (m *model.UserFollowWxOfficialAccount, err error) {
- m = new(model.UserFollowWxOfficialAccount)
- has, err := userFollowWxOfficialAccountDb.Db.Where("user_wx_open_id =?", openId).Get(m)
- if err != nil {
- return nil, logx.Error(err)
- }
- if has == false {
- return nil, nil
- }
- return m, nil
- }
|