diff --git a/go.mod b/go.mod index de5ecbf..eed3da6 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( require ( filippo.io/edwards25519 v1.1.0 // indirect + github.com/go-xorm/xorm v0.7.9 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/jinzhu/copier v0.4.0 // indirect @@ -28,5 +29,6 @@ require ( golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.8.0 // indirect golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78 // indirect - xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978 // indirect + xorm.io/builder v0.3.13 // indirect + xorm.io/core v0.7.3 // indirect ) diff --git a/src/dao/egg_energy_basic_setting_dao.go b/src/dao/egg_energy_basic_setting_dao.go new file mode 100644 index 0000000..58b2415 --- /dev/null +++ b/src/dao/egg_energy_basic_setting_dao.go @@ -0,0 +1,11 @@ +package dao + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + "xorm.io/xorm" +) + +type EggEnergyBasicSettingDao interface { + EggEnergyBasicSettingUpdate(session *xorm.Session, id interface{}, EggEnergyBasicSetting *model.EggEnergyBasicSetting, forceColums ...string) (int64, error) + EggEnergyBasicSettingGetOneByParams(params map[string]interface{}) (*model.EggEnergyBasicSetting, error) +} diff --git a/src/dao/egg_energy_community_dividends_dao.go b/src/dao/egg_energy_community_dividends_dao.go new file mode 100644 index 0000000..d7b4eba --- /dev/null +++ b/src/dao/egg_energy_community_dividends_dao.go @@ -0,0 +1,5 @@ +package dao + +type EggEnergyCommunityDividendsDao interface { + //TODO:: You can add specific method definitions here +} diff --git a/src/dao/egg_energy_community_dividends_with_user_dao.go b/src/dao/egg_energy_community_dividends_with_user_dao.go new file mode 100644 index 0000000..6310857 --- /dev/null +++ b/src/dao/egg_energy_community_dividends_with_user_dao.go @@ -0,0 +1,5 @@ +package dao + +type EggEnergyCommunityDividendsWithUserDao interface { + //TODO:: You can add specific method definitions here +} diff --git a/src/dao/egg_energy_community_dividends_with_user_records_dao.go b/src/dao/egg_energy_community_dividends_with_user_records_dao.go new file mode 100644 index 0000000..83e6c28 --- /dev/null +++ b/src/dao/egg_energy_community_dividends_with_user_records_dao.go @@ -0,0 +1,5 @@ +package dao + +type EggEnergyCommunityDividendsWithUserRecordsDao interface { + //TODO:: You can add specific method definitions here +} diff --git a/src/dao/egg_energy_user_activity_dao.go b/src/dao/egg_energy_user_activity_dao.go new file mode 100644 index 0000000..fb91141 --- /dev/null +++ b/src/dao/egg_energy_user_activity_dao.go @@ -0,0 +1,5 @@ +package dao + +type EggEnergyUserActivityDao interface { + //TODO:: You can add specific method definitions here +} diff --git a/src/dao/egg_energy_user_watch_records_dao.go b/src/dao/egg_energy_user_watch_records_dao.go new file mode 100644 index 0000000..f8d5b47 --- /dev/null +++ b/src/dao/egg_energy_user_watch_records_dao.go @@ -0,0 +1,9 @@ +package dao + +import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + +type EggEnergyUserWatchRecordsDao interface { + EggEnergyUserWatchRecordsInsert(OneCirclesUserWatchRecords *model.EggEnergyUserWatchRecords) (int64, error) + EggEnergyUserWatchRecordsUpdate(id interface{}, OneCirclesUserWatchRecords *model.EggEnergyUserWatchRecords, forceColums ...string) (int64, error) + EggEnergyUserWatchRecordsGetOneByParams(params map[string]interface{}) (*model.EggEnergyUserWatchRecords, error) +} diff --git a/src/dao/egg_public_platoon_basic_setting_dao.go b/src/dao/egg_public_platoon_basic_setting_dao.go new file mode 100644 index 0000000..8cce486 --- /dev/null +++ b/src/dao/egg_public_platoon_basic_setting_dao.go @@ -0,0 +1,15 @@ +package dao + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" +) + +type PublicPlatoonBasicSettingDao interface { + PublicPlatoonBasicSettingInsert(PublicPlatoonBasicSetting *model.PublicPlatoonBasicSetting) (int, error) + BatchAddPublicPlatoonBasicSettings(PublicPlatoonBasicSettingData []*model.PublicPlatoonBasicSetting) (int64, error) + GetPublicPlatoonBasicSettingCount() int + PublicPlatoonBasicSettingDelete(id interface{}) (int64, error) + PublicPlatoonBasicSettingUpdate(id interface{}, PublicPlatoonBasicSetting *model.PublicPlatoonBasicSetting, forceColums ...string) (int64, error) + PublicPlatoonBasicSettingGetOneByParams(params map[string]interface{}) (*model.PublicPlatoonBasicSetting, error) + PublicPlatoonBasicSettingFindByParams(params map[string]interface{}) (*[]model.PublicPlatoonBasicSetting, error) +} diff --git a/src/dao/egg_sign_in_dao.go b/src/dao/egg_sign_in_dao.go new file mode 100644 index 0000000..380b2f4 --- /dev/null +++ b/src/dao/egg_sign_in_dao.go @@ -0,0 +1,5 @@ +package dao + +type EggSignInDao interface { + //TODO:: You can add specific method definitions here +} diff --git a/src/dao/egg_star_level_dividends_records_dao.go b/src/dao/egg_star_level_dividends_records_dao.go new file mode 100644 index 0000000..241cbe8 --- /dev/null +++ b/src/dao/egg_star_level_dividends_records_dao.go @@ -0,0 +1,12 @@ +package dao + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + "xorm.io/xorm" +) + +type EggStarLevelDividendsRecordsDao interface { + EggStarLevelDividendsRecordsInsertBySession(session *xorm.Session, EggStarLevelDividendsRecords *model.EggStarLevelDividendsRecords) (int64, error) + EggStarLevelDividendsRecordsUpdateBySession(session *xorm.Session, id interface{}, EggStarLevelDividendsRecords *model.EggStarLevelDividendsRecords, forceColums ...string) (int64, error) + EggStarLevelDividendsRecordsGetOneByParamsBySession(session *xorm.Session, params map[string]interface{}) (*model.EggStarLevelDividendsRecords, error) +} diff --git a/src/dao/public_platoon_free_punish_with_user_dao.go b/src/dao/public_platoon_free_punish_with_user_dao.go new file mode 100644 index 0000000..081f9cb --- /dev/null +++ b/src/dao/public_platoon_free_punish_with_user_dao.go @@ -0,0 +1,12 @@ +package dao + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + "xorm.io/xorm" +) + +type PublicPlatoonFreePunishWithUserDao interface { + FindAllPublicPlatoonFreePunishWithUser() (resp map[int64]*model.PublicPlatoonFreePunishWithUser, err error) + PublicPlatoonFreePunishWithUserInsert(PublicPlatoonFreePunishWithUser *model.PublicPlatoonFreePunishWithUser) (int, error) + PublicPlatoonFreePunishWithUserUpdate(Db *xorm.Engine, id interface{}, PublicPlatoonFreePunishWithUser *model.PublicPlatoonFreePunishWithUser, forceColums ...string) (int64, error) +} diff --git a/src/dao/public_platoon_records_punish_with_user_dao.go b/src/dao/public_platoon_records_punish_with_user_dao.go new file mode 100644 index 0000000..314806f --- /dev/null +++ b/src/dao/public_platoon_records_punish_with_user_dao.go @@ -0,0 +1,11 @@ +package dao + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" +) + +type PublicPlatoonRecordsPunishWithUserDao interface { + FindAllPublicPlatoonRecordsPunishWithUser() (resp map[int64]*model.PublicPlatoonRecordsPunishWithUser, err error) + PublicPlatoonRecordsPunishWithUserInsert(PublicPlatoonRecordsPunishWithUser *model.PublicPlatoonRecordsPunishWithUser) (int, error) + PublicPlatoonRecordsPunishWithUserUpdate(id interface{}, PublicPlatoonRecordsPunishWithUser *model.PublicPlatoonRecordsPunishWithUser, forceColums ...string) (int64, error) +} diff --git a/src/dao/public_platoon_user_relation_dao.go b/src/dao/public_platoon_user_relation_dao.go new file mode 100644 index 0000000..552efc1 --- /dev/null +++ b/src/dao/public_platoon_user_relation_dao.go @@ -0,0 +1,16 @@ +package dao + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + "xorm.io/xorm" +) + +type PublicPlatoonUserRelationDao interface { + PublicPlatoonUserRelationInsert(PublicPlatoonUserRelation *model.PublicPlatoonUserRelation) (int, error) + PublicPlatoonUserRelationUpdate(session *xorm.Session, id interface{}, PublicPlatoonUserRelation *model.PublicPlatoonUserRelation, forceColums ...string) (int64, error) + PublicPlatoonUserRelationGetOneByParams(params map[string]interface{}) (*model.PublicPlatoonUserRelation, error) + PublicPlatoonUserRelationGetOneByPid(recommendUid string, params map[string]interface{}) (*model.PublicPlatoonUserRelation, error) + PublicPlatoonUserRelationFindByPid(fatherUid int64, fatherName, positionName string) ([]model.PublicPlatoonUserRelation, error) + PublicPlatoonUserRelationFindCountByPosition(fatherUid int64, fatherName, positionName string, startPosition, endPosition int64) ([]model.PublicPlatoonUserRelation, int64, error) + PublicPlatoonUserRelationFindByParamsByPage(params map[string]interface{}, page, pageSize int) (*[]model.PublicPlatoonUserRelation, error) +} diff --git a/src/dao/public_platoon_user_system_punish_records_dao.go b/src/dao/public_platoon_user_system_punish_records_dao.go new file mode 100644 index 0000000..2a74bf1 --- /dev/null +++ b/src/dao/public_platoon_user_system_punish_records_dao.go @@ -0,0 +1,12 @@ +package dao + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + "xorm.io/xorm" +) + +type PublicPlatoonUserSystemPunishRecordsDao interface { + PublicPlatoonUserSystemPunishRecordsInsert(session *xorm.Session, PublicPlatoonUserSystemPunishRecords *model.PublicPlatoonUserSystemPunishRecords) (int64, error) + PublicPlatoonUserSystemPunishRecordsGetOneByParams(params map[string]interface{}) (*model.PublicPlatoonUserSystemPunishRecords, error) + PublicPlatoonUserSystemPunishRecordsFindByParams(params map[string]interface{}) (*[]model.PublicPlatoonUserSystemPunishRecords, error) +} diff --git a/src/dao/user_dao.go b/src/dao/user_dao.go new file mode 100644 index 0000000..96d76af --- /dev/null +++ b/src/dao/user_dao.go @@ -0,0 +1,5 @@ +package dao + +type UserDao interface { + //TODO:: You can add specific method definitions here +} diff --git a/src/dao/user_level_dao.go b/src/dao/user_level_dao.go new file mode 100644 index 0000000..9e14bf6 --- /dev/null +++ b/src/dao/user_level_dao.go @@ -0,0 +1,12 @@ +package dao + +import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + +type UserLevelDao interface { + //UserLevelInIDescByWeightLowWithOne 查询获取 权重最低 对应等级 + UserLevelInIDescByWeightLowWithOne() (*model.UserLevel, error) + //UserLevelByID 根据id 获取对应的等级信息 + UserLevelByID(id interface{}) (*model.UserLevel, error) + //UserLevelAllByAsc 获取所有开启等级并且升序返回 + UserLevelAllByAsc() ([]*model.UserLevel, error) +} diff --git a/src/dao/user_relate_dao.go b/src/dao/user_relate_dao.go new file mode 100644 index 0000000..ebb839e --- /dev/null +++ b/src/dao/user_relate_dao.go @@ -0,0 +1,10 @@ +package dao + +import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + +type UserRelateDao interface { + FindUserRelate(uid int64, level int) (*[]model.UserRelate, error) + GetUserParentUserRelate(uid int64) (*model.UserRelate, error) + FindUserRelateByParentUid(uid int64, level int) (*[]model.UserRelate, error) + SumUserRelateByParentUid(parentUid string) (total int64, userRelate []*model.UserRelate, err error) +} diff --git a/src/dao/user_wallet_dao.go b/src/dao/user_wallet_dao.go new file mode 100644 index 0000000..311834e --- /dev/null +++ b/src/dao/user_wallet_dao.go @@ -0,0 +1,5 @@ +package dao + +type UserWalletDao interface { + //TODO:: You can add specific method definitions here +} diff --git a/src/implement/egg_energy_basic_setting_implement.go b/src/implement/egg_energy_basic_setting_implement.go new file mode 100644 index 0000000..e4217da --- /dev/null +++ b/src/implement/egg_energy_basic_setting_implement.go @@ -0,0 +1,42 @@ +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" + "fmt" + "xorm.io/xorm" +) + +func NewEggEnergyBasicSettingDb(engine *xorm.Engine) dao.EggEnergyBasicSettingDao { + return &EggEnergyBasicSettingDb{Db: engine} +} + +type EggEnergyBasicSettingDb struct { + Db *xorm.Engine +} + +func (e EggEnergyBasicSettingDb) EggEnergyBasicSettingUpdate(session *xorm.Session, id interface{}, EggEnergyBasicSetting *model.EggEnergyBasicSetting, forceColums ...string) (int64, error) { + var ( + affected int64 + err error + ) + if forceColums != nil { + affected, err = session.Where("id=?", id).Cols(forceColums...).Update(EggEnergyBasicSetting) + } else { + affected, err = session.Where("id=?", id).Update(EggEnergyBasicSetting) + } + if err != nil { + return 0, err + } + return affected, nil +} + +func (e EggEnergyBasicSettingDb) EggEnergyBasicSettingGetOneByParams(params map[string]interface{}) (*model.EggEnergyBasicSetting, error) { + var m model.EggEnergyBasicSetting + var query = fmt.Sprintf("%s =?", params["key"]) + if has, err := e.Db.Where(query, params["value"]).Get(&m); err != nil || has == false { + return nil, zhios_order_relate_logx.Error(err) + } + return &m, nil +} diff --git a/src/implement/egg_energy_community_dividends_implement.go b/src/implement/egg_energy_community_dividends_implement.go new file mode 100644 index 0000000..60bf1a4 --- /dev/null +++ b/src/implement/egg_energy_community_dividends_implement.go @@ -0,0 +1,14 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "xorm.io/xorm" +) + +func NewEggEnergyCommunityDividendsDb(engine *xorm.Engine) dao.EggEnergyCommunityDividendsDao { + return &EggEnergyCommunityDividendsDb{Db: engine} +} + +type EggEnergyCommunityDividendsDb struct { + Db *xorm.Engine +} diff --git a/src/implement/egg_energy_community_dividends_with_user_implement.go b/src/implement/egg_energy_community_dividends_with_user_implement.go new file mode 100644 index 0000000..e9c5fa7 --- /dev/null +++ b/src/implement/egg_energy_community_dividends_with_user_implement.go @@ -0,0 +1,14 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "xorm.io/xorm" +) + +func NewEggEnergyCommunityDividendsWithUserDb(engine *xorm.Engine) dao.EggEnergyCommunityDividendsWithUserDao { + return &EggEnergyCommunityDividendsWithUserDb{Db: engine} +} + +type EggEnergyCommunityDividendsWithUserDb struct { + Db *xorm.Engine +} diff --git a/src/implement/egg_energy_community_dividends_with_user_records_implement.go b/src/implement/egg_energy_community_dividends_with_user_records_implement.go new file mode 100644 index 0000000..d4cce04 --- /dev/null +++ b/src/implement/egg_energy_community_dividends_with_user_records_implement.go @@ -0,0 +1,14 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "xorm.io/xorm" +) + +func NewEggEnergyCommunityDividendsWithUserRecordsDb(engine *xorm.Engine) dao.EggEnergyCommunityDividendsWithUserRecordsDao { + return &EggEnergyCommunityDividendsWithUserRecordsDb{Db: engine} +} + +type EggEnergyCommunityDividendsWithUserRecordsDb struct { + Db *xorm.Engine +} diff --git a/src/implement/egg_energy_user_activity_implement.go b/src/implement/egg_energy_user_activity_implement.go new file mode 100644 index 0000000..92dbee8 --- /dev/null +++ b/src/implement/egg_energy_user_activity_implement.go @@ -0,0 +1,14 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "xorm.io/xorm" +) + +func NewEggEnergyUserActivityDb(engine *xorm.Engine) dao.EggEnergyUserActivityDao { + return &EggEnergyUserActivityDb{Db: engine} +} + +type EggEnergyUserActivityDb struct { + Db *xorm.Engine +} diff --git a/src/implement/egg_energy_user_watch_records_implement.go b/src/implement/egg_energy_user_watch_records_implement.go new file mode 100644 index 0000000..b942310 --- /dev/null +++ b/src/implement/egg_energy_user_watch_records_implement.go @@ -0,0 +1,54 @@ +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" + "fmt" + "xorm.io/xorm" +) + +func NewEggEnergyUserWatchRecordsDb(engine *xorm.Engine) dao.EggEnergyUserWatchRecordsDao { + return &EggEnergyUserWatchRecordsDb{Db: engine} +} + +type EggEnergyUserWatchRecordsDb struct { + Db *xorm.Engine +} + +func (e EggEnergyUserWatchRecordsDb) EggEnergyUserWatchRecordsInsert(OneCirclesUserWatchRecords *model.EggEnergyUserWatchRecords) (int64, error) { + _, err := e.Db.InsertOne(OneCirclesUserWatchRecords) + if err != nil { + return 0, err + } + return OneCirclesUserWatchRecords.Id, nil +} + +func (e EggEnergyUserWatchRecordsDb) EggEnergyUserWatchRecordsUpdate(id interface{}, OneCirclesUserWatchRecords *model.EggEnergyUserWatchRecords, forceColums ...string) (int64, error) { + var ( + affected int64 + err error + ) + if forceColums != nil { + affected, err = e.Db.Where("id=?", id).Cols(forceColums...).Update(OneCirclesUserWatchRecords) + } else { + affected, err = e.Db.Where("id=?", id).Update(OneCirclesUserWatchRecords) + } + if err != nil { + return 0, err + } + return affected, nil +} + +func (e EggEnergyUserWatchRecordsDb) EggEnergyUserWatchRecordsGetOneByParams(params map[string]interface{}) (*model.EggEnergyUserWatchRecords, error) { + var m model.EggEnergyUserWatchRecords + var query = fmt.Sprintf("%s =?", params["key"]) + has, err := e.Db.Where(query, params["value"]).Get(&m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if !has { + return nil, nil + } + return &m, nil +} diff --git a/src/implement/egg_sign_in_implement.go b/src/implement/egg_sign_in_implement.go new file mode 100644 index 0000000..04c7c11 --- /dev/null +++ b/src/implement/egg_sign_in_implement.go @@ -0,0 +1,14 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "xorm.io/xorm" +) + +func NewEggSignInDb(engine *xorm.Engine) dao.EggSignInDao { + return &EggSignInDb{Db: engine} +} + +type EggSignInDb struct { + Db *xorm.Engine +} diff --git a/src/implement/egg_star_level_dividends_records_implement.go b/src/implement/egg_star_level_dividends_records_implement.go new file mode 100644 index 0000000..309a169 --- /dev/null +++ b/src/implement/egg_star_level_dividends_records_implement.go @@ -0,0 +1,54 @@ +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" + "fmt" + "xorm.io/xorm" +) + +func NewEggStarLevelDividendsRecordsDb(engine *xorm.Engine) dao.EggStarLevelDividendsRecordsDao { + return &EggStarLevelDividendsRecordsDb{Db: engine} +} + +type EggStarLevelDividendsRecordsDb struct { + Db *xorm.Engine +} + +func (e EggStarLevelDividendsRecordsDb) EggStarLevelDividendsRecordsInsertBySession(session *xorm.Session, EggStarLevelDividendsRecords *model.EggStarLevelDividendsRecords) (int64, error) { + _, err := session.InsertOne(EggStarLevelDividendsRecords) + if err != nil { + return 0, err + } + return EggStarLevelDividendsRecords.Id, nil +} + +func (e EggStarLevelDividendsRecordsDb) EggStarLevelDividendsRecordsUpdateBySession(session *xorm.Session, id interface{}, EggStarLevelDividendsRecords *model.EggStarLevelDividendsRecords, forceColums ...string) (int64, error) { + var ( + affected int64 + err error + ) + if forceColums != nil { + affected, err = session.Where("id=?", id).Cols(forceColums...).Update(EggStarLevelDividendsRecords) + } else { + affected, err = session.Where("id=?", id).Update(EggStarLevelDividendsRecords) + } + if err != nil { + return 0, err + } + return affected, nil +} + +func (e EggStarLevelDividendsRecordsDb) EggStarLevelDividendsRecordsGetOneByParamsBySession(session *xorm.Session, params map[string]interface{}) (*model.EggStarLevelDividendsRecords, error) { + var m model.EggStarLevelDividendsRecords + var query = fmt.Sprintf("%s =?", params["key"]) + has, err := session.Where(query, params["value"]).Get(&m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return &m, nil +} diff --git a/src/implement/public_platoon_basic_setting_implement.go b/src/implement/public_platoon_basic_setting_implement.go new file mode 100644 index 0000000..7723cb4 --- /dev/null +++ b/src/implement/public_platoon_basic_setting_implement.go @@ -0,0 +1,109 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + zhios_order_relate_utils "code.fnuoos.com/EggPlanet/egg_models.git/utils" + zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" + "errors" + "fmt" + "reflect" + "xorm.io/xorm" +) + +func NewPublicPlatoonBasicSettingDb(engine *xorm.Engine) dao.PublicPlatoonBasicSettingDao { + return &PublicPlatoonBasicSettingDb{Db: engine} +} + +type PublicPlatoonBasicSettingDb struct { + Db *xorm.Engine +} + +func (p PublicPlatoonBasicSettingDb) PublicPlatoonBasicSettingInsert(PublicPlatoonBasicSetting *model.PublicPlatoonBasicSetting) (int, error) { + _, err := p.Db.InsertOne(PublicPlatoonBasicSetting) + if err != nil { + return 0, err + } + return PublicPlatoonBasicSetting.Id, nil +} + +func (p PublicPlatoonBasicSettingDb) BatchAddPublicPlatoonBasicSettings(PublicPlatoonBasicSettingData []*model.PublicPlatoonBasicSetting) (int64, error) { + affected, err := p.Db.Insert(PublicPlatoonBasicSettingData) + if err != nil { + return 0, err + } + return affected, nil +} + +func (p PublicPlatoonBasicSettingDb) GetPublicPlatoonBasicSettingCount() int { + var PublicPlatoonBasicSetting model.PublicPlatoonBasicSetting + session := p.Db.Where("") + count, err := session.Count(&PublicPlatoonBasicSetting) + if err != nil { + return 0 + } + return int(count) +} + +func (p PublicPlatoonBasicSettingDb) PublicPlatoonBasicSettingDelete(id interface{}) (int64, error) { + if reflect.TypeOf(id).Kind() == reflect.Slice { + return p.Db.In("id", id).Delete(model.PublicPlatoonBasicSetting{}) + } else { + return p.Db.Where("id = ?", id).Delete(model.PublicPlatoonBasicSetting{}) + } +} + +func (p PublicPlatoonBasicSettingDb) PublicPlatoonBasicSettingUpdate(id interface{}, PublicPlatoonBasicSetting *model.PublicPlatoonBasicSetting, forceColums ...string) (int64, error) { + var ( + affected int64 + err error + ) + if forceColums != nil { + affected, err = p.Db.Where("id=?", id).Cols(forceColums...).Update(PublicPlatoonBasicSetting) + } else { + affected, err = p.Db.Where("id=?", id).Update(PublicPlatoonBasicSetting) + } + if err != nil { + return 0, err + } + return affected, nil +} + +func (p PublicPlatoonBasicSettingDb) PublicPlatoonBasicSettingGetOneByParams(params map[string]interface{}) (*model.PublicPlatoonBasicSetting, error) { + var m model.PublicPlatoonBasicSetting + var query = fmt.Sprintf("%s =?", params["key"]) + if has, err := p.Db.Where(query, params["value"]).Get(&m); err != nil || has == false { + return nil, zhios_order_relate_logx.Error(err) + } + return &m, nil +} + +func (p PublicPlatoonBasicSettingDb) PublicPlatoonBasicSettingFindByParams(params map[string]interface{}) (*[]model.PublicPlatoonBasicSetting, error) { + var m []model.PublicPlatoonBasicSetting + if params["value"] == nil { + return nil, errors.New("参数有误") + } + if params["key"] == nil { + //查询全部数据 + err := p.Db.Find(&m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + return &m, nil + } else { + if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { + //指定In查询 + if err := p.Db.In(zhios_order_relate_utils.AnyToString(params["key"]), params["value"]).Find(&m); err != nil { + return nil, zhios_order_relate_logx.Warn(err) + } + return &m, nil + } else { + var query = fmt.Sprintf("%s =?", params["key"]) + err := p.Db.Where(query, params["value"]).Find(&m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + return &m, nil + } + } +} diff --git a/src/implement/public_platoon_free_punish_with_user_implement.go b/src/implement/public_platoon_free_punish_with_user_implement.go new file mode 100644 index 0000000..51ba211 --- /dev/null +++ b/src/implement/public_platoon_free_punish_with_user_implement.go @@ -0,0 +1,53 @@ +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" +) + +func NewPublicPlatoonFreePunishWithUserDb(engine *xorm.Engine) dao.PublicPlatoonFreePunishWithUserDao { + return &PublicPlatoonFreePunishWithUserDb{Db: engine} +} + +type PublicPlatoonFreePunishWithUserDb struct { + Db *xorm.Engine +} + +func (p PublicPlatoonFreePunishWithUserDb) FindAllPublicPlatoonFreePunishWithUser() (resp map[int64]*model.PublicPlatoonFreePunishWithUser, err error) { + var m []model.PublicPlatoonFreePunishWithUser + err = p.Db.Where("1=1").Find(&m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + resp = map[int64]*model.PublicPlatoonFreePunishWithUser{} + for _, v := range m { + resp[v.Uid] = &v + } + return +} + +func (p PublicPlatoonFreePunishWithUserDb) PublicPlatoonFreePunishWithUserInsert(PublicPlatoonFreePunishWithUser *model.PublicPlatoonFreePunishWithUser) (int, error) { + _, err := p.Db.InsertOne(PublicPlatoonFreePunishWithUser) + if err != nil { + return 0, err + } + return PublicPlatoonFreePunishWithUser.Id, nil +} + +func (p PublicPlatoonFreePunishWithUserDb) PublicPlatoonFreePunishWithUserUpdate(Db *xorm.Engine, id interface{}, PublicPlatoonFreePunishWithUser *model.PublicPlatoonFreePunishWithUser, forceColums ...string) (int64, error) { + var ( + affected int64 + err error + ) + if forceColums != nil { + affected, err = Db.Where("id=?", id).Cols(forceColums...).Update(PublicPlatoonFreePunishWithUser) + } else { + affected, err = Db.Where("id=?", id).Update(PublicPlatoonFreePunishWithUser) + } + if err != nil { + return 0, err + } + return affected, nil +} diff --git a/src/implement/public_platoon_records_punish_with_user_implement.go b/src/implement/public_platoon_records_punish_with_user_implement.go new file mode 100644 index 0000000..55ab674 --- /dev/null +++ b/src/implement/public_platoon_records_punish_with_user_implement.go @@ -0,0 +1,53 @@ +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" +) + +func NewPublicPlatoonRecordsPunishWithUserDb(engine *xorm.Engine) dao.PublicPlatoonRecordsPunishWithUserDao { + return &PublicPlatoonRecordsPunishWithUserDb{Db: engine} +} + +type PublicPlatoonRecordsPunishWithUserDb struct { + Db *xorm.Engine +} + +func (p PublicPlatoonRecordsPunishWithUserDb) FindAllPublicPlatoonRecordsPunishWithUser() (resp map[int64]*model.PublicPlatoonRecordsPunishWithUser, err error) { + var m []model.PublicPlatoonRecordsPunishWithUser + err = p.Db.Where("1=1").Find(&m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + resp = map[int64]*model.PublicPlatoonRecordsPunishWithUser{} + for _, v := range m { + resp[v.Uid] = &v + } + return +} + +func (p PublicPlatoonRecordsPunishWithUserDb) PublicPlatoonRecordsPunishWithUserInsert(PublicPlatoonRecordsPunishWithUser *model.PublicPlatoonRecordsPunishWithUser) (int, error) { + _, err := p.Db.InsertOne(PublicPlatoonRecordsPunishWithUser) + if err != nil { + return 0, err + } + return PublicPlatoonRecordsPunishWithUser.Id, nil +} + +func (p PublicPlatoonRecordsPunishWithUserDb) PublicPlatoonRecordsPunishWithUserUpdate(id interface{}, PublicPlatoonRecordsPunishWithUser *model.PublicPlatoonRecordsPunishWithUser, forceColums ...string) (int64, error) { + var ( + affected int64 + err error + ) + if forceColums != nil { + affected, err = p.Db.Where("id=?", id).Cols(forceColums...).Update(PublicPlatoonRecordsPunishWithUser) + } else { + affected, err = p.Db.Where("id=?", id).Update(PublicPlatoonRecordsPunishWithUser) + } + if err != nil { + return 0, err + } + return affected, nil +} diff --git a/src/implement/public_platoon_user_relation_implement.go b/src/implement/public_platoon_user_relation_implement.go new file mode 100644 index 0000000..1eb44fe --- /dev/null +++ b/src/implement/public_platoon_user_relation_implement.go @@ -0,0 +1,121 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + zhios_order_relate_utils "code.fnuoos.com/EggPlanet/egg_models.git/utils" + zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" + "errors" + "fmt" + "reflect" + "xorm.io/xorm" +) + +func NewPublicPlatoonUserRelationDb(engine *xorm.Engine) dao.PublicPlatoonUserRelationDao { + return &PublicPlatoonUserRelationDb{Db: engine} +} + +type PublicPlatoonUserRelationDb struct { + Db *xorm.Engine +} + +func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationInsert(PublicPlatoonUserRelation *model.PublicPlatoonUserRelation) (int, error) { + _, err := p.Db.InsertOne(PublicPlatoonUserRelation) + if err != nil { + return 0, err + } + return PublicPlatoonUserRelation.Id, nil +} + +func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationUpdate(session *xorm.Session, id interface{}, PublicPlatoonUserRelation *model.PublicPlatoonUserRelation, forceColums ...string) (int64, error) { + var ( + affected int64 + err error + ) + if forceColums != nil { + affected, err = session.Where("id=?", id).Cols(forceColums...).Update(PublicPlatoonUserRelation) + } else { + affected, err = session.Where("id=?", id).Update(PublicPlatoonUserRelation) + } + if err != nil { + return 0, err + } + return affected, nil +} + +func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationGetOneByParams(params map[string]interface{}) (*model.PublicPlatoonUserRelation, error) { + var m model.PublicPlatoonUserRelation + var query = fmt.Sprintf("%s =?", params["key"]) + if has, err := p.Db.Where(query, params["value"]).Get(&m); err != nil || has == false { + return nil, zhios_order_relate_logx.Error(err) + } + return &m, nil +} + +func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationGetOneByPid(recommendUid string, params map[string]interface{}) (*model.PublicPlatoonUserRelation, error) { + var m model.PublicPlatoonUserRelation + var query = fmt.Sprintf("%s <=?", params["key"]) + if has, err := p.Db.Where("recommend_uid = ?", recommendUid).And(query, params["value"]).OrderBy("id ASC").Get(&m); err != nil || has == false { + return nil, zhios_order_relate_logx.Error(err) + } + return &m, nil +} + +func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationFindByPid(fatherUid int64, fatherName, positionName string) ([]model.PublicPlatoonUserRelation, error) { + var m []model.PublicPlatoonUserRelation + var query2 = fmt.Sprintf("%s = ?", fatherName) + var order = fmt.Sprintf("%s Desc", positionName) + if err := p.Db.Where(query2, fatherUid).OrderBy(order). + Find(&m); err != nil { + return nil, zhios_order_relate_logx.Warn(err) + } + return m, nil +} + +func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationFindCountByPosition(fatherUid int64, fatherName, positionName string, startPosition, endPosition int64) ([]model.PublicPlatoonUserRelation, int64, error) { + var m []model.PublicPlatoonUserRelation + var count int64 + var query1 = fmt.Sprintf("%s >= ?", positionName) + var query2 = fmt.Sprintf("%s <= ?", positionName) + var query3 = fmt.Sprintf("%s = ?", fatherName) + if count, err := p.Db.Where(query3, fatherUid).And(query1, startPosition).And(query2, endPosition).OrderBy("has_son_num ASC"). + FindAndCount(&m); err != nil { + return nil, count, zhios_order_relate_logx.Warn(err) + } + return m, count, nil +} + +func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationFindByParamsByPage(params map[string]interface{}, page, pageSize int) (*[]model.PublicPlatoonUserRelation, error) { + var m []model.PublicPlatoonUserRelation + if params["value"] == nil { + return nil, errors.New("参数有误") + } + if page == 0 && pageSize == 0 { + page = 1 + pageSize = 10 + } + + if params["key"] == nil { + //查询全部数据 + err := p.Db.Limit(pageSize, (page-1)*pageSize).Find(&m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + return &m, nil + } else { + if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { + //指定In查询 + if err := p.Db.In(zhios_order_relate_utils.AnyToString(params["key"]), params["value"]).Limit(pageSize, (page-1)*pageSize).Find(&m); err != nil { + return nil, zhios_order_relate_logx.Warn(err) + } + return &m, nil + } else { + var query = fmt.Sprintf("%s =?", params["key"]) + err := p.Db.Where(query, params["value"]).Limit(pageSize, (page-1)*pageSize).Find(&m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + return &m, nil + } + } +} diff --git a/src/implement/public_platoon_user_system_punish_records_implement.go b/src/implement/public_platoon_user_system_punish_records_implement.go new file mode 100644 index 0000000..d58687b --- /dev/null +++ b/src/implement/public_platoon_user_system_punish_records_implement.go @@ -0,0 +1,67 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + zhios_order_relate_utils "code.fnuoos.com/EggPlanet/egg_models.git/utils" + zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" + "errors" + "fmt" + "reflect" + "xorm.io/xorm" +) + +func NewPublicPlatoonUserSystemPunishRecordsDb(engine *xorm.Engine) dao.PublicPlatoonUserSystemPunishRecordsDao { + return &PublicPlatoonUserSystemPunishRecordsDb{Db: engine} +} + +type PublicPlatoonUserSystemPunishRecordsDb struct { + Db *xorm.Engine +} + +func (p PublicPlatoonUserSystemPunishRecordsDb) PublicPlatoonUserSystemPunishRecordsInsert(session *xorm.Session, PublicPlatoonUserSystemPunishRecords *model.PublicPlatoonUserSystemPunishRecords) (int64, error) { + _, err := session.InsertOne(PublicPlatoonUserSystemPunishRecords) + if err != nil { + return 0, err + } + return PublicPlatoonUserSystemPunishRecords.Id, nil +} + +func (p PublicPlatoonUserSystemPunishRecordsDb) PublicPlatoonUserSystemPunishRecordsGetOneByParams(params map[string]interface{}) (*model.PublicPlatoonUserSystemPunishRecords, error) { + var m model.PublicPlatoonUserSystemPunishRecords + var query = fmt.Sprintf("%s =?", params["key"]) + if has, err := p.Db.Where(query, params["value"]).Get(&m); err != nil || has == false { + return nil, zhios_order_relate_logx.Error(err) + } + return &m, nil +} + +func (p PublicPlatoonUserSystemPunishRecordsDb) PublicPlatoonUserSystemPunishRecordsFindByParams(params map[string]interface{}) (*[]model.PublicPlatoonUserSystemPunishRecords, error) { + var m []model.PublicPlatoonUserSystemPunishRecords + if params["value"] == nil { + return nil, errors.New("参数有误") + } + if params["key"] == nil { + //查询全部数据 + err := p.Db.Find(&m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + return &m, nil + } else { + if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { + //指定In查询 + if err := p.Db.In(zhios_order_relate_utils.AnyToString(params["key"]), params["value"]).Find(&m); err != nil { + return nil, zhios_order_relate_logx.Warn(err) + } + return &m, nil + } else { + var query = fmt.Sprintf("%s =?", params["key"]) + err := p.Db.Where(query, params["value"]).Find(&m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + return &m, nil + } + } +} diff --git a/src/implement/user_implement.go b/src/implement/user_implement.go new file mode 100644 index 0000000..26de634 --- /dev/null +++ b/src/implement/user_implement.go @@ -0,0 +1,14 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "xorm.io/xorm" +) + +func NewUserDb(engine *xorm.Engine) dao.UserDao { + return &UserDb{Db: engine} +} + +type UserDb struct { + Db *xorm.Engine +} diff --git a/src/implement/user_level_implement.go b/src/implement/user_level_implement.go new file mode 100644 index 0000000..6e558b5 --- /dev/null +++ b/src/implement/user_level_implement.go @@ -0,0 +1,51 @@ +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" + "errors" + "xorm.io/xorm" +) + +func NewUserLevelDb(engine *xorm.Engine) dao.UserLevelDao { + return &UserLevelDb{Db: engine} +} + +type UserLevelDb struct { + Db *xorm.Engine +} + +func (u UserLevelDb) UserLevelInIDescByWeightLowWithOne() (*model.UserLevel, error) { + var ms model.UserLevel + has, err := u.Db.Where("is_use=1").Asc("level_weight").Get(&ms) + if err != nil { + return nil, err + } + if has == false { + return nil, zhios_order_relate_logx.Warn(errors.New("等级不存在")) + } + return &ms, nil +} + +func (u UserLevelDb) UserLevelByID(id interface{}) (*model.UserLevel, error) { + m := new(model.UserLevel) + has, err := u.Db.Where("id = ?", id).Get(m) + if err != nil { + return nil, err + } + if !has { + return nil, errors.New("no found") + } + + return m, nil +} + +func (u UserLevelDb) UserLevelAllByAsc() ([]*model.UserLevel, error) { + var m []*model.UserLevel + err := u.Db.Where("is_use = ?", 1).Asc("level_weight").Find(&m) + if err != nil { + return nil, zhios_order_relate_logx.Warn(err) + } + return m, nil +} diff --git a/src/implement/user_relate_implement.go b/src/implement/user_relate_implement.go new file mode 100644 index 0000000..69a55ff --- /dev/null +++ b/src/implement/user_relate_implement.go @@ -0,0 +1,60 @@ +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" +) + +func NewUserRelateDb(engine *xorm.Engine) dao.UserRelateDao { + return &UserRelateDb{Db: engine} +} + +type UserRelateDb struct { + Db *xorm.Engine +} + +func (u UserRelateDb) FindUserRelate(uid int64, level int) (*[]model.UserRelate, error) { + var userRelate []model.UserRelate + sess := u.Db.Where("uid = ?", uid) + if level > 0 { + sess.And("level<=?", level) + } + if err := sess.Asc("level").Find(&userRelate); err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if len(userRelate) == 0 { + return nil, nil + } + return &userRelate, nil +} + +func (u UserRelateDb) GetUserParentUserRelate(uid int64) (*model.UserRelate, error) { + var data model.UserRelate + get, err := u.Db.Where("level=1 and uid =?", uid).Get(&data) + if get == false || err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + return &data, nil +} + +func (u UserRelateDb) FindUserRelateByParentUid(uid int64, level int) (*[]model.UserRelate, error) { + var userRelate []model.UserRelate + sess := u.Db.Where("parent_uid = ?", uid) + if level > 0 { + sess.And("level<=?", level) + } + if err := sess.Asc("level").Find(&userRelate); err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if len(userRelate) == 0 { + return nil, nil + } + return &userRelate, nil +} + +func (u UserRelateDb) SumUserRelateByParentUid(parentUid string) (total int64, userRelate []*model.UserRelate, err error) { + total, err = u.Db.Where("parent_uid = ?", parentUid).And("level = 1").FindAndCount(&userRelate) + return +} diff --git a/src/implement/user_wallet_implement.go b/src/implement/user_wallet_implement.go new file mode 100644 index 0000000..39129a7 --- /dev/null +++ b/src/implement/user_wallet_implement.go @@ -0,0 +1,14 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "xorm.io/xorm" +) + +func NewUserWalletDb(engine *xorm.Engine) dao.UserWalletDao { + return &UserWalletDb{Db: engine} +} + +type UserWalletDb struct { + Db *xorm.Engine +} diff --git a/src/model/admin_bind_medium.go b/src/model/admin_bind_medium.go index fe537c4..935fc7a 100644 --- a/src/model/admin_bind_medium.go +++ b/src/model/admin_bind_medium.go @@ -1,13 +1,9 @@ package model -import ( - "time" -) - type AdminBindMedium struct { - Id int `json:"id" xorm:"not null pk autoincr INT(11)"` - AdminId int `json:"admin_id" xorm:"default 0 comment('管理员id') INT(11)"` - MediumId int `json:"medium_id" xorm:"not null default 0 comment('媒体id') INT(11)"` - CreateAt time.Time `json:"create_at" xorm:"not null default CURRENT_TIMESTAMP DATETIME"` - UpdateAt time.Time `json:"update_at" xorm:"not null default CURRENT_TIMESTAMP DATETIME"` + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + AdminId int `json:"admin_id" xorm:"default 0 comment('管理员id') INT(11)"` + MediumId int `json:"medium_id" xorm:"not null default 0 comment('媒体id') INT(11)"` + CreateAt string `json:"create_at" xorm:"not null default CURRENT_TIMESTAMP DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default CURRENT_TIMESTAMP DATETIME"` } diff --git a/src/model/egg_energy_basic_setting.go b/src/model/egg_energy_basic_setting.go new file mode 100644 index 0000000..198bd6c --- /dev/null +++ b/src/model/egg_energy_basic_setting.go @@ -0,0 +1,41 @@ +package model + +type EggEnergyBasicSetting struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + IsOpen int `json:"is_open" xorm:"not null default 1 comment('是否开启(1:开启 0:关闭)') TINYINT(1)"` + PersonEggEnergyCoinId int `json:"person_egg_energy_coin_id" xorm:"not null default 0 comment('个人蛋蛋能量对应虚拟币id') INT(11)"` + TeamEggEnergyCoinId int `json:"team_egg_energy_coin_id" xorm:"not null default 0 comment('团队绿色能量对应虚拟币id') INT(11)"` + PersonEggPointsCoinId int `json:"person_egg_points_coin_id" xorm:"not null default 0 comment('个人蛋蛋积分对应虚拟币id') INT(11)"` + TeamEggPointsCoinId int `json:"team_egg_points_coin_id" xorm:"not null default 0 comment('团队蛋蛋积分对应虚拟币id') INT(11)"` + ContributionCoinId int `json:"contribution_coin_id" xorm:"not null default 0 comment('贡献值对应虚拟币id') INT(11)"` + TotalIssuanceAmount string `json:"total_issuance_amount" xorm:"not null comment('总发行量') DECIMAL(28,8)"` + TotalTechnologyTeam string `json:"total_technology_team" xorm:"not null comment('技术团队') DECIMAL(28,8)"` + TotalAngelInvestor string `json:"total_angel_investor" xorm:"not null comment('天使投资人') DECIMAL(28,8)"` + TotalOperateFund string `json:"total_operate_fund" xorm:"not null comment('运营资金') DECIMAL(28,8)"` + TotalEcologicalDevelopment string `json:"total_ecological_development" xorm:"not null comment('生态建设') DECIMAL(28,8)"` + TotalTeamDividends string `json:"total_team_dividends" xorm:"not null comment('团队分红') DECIMAL(28,8)"` + TotalUserForPerson string `json:"total_user_for_person" xorm:"not null comment('个人区域') DECIMAL(28,8)"` + TotalUserForTeam string `json:"total_user_for_team" xorm:"not null comment('团队区域') DECIMAL(28,8)"` + InitialPrice string `json:"initial_price" xorm:"not null comment('初始价格') DECIMAL(28,8)"` + NowPrice string `json:"now_price" xorm:"not null comment('当前价格') DECIMAL(28,8)"` + PlanetTotalValue string `json:"planet_total_value" xorm:"not null comment('星球总价值') DECIMAL(28,8)"` + MarketplaceMerchantNums string `json:"marketplace_merchant_nums" xorm:"not null comment('市商数量') DECIMAL(28,8)"` + MarketplaceMerchantFunds string `json:"marketplace_merchant_funds" xorm:"not null comment('市商资金') DECIMAL(28,8)"` + DevelopmentCommittee string `json:"development_committee" xorm:"not null comment('发展委员会') DECIMAL(28,8)"` + PublicWelfareAndCharity string `json:"public_welfare_and_charity" xorm:"not null comment('公益慈善') DECIMAL(28,8)"` + StarLevelDividends string `json:"star_level_dividends" xorm:"not null comment('星级分红') DECIMAL(28,8)"` + DestructionQuantityNums string `json:"destruction_quantity_nums" xorm:"not null comment('销毁数量') DECIMAL(28,8)"` + DestructionSetting string `json:"destruction_setting" xorm:"not null comment('销毁设置') TEXT"` + IsLimitDividend int `json:"is_limit_dividend" xorm:"not null default 1 comment('是否限制分红(会员本人不活跃,没有星级能量分红)') TINYINT(1)"` + SettlementQuantity int `json:"settlement_quantity" xorm:"not null default 0 comment('结算数量(百分比)') INT(11)"` + DirectPushReward string `json:"direct_push_reward" xorm:"not null comment('直推奖励') TEXT"` + PriceSetting string `json:"price_setting" xorm:"not null comment('价格设置') TEXT"` + VipEquitySetting string `json:"vip_equity_setting" xorm:"not null comment('会员权益') TEXT"` + VideoRewardIsOpen int `json:"video_reward_is_open" xorm:"not null default 1 comment('视屏奖励是否开启(1:开启 0:关闭)') TINYINT(1)"` + VideoRewardSystem string `json:"video_reward_system" xorm:"not null comment('视屏奖励机制') TEXT"` + ExchangeRules string `json:"exchange_rules" xorm:"not null comment('兑换规则') TEXT"` + NewUserIncentiveRules string `json:"new_user_incentive_rules" xorm:"not null comment('新用户激励规则') TEXT"` + RewardSystem string `json:"reward_system" xorm:"not null comment('圈层奖励机制') TEXT"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +} diff --git a/src/model/egg_energy_community_dividends.go b/src/model/egg_energy_community_dividends.go new file mode 100644 index 0000000..657f895 --- /dev/null +++ b/src/model/egg_energy_community_dividends.go @@ -0,0 +1,12 @@ +package model + +type EggEnergyCommunityDividends struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Nums int `json:"nums" xorm:"not null default 0 comment('分红数量') INT(11)"` + 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)"` + PersonsNum int `json:"persons_num" xorm:"not null default 0 comment('分红人数') INT(11)"` + IsOver int `json:"is_over" xorm:"not null default 0 comment('是否分红完毕') TINYINT(1)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +} diff --git a/src/model/egg_energy_community_dividends_with_user.go b/src/model/egg_energy_community_dividends_with_user.go new file mode 100644 index 0000000..9d0b394 --- /dev/null +++ b/src/model/egg_energy_community_dividends_with_user.go @@ -0,0 +1,9 @@ +package model + +type EggEnergyCommunityDividendsWithUser struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Uid int64 `json:"uid" xorm:"not null default 0 comment('用户id') BIGINT(20)"` + Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +} diff --git a/src/model/egg_energy_community_dividends_with_user_records.go b/src/model/egg_energy_community_dividends_with_user_records.go new file mode 100644 index 0000000..69be953 --- /dev/null +++ b/src/model/egg_energy_community_dividends_with_user_records.go @@ -0,0 +1,11 @@ +package model + +type EggEnergyCommunityDividendsWithUserRecords struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Uid int64 `json:"uid" xorm:"not null default 0 comment('用户id') BIGINT(20)"` + Value string `json:"value" xorm:"not null default 0.0000000000 comment('数量') DECIMAL(28,10)"` + RecordsId int `json:"records_id" xorm:"not null default 0 comment('记录id') INT(11)"` + CoinId int `json:"coin_id" xorm:"not null default 0 comment('虚拟币id') INT(11)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +} diff --git a/src/model/egg_energy_user_activity.go b/src/model/egg_energy_user_activity.go new file mode 100644 index 0000000..fdc2f3c --- /dev/null +++ b/src/model/egg_energy_user_activity.go @@ -0,0 +1,7 @@ +package model + +type EggEnergyUserActivity struct { + Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"` + Uid int `json:"uid" xorm:"not null default 0 comment('用户id') index(idx_uid_date) INT(11)"` + Date string `json:"date" xorm:"not null default '0000-00-00' comment('日期') index(idx_uid_date) CHAR(50)"` +} diff --git a/src/model/egg_energy_user_watch_records.go b/src/model/egg_energy_user_watch_records.go new file mode 100644 index 0000000..f27ee8f --- /dev/null +++ b/src/model/egg_energy_user_watch_records.go @@ -0,0 +1,14 @@ +package model + +import ( + "time" +) + +type EggEnergyUserWatchRecords struct { + Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"` + Uid int64 `json:"uid" xorm:"not null default 0 comment('用户id') index BIGINT(20)"` + NextWatchAdDate time.Time `json:"next_watch_ad_date" xorm:"not null default 'CURRENT_TIMESTAMP' comment('下一轮观看视屏时间') DATETIME"` + ResidueWatchAdNum int `json:"residue_watch_ad_num" xorm:"not null default 0 comment('剩余观看视屏数') INT(11)"` + CreateAt time.Time `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt time.Time `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +} diff --git a/src/model/egg_sign_in.go b/src/model/egg_sign_in.go new file mode 100644 index 0000000..e899d8c --- /dev/null +++ b/src/model/egg_sign_in.go @@ -0,0 +1,9 @@ +package model + +type EggSignIn struct { + Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"` + Uid int64 `json:"uid" xorm:"not null default 0 comment('用户id') INT(11)"` + StartTime string `json:"start_time" xorm:"not null default 'CURRENT_TIMESTAMP' comment('签到开始时间') DATETIME"` + EndTime string `json:"end_time" xorm:"not null default 'CURRENT_TIMESTAMP' comment('签到结束时间') DATETIME"` + IsCompleted int `json:"is_completed" xorm:"not null default 0 comment('是否完成(0:未完成 1:已完成)') TINYINT(1)"` +} diff --git a/src/model/egg_star_level_dividends_records.go b/src/model/egg_star_level_dividends_records.go new file mode 100644 index 0000000..9ca2632 --- /dev/null +++ b/src/model/egg_star_level_dividends_records.go @@ -0,0 +1,9 @@ +package model + +type EggStarLevelDividendsRecords struct { + Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"` + Amount string `json:"amount" xorm:"not null default 0.00000000 comment('分红值') DECIMAL(20,8)"` + AlreadyDividendsAmount string `json:"already_dividends_amount" xorm:"not null default 0.00000000 comment('已分红值') DECIMAL(20,8)"` + NotDividendsAmount string `json:"not_dividends_amount" xorm:"not null default 0.00000000 comment('未分红值') DECIMAL(20,8)"` + Date string `json:"date" xorm:"not null default '0000-00-00' comment('日期') CHAR(50)"` +} diff --git a/src/model/public_platoon_basic_setting.go b/src/model/public_platoon_basic_setting.go new file mode 100644 index 0000000..a965d12 --- /dev/null +++ b/src/model/public_platoon_basic_setting.go @@ -0,0 +1,14 @@ +package model + +type PublicPlatoonBasicSetting struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + IsOpen int `json:"is_open" xorm:"not null default 1 comment('是否开启(1:开启 0:关闭)') TINYINT(1)"` + OriginatorUid int `json:"originator_uid" xorm:"not null default 0 comment('创始人uid') INT(11)"` + SeveralTimes int `json:"several_times" xorm:"not null default 3 comment('几乘') TINYINT(3)"` + SeveralRows int `json:"several_rows" xorm:"not null default 3 comment('几排') TINYINT(3)"` + SystemPunishReplace int `json:"system_punish_replace" xorm:"not null default 1 comment('是否位置滑落 被新用户替换 0否 1是') TINYINT(1)"` + SystemPunishReplaceValue int `json:"system_punish_replace_value" xorm:"not null default 0 comment('xx天未活跃,处罚滑落') INT(11)"` + IsSelfActiveGetTeamRevenue int `json:"is_self_active_get_team_revenue" xorm:"not null default 1 comment('会员本人没有日活,没有团队奖励(1:开启 0:关闭)') TINYINT(1)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +} diff --git a/src/model/public_platoon_free_punish_with_user.go b/src/model/public_platoon_free_punish_with_user.go new file mode 100644 index 0000000..783c4a4 --- /dev/null +++ b/src/model/public_platoon_free_punish_with_user.go @@ -0,0 +1,6 @@ +package model + +type PublicPlatoonFreePunishWithUser struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Uid int64 `json:"uid" xorm:"not null default 0 comment('用户id') INT(11)"` +} diff --git a/src/model/public_platoon_records_punish_with_user.go b/src/model/public_platoon_records_punish_with_user.go new file mode 100644 index 0000000..8eca448 --- /dev/null +++ b/src/model/public_platoon_records_punish_with_user.go @@ -0,0 +1,7 @@ +package model + +type PublicPlatoonRecordsPunishWithUser struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Uid int64 `json:"uid" xorm:"not null default 0 comment('用户id') INT(11)"` + Date string `json:"date" xorm:"default '0000-00-00' comment('处罚日期') CHAR(50)"` +} diff --git a/src/model/public_platoon_user_relation.go b/src/model/public_platoon_user_relation.go new file mode 100644 index 0000000..8b1ca97 --- /dev/null +++ b/src/model/public_platoon_user_relation.go @@ -0,0 +1,52 @@ +package model + +type PublicPlatoonUserRelation struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Uid int64 `json:"uid" xorm:"not null default 0 comment('用户id(若为-1,则代表等待新用户填充)') index INT(11)"` + RecommendUid int64 `json:"recommend_uid" xorm:"not null default 0 comment('推荐人id') INT(11)"` + FatherUid string `json:"father_uid" xorm:"not null default '' comment('父级uid(123456-563464-438384)') index VARCHAR(100)"` + FatherUid1 int64 `json:"father_uid1" xorm:"not null default 0 comment('父级uid_1') INT(11)"` + FatherUid2 int64 `json:"father_uid2" xorm:"not null default 0 comment('父级uid_2') INT(11)"` + FatherUid3 int64 `json:"father_uid3" xorm:"not null default 0 comment('父级uid_3') INT(11)"` + FatherUid4 int64 `json:"father_uid4" xorm:"not null default 0 comment('父级uid_4') INT(11)"` + FatherUid5 int64 `json:"father_uid5" xorm:"not null default 0 comment('父级uid_5') INT(11)"` + FatherUid6 int64 `json:"father_uid6" xorm:"not null default 0 comment('父级uid_6') INT(11)"` + FatherUid7 int64 `json:"father_uid7" xorm:"not null default 0 comment('父级uid_7') INT(11)"` + FatherUid8 int64 `json:"father_uid8" xorm:"not null default 0 comment('父级uid_8') INT(11)"` + FatherUid9 int64 `json:"father_uid9" xorm:"not null default 0 comment('父级uid_9') INT(11)"` + Pid1 int64 `json:"pid1" xorm:"not null default 0 comment('父级id_1') INT(11)"` + Pid2 int64 `json:"pid2" xorm:"not null default 0 comment('父级id_2') INT(11)"` + Pid3 int64 `json:"pid3" xorm:"not null default 0 comment('父级id_3') INT(11)"` + Pid4 int64 `json:"pid4" xorm:"not null default 0 comment('父级id_4') INT(11)"` + Pid5 int64 `json:"pid5" xorm:"not null default 0 comment('父级id_5') INT(11)"` + Pid6 int64 `json:"pid6" xorm:"not null default 0 comment('父级id_6') INT(11)"` + Pid7 int64 `json:"pid7" xorm:"not null default 0 comment('父级id_7') INT(11)"` + Pid8 int64 `json:"pid8" xorm:"not null default 0 comment('父级id_8') INT(11)"` + Pid9 int64 `json:"pid9" xorm:"not null default 0 comment('父级id_9') INT(11)"` + Position int64 `json:"position" xorm:"not null default 1 comment('位置(以自己为创始人)') INT(11)"` + Position1 int64 `json:"position1" xorm:"not null default 0 comment('位置_1(以pid1为创始人中网的位置)') INT(11)"` + Position2 int64 `json:"position2" xorm:"not null default 0 comment('位置_2') INT(11)"` + Position3 int64 `json:"position3" xorm:"not null default 0 comment('位置_3') INT(11)"` + Position4 int64 `json:"position4" xorm:"not null default 0 comment('位置_4') INT(11)"` + Position5 int64 `json:"position5" xorm:"not null default 0 comment('位置_5') INT(11)"` + Position6 int64 `json:"position6" xorm:"not null default 0 comment('位置_6') INT(11)"` + Position7 int64 `json:"position7" xorm:"not null default 0 comment('位置_7') INT(11)"` + Position8 int64 `json:"position8" xorm:"not null default 0 comment('位置_8') INT(11)"` + Position9 int64 `json:"position9" xorm:"not null default 0 comment('位置_9') INT(11)"` + Level int `json:"level" xorm:"not null default 1 comment('等级(以自己为创始人)') INT(11)"` + Level1 int `json:"level1" xorm:"not null default 0 comment('等级_1(以pid1为创始人中网的等级)') INT(11)"` + Level2 int `json:"level2" xorm:"not null default 0 comment('等级_2') INT(11)"` + Level3 int `json:"level3" xorm:"not null default 0 comment('等级_3') INT(11)"` + Level4 int `json:"level4" xorm:"not null default 0 comment('等级_4') INT(11)"` + Level5 int `json:"level5" xorm:"not null default 0 comment('等级_5') INT(11)"` + Level6 int `json:"level6" xorm:"not null default 0 comment('等级_6') INT(11)"` + Level7 int `json:"level7" xorm:"not null default 0 comment('等级_7') INT(11)"` + Level8 int `json:"level8" xorm:"not null default 0 comment('等级_8') INT(11)"` + Level9 int `json:"level9" xorm:"default 0 comment('等级_9') INT(11)"` + LevelTotal int `json:"level_total" xorm:"not null default 1 comment('等级(整个系统)') INT(11)"` + JoinAt string `json:"join_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('加入公排时间') DATETIME"` + HasSonNum int `json:"has_son_num" xorm:"not null default 0 comment('拥有直属下级数量') TINYINT(2)"` + IsAllowPunish int `json:"is_allow_punish" xorm:"not null default 1 comment('是否允许处罚(1:允许 2:不允许)') TINYINT(1)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +} diff --git a/src/model/public_platoon_user_system_punish_records.go b/src/model/public_platoon_user_system_punish_records.go new file mode 100644 index 0000000..151a2c8 --- /dev/null +++ b/src/model/public_platoon_user_system_punish_records.go @@ -0,0 +1,14 @@ +package model + +type PublicPlatoonUserSystemPunishRecords struct { + Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"` + Uid int64 `json:"uid" xorm:"not null comment('用户id') index INT(11)"` + OldPosition int64 `json:"old_position" xorm:"not null default 0 comment('位置(旧)') INT(11)"` + NewPosition int64 `json:"new_position" xorm:"not null default 0 comment('位置(新)') INT(11)"` + Date string `json:"date" xorm:"not null default '' comment('日期(0000-00)') VARCHAR(50)"` + Title string `json:"title" xorm:"not null default '' comment('标题') VARCHAR(100)"` + Reason string `json:"reason" xorm:"not null default '' comment('原因') VARCHAR(255)"` + Type int `json:"type" xorm:"not null default 1 comment('类型(1:大公排 2:小公排)') TINYINT(1)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +} diff --git a/src/model/user.go b/src/model/user.go new file mode 100644 index 0000000..7df8a35 --- /dev/null +++ b/src/model/user.go @@ -0,0 +1,23 @@ +package model + +type User struct { + Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"` + Phone string `json:"phone" xorm:"not null default '' comment('手机号') VARCHAR(255)"` + UnionId string `json:"union_id" xorm:"not null default '' comment('微信用户id') VARCHAR(255)"` + OpenId string `json:"open_id" xorm:"not null default '' comment('微信openid') VARCHAR(255)"` + Nickname string `json:"nickname" xorm:"not null default '' comment('昵称') VARCHAR(255)"` + Avatar string `json:"avatar" xorm:"not null default '' comment('头像') VARCHAR(255)"` + Password string `json:"password" xorm:"not null default '' comment('密码') CHAR(50)"` + Passcode string `json:"passcode" xorm:"not null default '' comment('支付密码') CHAR(50)"` + Level int `json:"level" xorm:"not null default 0 comment('用户等级id') INT(11)"` + InviteTotal int `json:"invite_total" xorm:"not null default 0 comment('直推邀请总人数') INT(11)"` + State int `json:"state" xorm:"not null default 1 comment('1正常,2冻结') TINYINT(1)"` + LastLoginIp string `json:"last_login_ip" xorm:"not null default '' comment('最后登录IP') CHAR(50)"` + Sex int `json:"sex" xorm:"not null default 0 comment('性别(0:未知 1:男 2:女)') TINYINT(1)"` + ParentUid int64 `json:"parent_uid" xorm:"not null default 0 comment('父级id') BIGINT(20)"` + SystemInviteCode string `json:"system_invite_code" xorm:"not null default '' comment('系统邀请码') CHAR(50)"` + CustomInviteCode string `json:"custom_invite_code" xorm:"not null default '' comment('自定义邀请码') CHAR(50)"` + Memo string `json:"memo" xorm:"not null default '' comment('备注信息') VARCHAR(244)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +} diff --git a/src/model/user_level.go b/src/model/user_level.go new file mode 100644 index 0000000..46e882f --- /dev/null +++ b/src/model/user_level.go @@ -0,0 +1,11 @@ +package model + +type UserLevel struct { + Id int `json:"id" xorm:"not null pk autoincr comment('等级id') INT(11)"` + LevelName string `json:"level_name" xorm:"not null default '' comment('等级名称') CHAR(50)"` + LevelWeight int `json:"level_weight" xorm:"not null default 0 comment('等级权重') INT(11)"` + IsUse int `json:"is_use" xorm:"not null default 1 comment('是否开启(0否,1是)') TINYINT(1)"` + Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +} diff --git a/src/model/user_relate.go b/src/model/user_relate.go new file mode 100644 index 0000000..d42c53e --- /dev/null +++ b/src/model/user_relate.go @@ -0,0 +1,9 @@ +package model + +type UserRelate struct { + 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 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)"` + InviteTime string `json:"invite_time" xorm:"default 'CURRENT_TIMESTAMP' comment('邀请时间') TIMESTAMP"` +} diff --git a/src/model/user_wallet.go b/src/model/user_wallet.go new file mode 100644 index 0000000..756a2b2 --- /dev/null +++ b/src/model/user_wallet.go @@ -0,0 +1,9 @@ +package model + +type UserWallet struct { + Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"` + Uid int64 `json:"uid" xorm:"not null default 0 comment('用户id') BIGINT(20)"` + Amount string `json:"amount" xorm:"not null default 0.00 comment('用户余额') DECIMAL(10,2)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +}