|
@@ -61,7 +61,16 @@ func (s *ShiftService) End(operatorID uint, actualCash float64, remark string) (
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (s *ShiftService) GetCurrent(operatorID uint) (*dao.ShiftRecord, error) {
|
|
func (s *ShiftService) GetCurrent(operatorID uint) (*dao.ShiftRecord, error) {
|
|
|
- return s.repo.GetActive(operatorID)
|
|
|
|
|
|
|
+ rec, err := s.repo.GetActive(operatorID)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return nil, err
|
|
|
|
|
+ }
|
|
|
|
|
+ // 实时统计当班现金收款
|
|
|
|
|
+ var collected float64
|
|
|
|
|
+ global.GVA_DB.Raw("SELECT COALESCE(SUM(amount),0) FROM payment_record WHERE payment_method='cash' AND operator_id = ? AND paid_at >= ?",
|
|
|
|
|
+ operatorID, rec.StartTime).Scan(&collected)
|
|
|
|
|
+ rec.CollectedCash = collected
|
|
|
|
|
+ return rec, nil
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (s *ShiftService) List(q repository.ShiftListQuery, operatorID uint) ([]repository.ShiftListItem, int64, error) {
|
|
func (s *ShiftService) List(q repository.ShiftListQuery, operatorID uint) ([]repository.ShiftListItem, int64, error) {
|