()
| 44 | } |
| 45 | |
| 46 | func (m *Wechat) Insert() (err error) { |
| 47 | o := orm.NewOrm() |
| 48 | exist := &Wechat{} |
| 49 | o.QueryTable(m).Filter("openid", m.Openid).One(exist) |
| 50 | if exist.Id > 0 { |
| 51 | exist.SessKey = m.SessKey |
| 52 | _, err = o.Update(exist) |
| 53 | } else { |
| 54 | _, err = o.Insert(m) |
| 55 | } |
| 56 | return |
| 57 | } |
| 58 | |
| 59 | //绑定用户 |
| 60 | func (m *Wechat) Bind(openid, memberId interface{}) (err error) { |