|
|
@@ -31,9 +31,17 @@ 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.Desc("id").Get(&m) |
|
|
|
exist, err := e.Db.OrderBy("date").OrderBy("hour").Get(&m) |
|
|
|
if err != nil { |
|
|
|
return nil, false, zhios_order_relate_logx.Error(err.Error()) |
|
|
|
} |
|
|
|
return &m, exist, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (e EggEnergyPriceDb) EggEnergyPriceInsert(eggEnergyPrice *model.EggEnergyPrice) (int64, error) { |
|
|
|
_, err := e.Db.InsertOne(eggEnergyPrice) |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return eggEnergyPrice.Id, nil |
|
|
|
} |