mirror of http://gitlab.batiao8.com/yic/film.git
amount3
This commit is contained in:
parent
fbe90567d5
commit
8b6fca419b
|
@ -66,3 +66,25 @@ func (d *NowCarDao) GetBusy(shopName, workstation string) (*model.Nowcar, error)
|
|||
}
|
||||
return &u, nil
|
||||
}
|
||||
|
||||
func (d *NowCarDao) QueryToday(shopName, workstation, day string) ([]*model.Nowcar, error) {
|
||||
var u []*model.Nowcar
|
||||
tx := global.GetDB().Table(d.TableName())
|
||||
|
||||
tx = tx.Where("shop_name = ?", shopName)
|
||||
tx = tx.Where("workstation = ?", workstation)
|
||||
tx = tx.Where("day = ?", day)
|
||||
tx = tx.Where("start_time != 0")
|
||||
tx = tx.Where("end_time != 0")
|
||||
|
||||
tx = tx.Order("start_time DESC")
|
||||
res := tx.Find(&u)
|
||||
if res.Error == gorm.ErrRecordNotFound {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if res.Error != nil {
|
||||
return nil, res.Error
|
||||
}
|
||||
return u, nil
|
||||
}
|
||||
|
|
|
@ -95,10 +95,17 @@ func getInfo(devId string) ([]string, error) {
|
|||
log.Errorf("db error :%s", err.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
todays, err := dao.NewNowCarDao().QueryToday(shopName, workstation, time.Now().Format("2006-01-02"))
|
||||
totalAmount := int64(0)
|
||||
for _, day := range todays {
|
||||
totalAmount += day.Amount
|
||||
}
|
||||
//订单完成提示
|
||||
log.Errorf("shopName=%s workstation=%s time=[%s],cost=%d,money=%s",
|
||||
log.Errorf("shopName=%s,workstation=%s,time=[%s],cost_minute=%d,money=%s,total=[%s/%d]",
|
||||
m2.ShopName, m2.Workstation, goutil.TimeToDateTime(m2.StartTime),
|
||||
(m2.EndTime-m2.StartTime)/60, goutil.FormatMoney(m2.Amount))
|
||||
(m2.EndTime-m2.StartTime)/60, goutil.FormatMoney(m2.Amount),
|
||||
goutil.FormatMoney(totalAmount), len(todays))
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue