@@ -1,8 +1,11 @@ | |||||
package dao | package dao | ||||
import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||||
import ( | |||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||||
"xorm.io/xorm" | |||||
) | |||||
type EggEnergyAvailableEnergyFlowDao interface { | type EggEnergyAvailableEnergyFlowDao interface { | ||||
//TODO:: You can add specific method definitions here | |||||
EggEnergyAvailableEnergyFlowFindAndCount(kind, page, pageSize int, startAt, endAt string) ([]*model.EggEnergyAvailableEnergyFlow, int64, error) | EggEnergyAvailableEnergyFlowFindAndCount(kind, page, pageSize int, startAt, endAt string) ([]*model.EggEnergyAvailableEnergyFlow, int64, error) | ||||
EggEnergyAvailableEnergyFlowInsertBySession(session *xorm.Session, eggEnergyAvailableEnergyFlow *model.EggEnergyAvailableEnergyFlow) (int64, error) | |||||
} | } |
@@ -1,9 +1,12 @@ | |||||
package dao | package dao | ||||
import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||||
import ( | |||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||||
"xorm.io/xorm" | |||||
) | |||||
type EggEnergyCommunityDividendsDao interface { | type EggEnergyCommunityDividendsDao interface { | ||||
//TODO:: You can add specific method definitions here | |||||
EggEnergyCommunityDividendsFindAndCount(page, limit int, startAt, endAt string, startNums, endNums int64) ([]*model.EggEnergyCommunityDividends, int64, error) | EggEnergyCommunityDividendsFindAndCount(page, limit int, startAt, endAt string, startNums, endNums int64) ([]*model.EggEnergyCommunityDividends, int64, error) | ||||
EggEnergyCommunityDividendsInsert(EggEnergyCommunityDividends *model.EggEnergyCommunityDividends) (int, error) | EggEnergyCommunityDividendsInsert(EggEnergyCommunityDividends *model.EggEnergyCommunityDividends) (int, error) | ||||
EggEnergyCommunityDividendsInsertBySession(session *xorm.Session, eggEnergyCommunityDividends *model.EggEnergyCommunityDividends) (int, error) | |||||
} | } |
@@ -1,7 +1,11 @@ | |||||
package dao | package dao | ||||
import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||||
import ( | |||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||||
"xorm.io/xorm" | |||||
) | |||||
type EggEnergyCoreDataDao interface { | type EggEnergyCoreDataDao interface { | ||||
EggEnergyCoreDataGet() (*model.EggEnergyCoreData, error) | EggEnergyCoreDataGet() (*model.EggEnergyCoreData, error) | ||||
EggEnergyCoreDataUpdateBySession(session *xorm.Session, id interface{}, eggEnergyCoreData *model.EggEnergyCoreData, forceColums ...string) (int64, error) | |||||
} | } |
@@ -15,6 +15,14 @@ type EggEnergyAvailableEnergyFlowDb struct { | |||||
Db *xorm.Engine | Db *xorm.Engine | ||||
} | } | ||||
func (e EggEnergyAvailableEnergyFlowDb) EggEnergyAvailableEnergyFlowInsertBySession(session *xorm.Session, eggEnergyAvailableEnergyFlow *model.EggEnergyAvailableEnergyFlow) (int64, error) { | |||||
_, err := session.InsertOne(eggEnergyAvailableEnergyFlow) | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
return eggEnergyAvailableEnergyFlow.Id, nil | |||||
} | |||||
func (e EggEnergyAvailableEnergyFlowDb) EggEnergyAvailableEnergyFlowFindAndCount(kind, page, pageSize int, startAt, endAt string) ([]*model.EggEnergyAvailableEnergyFlow, int64, error) { | func (e EggEnergyAvailableEnergyFlowDb) EggEnergyAvailableEnergyFlowFindAndCount(kind, page, pageSize int, startAt, endAt string) ([]*model.EggEnergyAvailableEnergyFlow, int64, error) { | ||||
var m []*model.EggEnergyAvailableEnergyFlow | var m []*model.EggEnergyAvailableEnergyFlow | ||||
session := e.Db.Where("") | session := e.Db.Where("") | ||||
@@ -15,6 +15,14 @@ type EggEnergyCommunityDividendsDb struct { | |||||
Db *xorm.Engine | Db *xorm.Engine | ||||
} | } | ||||
func (e EggEnergyCommunityDividendsDb) EggEnergyCommunityDividendsInsertBySession(session *xorm.Session, eggEnergyCommunityDividends *model.EggEnergyCommunityDividends) (int, error) { | |||||
_, err := session.InsertOne(eggEnergyCommunityDividends) | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
return eggEnergyCommunityDividends.Id, nil | |||||
} | |||||
func (e EggEnergyCommunityDividendsDb) EggEnergyCommunityDividendsFindAndCount(page, limit int, startAt, endAt string, startNums, endNums int64) ([]*model.EggEnergyCommunityDividends, int64, error) { | func (e EggEnergyCommunityDividendsDb) EggEnergyCommunityDividendsFindAndCount(page, limit int, startAt, endAt string, startNums, endNums int64) ([]*model.EggEnergyCommunityDividends, int64, error) { | ||||
var m []*model.EggEnergyCommunityDividends | var m []*model.EggEnergyCommunityDividends | ||||
session := e.Db.Where("") | session := e.Db.Where("") | ||||
@@ -15,6 +15,22 @@ type EggEnergyCoreDataDb struct { | |||||
Db *xorm.Engine | Db *xorm.Engine | ||||
} | } | ||||
func (e EggEnergyCoreDataDb) EggEnergyCoreDataUpdateBySession(session *xorm.Session, id interface{}, eggEnergyCoreData *model.EggEnergyCoreData, forceColums ...string) (int64, error) { | |||||
var ( | |||||
affected int64 | |||||
err error | |||||
) | |||||
if forceColums != nil { | |||||
affected, err = session.Where("id=?", id).Cols(forceColums...).Update(eggEnergyCoreData) | |||||
} else { | |||||
affected, err = session.Where("id=?", id).Update(eggEnergyCoreData) | |||||
} | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
return affected, nil | |||||
} | |||||
func (e EggEnergyCoreDataDb) EggEnergyCoreDataGet() (*model.EggEnergyCoreData, error) { | func (e EggEnergyCoreDataDb) EggEnergyCoreDataGet() (*model.EggEnergyCoreData, error) { | ||||
var m model.EggEnergyCoreData | var m model.EggEnergyCoreData | ||||
if has, err := e.Db.Where("id >= 1").Get(&m); err != nil || has == false { | if has, err := e.Db.Where("id >= 1").Get(&m); err != nil || has == false { | ||||
@@ -2,7 +2,8 @@ package model | |||||
type EggEnergyCommunityDividends struct { | type EggEnergyCommunityDividends struct { | ||||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | ||||
Nums int `json:"nums" xorm:"not null default 0 comment('分红数量') INT(11)"` | |||||
Nums string `json:"nums" xorm:"not null default 0 comment('分红数量') INT(11)"` | |||||
Amount string `json:"amount" xorm:"not null default 0 comment('分红金额') INT(11)"` | |||||
Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"` | Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"` | ||||
CoinId int `json:"coin_id" xorm:"not null default 0 comment('虚拟币id') INT(11)"` | CoinId int `json:"coin_id" xorm:"not null default 0 comment('虚拟币id') INT(11)"` | ||||
PersonsNum int `json:"persons_num" xorm:"not null default 0 comment('分红人数') INT(11)"` | PersonsNum int `json:"persons_num" xorm:"not null default 0 comment('分红人数') INT(11)"` | ||||
@@ -6,8 +6,8 @@ import ( | |||||
type UserRelate struct { | type UserRelate struct { | ||||
Id int64 `json:"id" xorm:"pk autoincr comment('主键') BIGINT(10)"` | Id int64 `json:"id" xorm:"pk autoincr comment('主键') BIGINT(10)"` | ||||
ParentUid int `json:"parent_uid" xorm:"not null default 0 comment('上级会员ID') unique(idx_union_u_p_id) INT(20)"` | |||||
Uid int `json:"uid" xorm:"not null default 0 comment('关联UserID') unique(idx_union_u_p_id) INT(20)"` | |||||
ParentUid int64 `json:"parent_uid" xorm:"not null default 0 comment('上级会员ID') unique(idx_union_u_p_id) INT(20)"` | |||||
Uid int64 `json:"uid" xorm:"not null default 0 comment('关联UserID') unique(idx_union_u_p_id) INT(20)"` | |||||
Level int `json:"level" xorm:"not null default 1 comment('推广等级(1直属,大于1非直属)') INT(10)"` | Level int `json:"level" xorm:"not null default 1 comment('推广等级(1直属,大于1非直属)') INT(10)"` | ||||
InviteTime time.Time `json:"invite_time" xorm:"default 'CURRENT_TIMESTAMP' comment('邀请时间') TIMESTAMP"` | InviteTime time.Time `json:"invite_time" xorm:"default 'CURRENT_TIMESTAMP' comment('邀请时间') TIMESTAMP"` | ||||
} | } |