package models

import (
	"rdluck_tools/orm"
	"time"
)

type WxUserCode struct {
	Id             int `orm:"column(id);pk"`
	WxCode         string
	UserId         int
	Code           int
	FirstLogin     int
	Authorization  string
	UserPermission int
	CreateTime     time.Time
}

//添加联系人日志信息
func AddWxUserCode(item *WxUserCode) (lastId int64, err error) {
	o := orm.NewOrm()
	lastId, err = o.Insert(item)
	return
}

func GetWxUserCode(wxCode string)(item *WxUserCode,err error)  {
	o := orm.NewOrm()
	sql:=`SELECT * FROM wx_user_code WHERE wx_code=? `
	err=o.Raw(sql,wxCode).QueryRow(&item)
	return
}