예제 #1
0
func requestGetOrder(orderId int) interface{} {
	var response struct {
		Order model.Order
		Ok    bool
	}
	response.Order, response.Ok = dao.GetOrder(orderId)
	return response
}
예제 #2
0
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
}
예제 #3
0
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)
	}
}