@@ -6,4 +6,5 @@ type EggEnergyUserActivityDao interface { | |||||
//TODO:: You can add specific method definitions here | //TODO:: You can add specific method definitions here | ||||
EggEnergyUserActivityGetOneByTimeAndUserID(userID int64, date string) (*model.EggEnergyUserActivity, error) | EggEnergyUserActivityGetOneByTimeAndUserID(userID int64, date string) (*model.EggEnergyUserActivity, error) | ||||
EggEnergyUserActivityInsert(m *model.EggEnergyUserActivity) (int64, error) | EggEnergyUserActivityInsert(m *model.EggEnergyUserActivity) (int64, error) | ||||
EggEnergyUserActivityCountByDate(startAt, endAt string) (int64, error) | |||||
} | } |
@@ -5,4 +5,6 @@ import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||||
type PlatformActiveDataDao interface { | type PlatformActiveDataDao interface { | ||||
//TODO:: You can add specific method definitions here | //TODO:: You can add specific method definitions here | ||||
PlatformActiveDataGetOneByParams(params map[string]interface{}) (*model.PlatformActiveData, error) | PlatformActiveDataGetOneByParams(params map[string]interface{}) (*model.PlatformActiveData, error) | ||||
PlatformActiveDataInsert(m *model.PlatformActiveData) (int64, error) | |||||
PlatformActiveDataUpdate(m *model.PlatformActiveData, columns ...string) (int64, error) | |||||
} | } |
@@ -5,4 +5,7 @@ import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||||
type PlatformGrowDataDao interface { | type PlatformGrowDataDao interface { | ||||
//TODO:: You can add specific method definitions here | //TODO:: You can add specific method definitions here | ||||
PlatformGrowDataGetLastOne() (*model.PlatformGrowData, bool, error) | PlatformGrowDataGetLastOne() (*model.PlatformGrowData, bool, error) | ||||
PlatformGrowDataInsert(m *model.PlatformGrowData) (int64, error) | |||||
PlatformGrowDataUpdate(m *model.PlatformGrowData, columns ...string) (int64, error) | |||||
PlatformGrowDataGetOneByParams(params map[string]interface{}) (*model.PlatformGrowData, error) | |||||
} | } |
@@ -5,4 +5,6 @@ import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||||
type PlatformTotalDataDao interface { | type PlatformTotalDataDao interface { | ||||
//TODO:: You can add specific method definitions here | //TODO:: You can add specific method definitions here | ||||
PlatformTotalDataGetOneByTime(year string, month string) (*model.PlatformTotalData, error) | PlatformTotalDataGetOneByTime(year string, month string) (*model.PlatformTotalData, error) | ||||
PlatformTotalDataInsert(m *model.PlatformTotalData) (int64, error) | |||||
PlatformTotalDataUpdate(m *model.PlatformTotalData, columns ...string) (int64, error) | |||||
} | } |
@@ -6,4 +6,5 @@ type UserCertificateDao interface { | |||||
FindUserCertificate(page, limit, uid string) (*[]model.UserCertificate, int64, error) | FindUserCertificate(page, limit, uid string) (*[]model.UserCertificate, int64, error) | ||||
GetUserCertificateByNo(no string) (*model.UserCertificate, error) | GetUserCertificateByNo(no string) (*model.UserCertificate, error) | ||||
GetUserCertificateById(id string) (*model.UserCertificate, error) | GetUserCertificateById(id string) (*model.UserCertificate, error) | ||||
UserCertificateCountByDate(startAt, endAt string) (int64, error) | |||||
} | } |
@@ -20,4 +20,5 @@ type UserDao interface { | |||||
UserCount() (int64, error) | UserCount() (int64, error) | ||||
UserFindNotInByParamsByPage(page int, limit int, params map[string]interface{}) ([]model.User, int64, error) | UserFindNotInByParamsByPage(page int, limit int, params map[string]interface{}) ([]model.User, int64, error) | ||||
UserExistByParams(params map[string]interface{}) (bool, error) | UserExistByParams(params map[string]interface{}) (bool, error) | ||||
UserCountByDate(startAt, endAt string) (int64, error) | |||||
} | } |
@@ -9,4 +9,6 @@ type UserWalletFlowDao interface { | |||||
UserWalletFlowInsertBySession(session *xorm.Session, userWalletFlow *model.UserWalletFlow) (int64, error) | UserWalletFlowInsertBySession(session *xorm.Session, userWalletFlow *model.UserWalletFlow) (int64, error) | ||||
UserWalletFlowFindByParams(params map[string]interface{}, page, limit int) (*[]model.UserWalletFlow, int64, error) | UserWalletFlowFindByParams(params map[string]interface{}, page, limit int) (*[]model.UserWalletFlow, int64, error) | ||||
UserWalletFlowFindByCoinAndUser(page, pageSize int, uid int64, startAt string, endAt string, direction int, isAsc bool, kind int, state int) ([]model.UserWalletFlow, int64, error) | UserWalletFlowFindByCoinAndUser(page, pageSize int, uid int64, startAt string, endAt string, direction int, isAsc bool, kind int, state int) ([]model.UserWalletFlow, int64, error) | ||||
UserWalletFlowGetSum(startAt, endAt string, kind int) (float64, error) | |||||
UserWalletFlowUserCount(startAt, endAt string, kind int) (int64, error) | |||||
} | } |
@@ -3,6 +3,7 @@ | |||||
import ( | import ( | ||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | ||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | "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" | "xorm.io/xorm" | ||||
) | ) | ||||
@@ -33,3 +34,11 @@ func (e EggEnergyUserActivityDb) EggEnergyUserActivityInsert(m *model.EggEnergyU | |||||
} | } | ||||
return m.Id, nil | return m.Id, nil | ||||
} | } | ||||
func (e EggEnergyUserActivityDb) EggEnergyUserActivityCountByDate(startAt, endAt string) (int64, error) { | |||||
count, err := e.Db.Distinct("uid").Where("date >= ?", startAt).And("date =< ?", endAt).Count(&model.EggEnergyUserActivity{}) | |||||
if err != nil { | |||||
return 0, zhios_order_relate_logx.Error(err) | |||||
} | |||||
return count, nil | |||||
} |
@@ -24,3 +24,19 @@ func (p PlatformActiveDataDb) PlatformActiveDataGetOneByParams(params map[string | |||||
} | } | ||||
return &m, nil | return &m, nil | ||||
} | } | ||||
func (p PlatformActiveDataDb) PlatformActiveDataInsert(m *model.PlatformActiveData) (int64, error) { | |||||
_, err := p.Db.InsertOne(m) | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
return m.Id, nil | |||||
} | |||||
func (p PlatformActiveDataDb) PlatformActiveDataUpdate(m *model.PlatformActiveData, columns ...string) (int64, error) { | |||||
affected, err := p.Db.Where("id =?", m.Id).Cols(columns...).Update(m) | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
return affected, nil | |||||
} |
@@ -4,6 +4,7 @@ import ( | |||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | ||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | ||||
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" | zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" | ||||
"fmt" | |||||
"xorm.io/xorm" | "xorm.io/xorm" | ||||
) | ) | ||||
@@ -23,3 +24,28 @@ func (p PlatformGrowDataDb) PlatformGrowDataGetLastOne() (*model.PlatformGrowDat | |||||
} | } | ||||
return &m, exist, nil | return &m, exist, nil | ||||
} | } | ||||
func (p PlatformGrowDataDb) PlatformGrowDataInsert(m *model.PlatformGrowData) (int64, error) { | |||||
_, err := p.Db.InsertOne(m) | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
return m.Id, nil | |||||
} | |||||
func (p PlatformGrowDataDb) PlatformGrowDataUpdate(m *model.PlatformGrowData, columns ...string) (int64, error) { | |||||
affected, err := p.Db.Where("id =?", m.Id).Cols(columns...).Update(m) | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
return affected, nil | |||||
} | |||||
func (p PlatformGrowDataDb) PlatformGrowDataGetOneByParams(params map[string]interface{}) (*model.PlatformGrowData, error) { | |||||
var m model.PlatformGrowData | |||||
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 | |||||
} |
@@ -25,3 +25,19 @@ func (p PlatformTotalDataDb) PlatformTotalDataGetOneByTime(year string, month st | |||||
} | } | ||||
return &m, nil | return &m, nil | ||||
} | } | ||||
func (p PlatformTotalDataDb) PlatformTotalDataInsert(m *model.PlatformTotalData) (int64, error) { | |||||
_, err := p.Db.InsertOne(m) | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
return m.Id, nil | |||||
} | |||||
func (p PlatformTotalDataDb) PlatformTotalDataUpdate(m *model.PlatformTotalData, columns ...string) (int64, error) { | |||||
affected, err := p.Db.Where("id =?", m.Id).Cols(columns...).Update(m) | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
return affected, nil | |||||
} |
@@ -53,3 +53,11 @@ func (u UserCertificateDb) GetUserCertificateById(id string) (m *model.UserCerti | |||||
} | } | ||||
return m, nil | return m, nil | ||||
} | } | ||||
func (u UserCertificateDb) UserCertificateCountByDate(startAt, endAt string) (int64, error) { | |||||
count, err := u.Db.Where("start_time >= ?", startAt).And("start_time =< ?", endAt).Count(&model.UserCertificate{}) | |||||
if err != nil { | |||||
return 0, zhios_order_relate_logx.Error(err) | |||||
} | |||||
return count, nil | |||||
} |
@@ -186,3 +186,11 @@ func (u UserDb) UserExistByParams(params map[string]interface{}) (bool, error) { | |||||
} | } | ||||
return has, nil | return has, nil | ||||
} | } | ||||
func (u UserDb) UserCountByDate(startAt, endAt string) (int64, error) { | |||||
count, err := u.Db.Where("create_at >= ?", startAt).And("create_at =< ?", endAt).Count(&model.User{}) | |||||
if err != nil { | |||||
return 0, zhios_order_relate_logx.Error(err) | |||||
} | |||||
return count, nil | |||||
} |
@@ -77,3 +77,19 @@ func (u UserWalletFlowDb) UserWalletFlowFindByCoinAndUser(page, pageSize int, ui | |||||
return m, total, nil | return m, total, nil | ||||
} | } | ||||
func (u UserWalletFlowDb) UserWalletFlowGetSum(startAt, endAt string, kind int) (float64, error) { | |||||
sum, err := u.Db.Where("create_at >= ?", startAt).And("create_at <= ?", endAt).And("kind = ?", kind).Sum(&model.UserWalletFlow{}, "amount") | |||||
if err != nil { | |||||
return 0, zhios_order_relate_logx.Error(err) | |||||
} | |||||
return sum, nil | |||||
} | |||||
func (u UserWalletFlowDb) UserWalletFlowUserCount(startAt, endAt string, kind int) (int64, error) { | |||||
count, err := u.Db.Where("create_at >= ?", startAt).And("create_at <= ?", endAt).And("kind = ?", kind).Count(&model.UserWalletFlow{}) | |||||
if err != nil { | |||||
return 0, zhios_order_relate_logx.Error(err) | |||||
} | |||||
return count, nil | |||||
} |