| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 | 
							- package shanghu
 
- import (
 
- 	orm "duoduo/database"
 
- 	"time"
 
- )
 
- type ClientActiveDrawNum struct {
 
- 	ID                  int       `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"`
 
- 	ActiveConfigID      int64     `gorm:"column:active_config_id;type:bigint(20)" json:"active_config_id"`
 
- 	ClientOpenID        string    `gorm:"column:client_open_id;type:varchar(255)" json:"client_open_id"`                 
 
- 	ClientOpenIDInvited string    `gorm:"column:client_open_id_invited;type:varchar(255)" json:"client_open_id_invited"` 
 
- 	CreateBy            int64     `gorm:"column:create_by;type:bigint(20)" json:"create_by"`                             
 
- 	UpdateBy            int64     `gorm:"column:update_by;type:bigint(20)" json:"update_by"`                             
 
- 	CreatedAt           time.Time `gorm:"column:created_at;type:datetime(3)" json:"created_at"`                          
 
- 	UpdatedAt           time.Time `gorm:"column:updated_at;type:datetime(3)" json:"updated_at"`                          
 
- 	DeletedAt           time.Time `gorm:"column:deleted_at;type:datetime(3);default:null" json:"deleted_at"`             
 
- }
 
- func (m *ClientActiveDrawNum) TableName() string {
 
- 	return "client_active_draw_num"
 
- }
 
- func (m *ClientActiveDrawNum) GetDrawNum() (int, error) {
 
- 	table := orm.ShMysql.Table(m.TableName())
 
- 	table = table.Where("client_open_id = ? and active_config_id = ? ", m.ClientOpenID, m.ActiveConfigID)
 
- 	var count int
 
- 	table.Count(&count)
 
- 	return count, nil
 
- }
 
- func (u *ClientActiveDrawNum) Create() (ClientActiveDrawNum, error) {
 
- 	var doc ClientActiveDrawNum
 
- 	var err error
 
- 	doc = *u
 
- 	err = orm.ShMysql.Table(u.TableName()).Create(&doc).Error
 
- 	if err != nil {
 
- 		return doc, err
 
- 	}
 
- 	return doc, nil
 
- }
 
- func (m *ClientActiveDrawNum) GetClientDrawNum() (int, error) {
 
- 	table := orm.ShMysql.Table(m.TableName())
 
- 	table = table.Where("client_open_id = ? and active_config_id = ? and client_open_id_invited = ? ", m.ClientOpenID, m.ActiveConfigID, m.ClientOpenIDInvited)
 
- 	var count int
 
- 	table.Count(&count)
 
- 	return count, nil
 
- }
 
- func (m *ClientActiveDrawNum) GetClientDrawByOpenID() (int, error) {
 
- 	table := orm.ShMysql.Table(m.TableName())
 
- 	table = table.Where("client_open_id = ? and active_config_id = ?  ", m.ClientOpenID, m.ActiveConfigID)
 
- 	var count int
 
- 	table.Count(&count)
 
- 	return count, nil
 
- }
 
 
  |