func requestGetOrder(orderId int) interface{} { var response struct { Order model.Order Ok bool } response.Order, response.Ok = dao.GetOrder(orderId) return response }
func VerifyCharge(orderId int) bool { order, ok := dao.GetOrder(orderId) if !ok { return false } if order.PayStatus == consts.PAY_STATUS_SUCC || order.PayStatus == consts.PAY_STATUS_FAIL { schan.SendPayMessage(order) return true } sdkInst, ok := sdkMap[order.SdkType] if !ok { return false } schan.SendPayMessage((*sdkInst).VerifyCharge(order)) return true }
func payMsgHandler() { for { morder := <-payChan order, ok := dao.GetOrder(morder.Id) if !ok { log.Debugf("Pay chan got new message but order id is invalid [%+v]", morder) continue } //判定是否需要被保存 dao.SaveOrder(order) //判定是否需要被通知 // if morder.PayStatus != order.PayStatus || morder.OrderStatus != order.OrderStatus { // snet.NotifyOrderState(morder) // } snet.NotifyOrderState(morder) } }