diff --git a/src/dao/egg_energy_price_dao.go b/src/dao/egg_energy_price_dao.go index 8663f27..f957001 100644 --- a/src/dao/egg_energy_price_dao.go +++ b/src/dao/egg_energy_price_dao.go @@ -7,4 +7,5 @@ type EggEnergyPriceDao interface { EggEnergyPriceList(startAt string, endAt string, hour string) ([]model.EggEnergyPrice, error) EggEnergyPriceGetLastOne() (*model.EggEnergyPrice, bool, error) EggEnergyPriceInsert(eggEnergyPrice *model.EggEnergyPrice) (int64, error) + EggEnergyPriceUpdate(eggEnergyPrice *model.EggEnergyPrice) (int64, error) } diff --git a/src/implement/egg_energy_fund_data_implement.go b/src/implement/egg_energy_fund_data_implement.go index bea26a1..1ace4e2 100644 --- a/src/implement/egg_energy_fund_data_implement.go +++ b/src/implement/egg_energy_fund_data_implement.go @@ -38,7 +38,7 @@ func (e EggEnergyFundDataDb) EggEnergyFundDataFindAndCount(page, limit, kind int func (e EggEnergyFundDataDb) EggEnergyFundDataInsert(eggEnergyFundData *model.EggEnergyFundData) (int, error) { _, err := e.Db.InsertOne(eggEnergyFundData) if err != nil { - return 0, err + return 0, zhios_order_relate_logx.Error(err.Error()) } return eggEnergyFundData.Id, nil } diff --git a/src/implement/egg_energy_fund_data_records_implement.go b/src/implement/egg_energy_fund_data_records_implement.go index a8ccbce..a633c44 100644 --- a/src/implement/egg_energy_fund_data_records_implement.go +++ b/src/implement/egg_energy_fund_data_records_implement.go @@ -39,7 +39,7 @@ func (e EggEnergyFundDataRecordsDb) EggEnergyFundDataRecordsGetLast(id int) (*mo func (e EggEnergyFundDataRecordsDb) EggEnergyFundDataRecordsInsertBySession(session *xorm.Session, record model.EggEnergyFundDataRecords) (int, error) { _, err := session.InsertOne(record) if err != nil { - return 0, err + return 0, zhios_order_relate_logx.Error(err.Error()) } return record.Id, nil } diff --git a/src/implement/egg_energy_price_implement.go b/src/implement/egg_energy_price_implement.go index 1ee7605..0bdad42 100644 --- a/src/implement/egg_energy_price_implement.go +++ b/src/implement/egg_energy_price_implement.go @@ -31,7 +31,7 @@ func (e EggEnergyPriceDb) EggEnergyPriceList(startAt string, endAt string, hour func (e EggEnergyPriceDb) EggEnergyPriceGetLastOne() (*model.EggEnergyPrice, bool, error) { var m model.EggEnergyPrice - exist, err := e.Db.OrderBy("date").OrderBy("hour").Get(&m) + exist, err := e.Db.Desc("id").Get(&m) if err != nil { return nil, false, zhios_order_relate_logx.Error(err.Error()) } @@ -41,7 +41,15 @@ func (e EggEnergyPriceDb) EggEnergyPriceGetLastOne() (*model.EggEnergyPrice, boo func (e EggEnergyPriceDb) EggEnergyPriceInsert(eggEnergyPrice *model.EggEnergyPrice) (int64, error) { _, err := e.Db.InsertOne(eggEnergyPrice) if err != nil { - return 0, err + return 0, zhios_order_relate_logx.Error(err.Error()) } return eggEnergyPrice.Id, nil } + +func (e EggEnergyPriceDb) EggEnergyPriceUpdate(eggEnergyPrice *model.EggEnergyPrice) (int64, error) { + affected, err := e.Db.ID(eggEnergyPrice.Id).Cols("price").Update(eggEnergyPrice) + if err != nil { + return 0, zhios_order_relate_logx.Error(err.Error()) + } + return affected, nil +} diff --git a/src/implement/new_user_red_package_implement.go b/src/implement/new_user_red_package_implement.go index 8da23b6..7cf76ff 100644 --- a/src/implement/new_user_red_package_implement.go +++ b/src/implement/new_user_red_package_implement.go @@ -26,7 +26,7 @@ func (n NewUserRedPackageDb) NewUserRedPackageGetOne() (*model.NewUserRedPackage func (n NewUserRedPackageDb) NewUserRedPackageInsert(newUserRedPackage *model.NewUserRedPackage) (int, error) { _, err := n.Db.InsertOne(newUserRedPackage) if err != nil { - return 0, err + return 0, zhios_order_relate_logx.Error(err) } return newUserRedPackage.Id, nil } @@ -42,7 +42,7 @@ func (n NewUserRedPackageDb) NewUserRedPackageUpdate(id interface{}, newUserRedP affected, err = n.Db.Where("id=?", id).Update(newUserRedPackage) } if err != nil { - return 0, err + return 0, zhios_order_relate_logx.Error(err) } return affected, nil } diff --git a/src/implement/new_user_red_package_with_user_records_flow_implement.go b/src/implement/new_user_red_package_with_user_records_flow_implement.go index 6b9cc6e..7e4c701 100644 --- a/src/implement/new_user_red_package_with_user_records_flow_implement.go +++ b/src/implement/new_user_red_package_with_user_records_flow_implement.go @@ -3,6 +3,7 @@ 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" ) @@ -28,7 +29,7 @@ func (n NewUserRedPackageWithUserRecordsFlowDb) NewUserRedPackageWithUserRecords } total, err := session.Limit(limit, (page-1)*limit).Desc("create_at").FindAndCount(&m) if err != nil { - return nil, 0, err + return nil, 0, zhios_order_relate_logx.Error(err) } return &m, total, nil } diff --git a/src/implement/new_user_red_package_with_user_records_implement.go b/src/implement/new_user_red_package_with_user_records_implement.go index 94a0266..fb450e8 100644 --- a/src/implement/new_user_red_package_with_user_records_implement.go +++ b/src/implement/new_user_red_package_with_user_records_implement.go @@ -3,6 +3,7 @@ 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" ) @@ -28,7 +29,7 @@ func (n NewUserRedPackageWithUserRecordsDb) NewUserRedPackageWithUserRecordsFind } total, err := session.Limit(limit, (page-1)*limit).Desc("create_at").FindAndCount(&m) if err != nil { - return nil, 0, err + return nil, 0, zhios_order_relate_logx.Error(err) } return &m, total, nil } diff --git a/src/implement/platform_revenue_data_implement.go b/src/implement/platform_revenue_data_implement.go index 7af3643..96c74fd 100644 --- a/src/implement/platform_revenue_data_implement.go +++ b/src/implement/platform_revenue_data_implement.go @@ -19,7 +19,7 @@ type PlatformRevenueDataDb struct { func (p PlatformRevenueDataDb) PlatformRevenueDataInsert(platformRevenueData *model.PlatformRevenueData) (int, error) { _, err := p.Db.InsertOne(platformRevenueData) if err != nil { - return 0, err + return 0, zhios_order_relate_logx.Error(err.Error()) } return platformRevenueData.Id, nil } diff --git a/src/implement/platform_revenue_data_records_implement.go b/src/implement/platform_revenue_data_records_implement.go index 0408593..658233a 100644 --- a/src/implement/platform_revenue_data_records_implement.go +++ b/src/implement/platform_revenue_data_records_implement.go @@ -30,7 +30,7 @@ func (p PlatformRevenueDataRecordsDb) PlatformRevenueDataRecordsGetLast(id int) func (p PlatformRevenueDataRecordsDb) PlatformRevenueDataRecordsInsertBySession(session *xorm.Session, record model.PlatformRevenueDataRecords) (int, error) { _, err := session.InsertOne(record) if err != nil { - return 0, err + return 0, zhios_order_relate_logx.Error(err.Error()) } return record.Id, nil }