|
|
@@ -3,6 +3,7 @@ package implement |
|
|
|
import ( |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" |
|
|
|
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
@@ -17,7 +18,29 @@ type EggEnergyCommunityDividendsWithUserDb struct { |
|
|
|
func (e EggEnergyCommunityDividendsWithUserDb) EggEnergyCommunityDividendsWithUserInsert(EggEnergyCommunityDividendsWithUser *model.EggEnergyCommunityDividendsWithUser) (int, error) { |
|
|
|
_, err := e.Db.InsertOne(EggEnergyCommunityDividendsWithUser) |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
return 0, zhios_order_relate_logx.Error(err.Error()) |
|
|
|
} |
|
|
|
return EggEnergyCommunityDividendsWithUser.Id, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (e EggEnergyCommunityDividendsWithUserDb) EggEnergyCommunityDividendsWithUserFindAndCount(page, limit int, uid int64) ([]*model.EggEnergyCommunityDividendsWithUser, int64, error) { |
|
|
|
var m []*model.EggEnergyCommunityDividendsWithUser |
|
|
|
session := e.Db.Where("") |
|
|
|
if uid > 0 { |
|
|
|
session = session.And("uid=?", uid) |
|
|
|
} |
|
|
|
total, err := session.Limit(limit, (page-1)*limit).FindAndCount(&m) |
|
|
|
if err != nil { |
|
|
|
return nil, 0, zhios_order_relate_logx.Error(err.Error()) |
|
|
|
} |
|
|
|
return m, total, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (e EggEnergyCommunityDividendsWithUserDb) EggEnergyCommunityDividendsWithUserExist(uid int64) (bool, error) { |
|
|
|
var m model.EggEnergyCommunityDividendsWithUser |
|
|
|
has, err := e.Db.Where("uid=?", uid).Exist(&m) |
|
|
|
if err != nil { |
|
|
|
return false, zhios_order_relate_logx.Error(err.Error()) |
|
|
|
} |
|
|
|
return has, nil |
|
|
|
} |