Pārlūkot izejas kodu

Merge branch 'master' of http://git.hiwavo.com/Fohow/fohow_api

abiao 4 gadi atpakaļ
vecāks
revīzija
85258804e2

+ 13 - 15
go/gopath/src/fohow.com/apps/controllers/pay_controller/pay_exchange_controller.go

@@ -45,9 +45,9 @@ func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source,
 	var addr string
 	pick_dept_id, _ := self.GetInt64("pick_dept")
 	pick_way, _ := self.GetInt64("pick_way")
+	//地址
+	addressId, _ := self.GetInt64("address_id")
 	if pick_way == order_model.PICK_EXPRESS {
-		//地址
-		addressId, _ := self.GetInt64("address_id")
 		address := address_model.GetUserAddressById(addressId)
 		//beego.BeeLogger.Warn("address.wxuserId--%d", address.WxUserId)
 		beego.BeeLogger.Warn("wxUId-%d", wxUId)
@@ -150,17 +150,18 @@ func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source,
 	if resultStore {
 		self.ReturnError(403, []string{apps.ProductStockNotEnough[0], fmt.Sprintf("%s商品库存不足", prdName)}, "", nil)
 	}
-	//beego.BeeLogger.Error("SaleNumsMap2 %v", SaleNumsMap)
-
+	//订单公共信息更新
+	order.AddressId = addressId
+	order.Remark = remark
+	order.Contact = concat
+	order.Tel = tel
+	order.Address = addr
+	order.TotalPrice = total_price
+	order.PickDept = pick_dept_id
+	order.PickWay = pick_way
 	//第一次支付已更新支付方式,第一次支付才计算支付金额
 	if len(order.PayWay) <= 0 {
-
-		order.Remark = remark
 		order.PayWay = payWay
-		order.Contact = concat
-		order.Tel = tel
-		order.Address = addr
-		order.TotalPrice = total_price
 		//支付信息判断
 		//黑名单用户
 		curUser := user_model.GetUserById(wxUser.UserId, false)
@@ -194,8 +195,7 @@ func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source,
 			needWx = true
 		}
 		order.Freight = freight
-		order.PickDept = pick_dept_id
-		order.PickWay = pick_way
+
 		//先扣减提货券
 		if totalCoupon > 0 {
 			source := balance_model.BALANCE_SOURCE_EXCHANGE_PRODUCT
@@ -230,9 +230,6 @@ func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source,
 			//self.Data["json"] = self.FormatResult([]interface{}{result})
 			self.Data["json"] = result
 		case true: // 微信支付
-			order.Contact = concat
-			order.Tel = tel
-			order.Address = addr
 			order.PaiedPrice = total_weixin
 			order.Source = source
 			order.Save()
@@ -298,6 +295,7 @@ func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source,
 			beego.BeeLogger.Error("pay way not match, payway:%s", payWay)
 		}
 	} else {
+		order.Save()
 		//如果是第二次支付
 		if source == order_model.SOURCE_XCX { //小程序微信支付
 

+ 1 - 0
go/gopath/src/fohow.com/apps/models/order_model/order.go

@@ -115,6 +115,7 @@ type Order struct {
 	Pv             int64              `orm:"column(pv)"            json:"pv"`                                             // varchar(255)
 	PickWay        int64              `orm:"column(pick_way)"            json:"pick_way"`                                 // 物流方式
 	PickDept       int64              `orm:"column(pick_dept)"           json:"pick_dept"`                                // 自提部门
+	AddressId      int64              `orm:"column(address_id)"          json:"address_id"`                               // 地址ID
 	DispatchTime   time.Time          `orm:"column(dispatch_time);null;type(datetime)"           json:"dispatch_time"`
 	ReceiveTime    time.Time          `orm:"column(receive_time);null;type(datetime)"            json:"receive_time"`
 	PaiedTime      time.Time          `orm:"column(paied_time);null;type(datetime)"              json:"paied_time"` // int(11)