Преглед на файлове

订单增加未支付退款退单队列

abiao преди 5 години
родител
ревизия
796f73a233

+ 3 - 0
go/gopath/src/fohow.com/apps/controllers/order_controller/order_controller.go

@@ -360,6 +360,9 @@ func (self *OrderController) Operate() {
 		source := balance_model.BALANCE_SOURCE_ALL_REFUNDED_NAME
 		remark := fmt.Sprintf("取消订单退款")
 		new(balance_model.Balance).Create(o.WxUserId, o.UserId, o.CouponPrice, source, o.OrderId, remark)
+		//已支付订单移除未支付队列
+		cancelKey := helpers.GetOrderCancelList()
+		helpers.ThrowOutRedisList(cancelKey, o.OrderId)
 	}
 	//已确认收货的订单、发放代销金给卖方
 	//if o.Status == order_model.STATUS_COMPLETE && o.OrderType == order_model.ORDER_TYPE_SALE {

+ 2 - 1
go/gopath/src/fohow.com/apps/controllers/pay_controller/pay_controller.go

@@ -27,6 +27,7 @@ func (self *PayController) Pay() {
 	payWay := self.GetString("pay_way")
 	tradPwd := self.GetString("trad_pwd")
 	source := self.GetString("s")
+	useCoupon, _ := self.GetBool("use_coupon", false)
 
 	beego.BeeLogger.Debug("pay.oId(%s).payway(%s).(%v)", oId, payWay, payWay == balance_model.PAY_WAY_TYPE_RECHARGE_WXPAY)
 	if oId == "" || payWay == "" {
@@ -48,7 +49,7 @@ func (self *PayController) Pay() {
 			self.ReturnError(403, apps.ParamsError, "", nil)
 		}
 	case EXCHANGE_TARGET: // 商品购买
-		self.payExchange(oId, payWay, tradPwd, returnUrl, source)
+		self.payExchange(oId, payWay, tradPwd, returnUrl, source, useCoupon)
 
 	case CASH_TARGET:
 		switch payWay {

+ 6 - 3
go/gopath/src/fohow.com/apps/controllers/pay_controller/pay_exchange_controller.go

@@ -28,7 +28,7 @@ var createDrawCode sync.Mutex
 var payOrder sync.Mutex
 
 //支付订单
-func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source string) {
+func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source string, useCoupon bool) {
 	payOrder.Lock()
 	defer payOrder.Unlock()
 	var payUrl string
@@ -118,7 +118,7 @@ func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source s
 		freight = int64(0)
 	}
 	tp += freight
-	if order.OrderType != order_model.ORDER_TYPE_SEKILL {
+	if order.OrderType != order_model.ORDER_TYPE_SEKILL && useCoupon {
 		if userLeftBalanceCount < tp {
 			totalCoupon = userLeftBalanceCount
 		} else {
@@ -157,7 +157,9 @@ func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source s
 			product := product_model.GetProductById(productId, false)
 			go order_model.SendCreate(order.OrderId, order.Id, productId, product.Price, product.Price, product.Name, int64(1))
 		}
-
+		//已支付订单移除未支付队列
+		cancelKey := helpers.GetOrderCancelList()
+		helpers.ThrowOutRedisList(cancelKey, order.OrderId)
 		//更新已售数量
 		go order_model.UpdateSaleNums(SaleNumsMap)
 		//go CreateOrderNotify(order, product)
@@ -170,6 +172,7 @@ func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source s
 
 		wxUser := self.GetCurrentWxUser(false)
 		order.Contact = address.Contact
+		order.PaiedPrice = total_price - totalCoupon
 		order.Tel = address.Tel
 		order.Address = fmt.Sprintf("%s%s%s%s", address.Province, address.City, address.District, address.Address)
 		order.Source = source