智盟项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

db_user_follow_wx_official_account.go 709 B

1 year ago
123456789101112131415161718192021222324252627
  1. package db
  2. import (
  3. "applet/app/db/model"
  4. "applet/app/utils/logx"
  5. "xorm.io/xorm"
  6. )
  7. type UserFollowWxOfficialAccountDb struct {
  8. Db *xorm.Engine `json:"db"`
  9. }
  10. func (userFollowWxOfficialAccountDb *UserFollowWxOfficialAccountDb) Set() { // set方法
  11. userFollowWxOfficialAccountDb.Db = Db
  12. }
  13. func (userFollowWxOfficialAccountDb *UserFollowWxOfficialAccountDb) GetUserFollowWxOfficialAccountByOpenId(openId string) (m *model.UserFollowWxOfficialAccount, err error) {
  14. m = new(model.UserFollowWxOfficialAccount)
  15. has, err := userFollowWxOfficialAccountDb.Db.Where("user_wx_open_id =?", openId).Get(m)
  16. if err != nil {
  17. return nil, logx.Error(err)
  18. }
  19. if has == false {
  20. return nil, nil
  21. }
  22. return m, nil
  23. }