Browse Source

update

master
shenjiachi 6 days ago
parent
commit
35024f3709
4 changed files with 37 additions and 6 deletions
  1. +4
    -3
      src/dao/egg_energy_team_assistance_dao.go
  2. +1
    -0
      src/dao/user_relate_dao.go
  3. +15
    -3
      src/implement/egg_energy_team_assistance_implement.go
  4. +17
    -0
      src/implement/user_relate_implement.go

+ 4
- 3
src/dao/egg_energy_team_assistance_dao.go View File

@@ -6,7 +6,8 @@ import (
) )


type EggEnergyTeamAssistanceDao interface { type EggEnergyTeamAssistanceDao interface {
EggStarLevelDividendsRecordsInsertBySession(session *xorm.Session, EggEnergyTeamAssistance *model.EggEnergyTeamAssistance) (int64, error)
EggStarLevelDividendsRecordsUpdateBySession(session *xorm.Session, id interface{}, EggEnergyTeamAssistance *model.EggEnergyTeamAssistance, forceColums ...string) (int64, error)
EggStarLevelDividendsRecordsGetOneByParamsBySession(session *xorm.Session, params map[string]interface{}) (*model.EggEnergyTeamAssistance, error)
EggEnergyTeamAssistanceInsertBySession(session *xorm.Session, EggEnergyTeamAssistance *model.EggEnergyTeamAssistance) (int64, error)
EggEnergyTeamAssistanceUpdateBySession(session *xorm.Session, id interface{}, EggEnergyTeamAssistance *model.EggEnergyTeamAssistance, forceColums ...string) (int64, error)
EggEnergyTeamAssistanceGetOneByParamsBySession(session *xorm.Session, params map[string]interface{}) (*model.EggEnergyTeamAssistance, error)
EggEnergyTeamAssistanceGetOneBySession(session *xorm.Session, uid int64, date string) (*model.EggEnergyTeamAssistance, error)
} }

+ 1
- 0
src/dao/user_relate_dao.go View File

@@ -16,4 +16,5 @@ type UserRelateDao interface {
UserRelateInsert(userRelate *model.UserRelate) (int64, error) UserRelateInsert(userRelate *model.UserRelate) (int64, error)
UserRelatesByPuIDAndLv(puid, lv interface{}) (*[]model.UserRelate, error) UserRelatesByPuIDAndLv(puid, lv interface{}) (*[]model.UserRelate, error)
UserRelatesByPuid(puid interface{}, limit, start int) (*[]model.UserRelate, error) UserRelatesByPuid(puid interface{}, limit, start int) (*[]model.UserRelate, error)
UserRelatesCountByParentUid(uid int64, level int) (int64, error)
} }

+ 15
- 3
src/implement/egg_energy_team_assistance_implement.go View File

@@ -16,7 +16,7 @@ type EggEnergyTeamAssistanceDb struct {
Db *xorm.Engine Db *xorm.Engine
} }


func (e EggEnergyTeamAssistanceDb) EggStarLevelDividendsRecordsInsertBySession(session *xorm.Session, EggEnergyTeamAssistance *model.EggEnergyTeamAssistance) (int64, error) {
func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceInsertBySession(session *xorm.Session, EggEnergyTeamAssistance *model.EggEnergyTeamAssistance) (int64, error) {
_, err := session.InsertOne(EggEnergyTeamAssistance) _, err := session.InsertOne(EggEnergyTeamAssistance)
if err != nil { if err != nil {
return 0, err return 0, err
@@ -24,7 +24,7 @@ func (e EggEnergyTeamAssistanceDb) EggStarLevelDividendsRecordsInsertBySession(s
return EggEnergyTeamAssistance.Id, nil return EggEnergyTeamAssistance.Id, nil
} }


func (e EggEnergyTeamAssistanceDb) EggStarLevelDividendsRecordsUpdateBySession(session *xorm.Session, id interface{}, EggEnergyTeamAssistance *model.EggEnergyTeamAssistance, forceColums ...string) (int64, error) {
func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceUpdateBySession(session *xorm.Session, id interface{}, EggEnergyTeamAssistance *model.EggEnergyTeamAssistance, forceColums ...string) (int64, error) {
var ( var (
affected int64 affected int64
err error err error
@@ -40,7 +40,7 @@ func (e EggEnergyTeamAssistanceDb) EggStarLevelDividendsRecordsUpdateBySession(s
return affected, nil return affected, nil
} }


func (e EggEnergyTeamAssistanceDb) EggStarLevelDividendsRecordsGetOneByParamsBySession(session *xorm.Session, params map[string]interface{}) (*model.EggEnergyTeamAssistance, error) {
func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceGetOneByParamsBySession(session *xorm.Session, params map[string]interface{}) (*model.EggEnergyTeamAssistance, error) {
var m model.EggEnergyTeamAssistance var m model.EggEnergyTeamAssistance
var query = fmt.Sprintf("%s =?", params["key"]) var query = fmt.Sprintf("%s =?", params["key"])
has, err := session.Where(query, params["value"]).Get(&m) has, err := session.Where(query, params["value"]).Get(&m)
@@ -52,3 +52,15 @@ func (e EggEnergyTeamAssistanceDb) EggStarLevelDividendsRecordsGetOneByParamsByS
} }
return &m, nil return &m, nil
} }

func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceGetOneBySession(session *xorm.Session, uid int64, date string) (*model.EggEnergyTeamAssistance, error) {
var m model.EggEnergyTeamAssistance
has, err := session.Where("uid = ?", uid).And("date = ?", date).Get(&m)
if err != nil {
return nil, err
}
if has == false {
return nil, nil
}
return &m, nil
}

+ 17
- 0
src/implement/user_relate_implement.go View File

@@ -138,3 +138,20 @@ func (u UserRelateDb) UpdateUserRelateBySession(session *xorm.Session, uid int64
} }
return affected, nil return affected, nil
} }

func (u UserRelateDb) UserRelatesCountByParentUid(uid int64, level int) (int64, error) {
var userRelate []model.UserRelate
var total int64
var err error
sess := u.Db.Where("parent_uid = ?", uid)
if level > 0 {
sess.And("level<=?", level)
}
if total, err = sess.Asc("level").Count(&userRelate); err != nil {
return 0, zhios_order_relate_logx.Error(err)
}
if len(userRelate) == 0 {
return 0, nil
}
return total, nil
}

Loading…
Cancel
Save