Esempio n. 1
0
// Make sure order tracking number not conflict, by checking if tn exists,
// change to another but not checked again. So, it's limited.
func makeSureOrderTNUnique(tn int64) int64 {
	if order, err := orderdao.GetOrder("track_number", tn); err != nil {
		panic(err)
	} else if order == nil {
		return 0 // success
	} else {
		return model.GenerateOrderId() // try only once.
	}
}
Esempio n. 2
0
func (s *OrderService) GetOrder(id int) (*model.Order, error) {
	return orderdao.GetOrder("id", id)
}
Esempio n. 3
0
func (s *OrderService) GetOrderByTrackingNumber(trackNumber int64) (*model.Order, error) {
	return orderdao.GetOrder("track_number", trackNumber)
}
Esempio n. 4
0
// >> copied to service.order
func GetOrder(id int) (*model.Order, error) {
	return orderdao.GetOrder("id", id)
}