|
|
@@ -40,11 +40,37 @@ func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source,
|
|
|
wxUId := self.GetCurrentWxUserId()
|
|
|
uId := self.GetCurrentUserId()
|
|
|
|
|
|
- //地址
|
|
|
- addressId, _ := self.GetInt64("address_id")
|
|
|
- address := address_model.GetUserAddressById(addressId)
|
|
|
- if address == nil || address.WxUserId != wxUId {
|
|
|
- self.ReturnError(403, apps.AddressNotMatch, "", nil)
|
|
|
+ var concat string
|
|
|
+ var tel string
|
|
|
+ var addr string
|
|
|
+ pick_dept, _ := self.GetInt64("pick_dept")
|
|
|
+ pick_way, _ := self.GetInt64("pick_way")
|
|
|
+ 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)
|
|
|
+
|
|
|
+ if address == nil || address.WxUserId != wxUId {
|
|
|
+ self.ReturnError(403, apps.AddressNotMatch, "", nil)
|
|
|
+ }
|
|
|
+ concat = address.Contact
|
|
|
+ tel = address.Tel
|
|
|
+ addr = fmt.Sprintf("%s%s%s%s", address.Province, address.City, address.District, address.Address)
|
|
|
+
|
|
|
+ } else {
|
|
|
+ //物流方式
|
|
|
+ pick_addr_id, _ := self.GetInt64("pick_addr_id")
|
|
|
+ pick_address := address_model.GetUserPickAddressById(pick_addr_id)
|
|
|
+ pick_dept := user_model.GetDepartRecordById(pick_dept, true)
|
|
|
+ if pick_dept == nil || pick_address == nil || pick_address.WxUserId != wxUId {
|
|
|
+ self.ReturnError(403, apps.AddressNotMatch, "", nil)
|
|
|
+ }
|
|
|
+
|
|
|
+ concat = pick_address.Contact
|
|
|
+ tel = pick_address.Tel
|
|
|
+ addr = pick_dept.PickAddress
|
|
|
}
|
|
|
|
|
|
if source != order_model.SOURCE_XCX && source != order_model.SOURCE_GZH {
|
|
|
@@ -133,9 +159,9 @@ func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source,
|
|
|
|
|
|
order.Remark = remark
|
|
|
order.PayWay = payWay
|
|
|
- order.Contact = address.Contact
|
|
|
- order.Tel = address.Tel
|
|
|
- order.Address = fmt.Sprintf("%s%s%s%s", address.Province, address.City, address.District, address.Address)
|
|
|
+ order.Contact = concat
|
|
|
+ order.Tel = tel
|
|
|
+ order.Address = addr
|
|
|
order.BuyPrice = buy_price_total
|
|
|
order.TotalPrice = total_price
|
|
|
//支付信息判断
|
|
|
@@ -154,7 +180,7 @@ func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source,
|
|
|
userLeftBalanceCount := balance_model.GetUserTotalBalance(wxUId)
|
|
|
tp := order.TotalPrice
|
|
|
freight := sys_config.GetFreight()
|
|
|
- if tp >= sys_config.GetOrderLimit() {
|
|
|
+ if tp >= sys_config.GetOrderLimit() || pick_way == order_model.PICK_SHOP {
|
|
|
freight = int64(0)
|
|
|
}
|
|
|
tp += freight
|
|
|
@@ -166,6 +192,9 @@ func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source,
|
|
|
totalCoupon = tp
|
|
|
}
|
|
|
}
|
|
|
+ order.Freight = freight
|
|
|
+ order.PickDept = pick_dept
|
|
|
+ order.PickWay = pick_way
|
|
|
//先扣减提货券
|
|
|
if totalCoupon > 0 {
|
|
|
source := balance_model.BALANCE_SOURCE_EXCHANGE_PRODUCT
|
|
|
@@ -200,10 +229,10 @@ func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source,
|
|
|
//self.Data["json"] = self.FormatResult([]interface{}{result})
|
|
|
self.Data["json"] = result
|
|
|
case true: // 微信支付
|
|
|
- order.Contact = address.Contact
|
|
|
+ order.Contact = concat
|
|
|
+ order.Tel = tel
|
|
|
+ order.Address = addr
|
|
|
order.PaiedPrice = tp - totalCoupon
|
|
|
- order.Tel = address.Tel
|
|
|
- order.Address = fmt.Sprintf("%s%s%s%s", address.Province, address.City, address.District, address.Address)
|
|
|
order.Source = source
|
|
|
order.Save()
|
|
|
if order.Source == order_model.SOURCE_XCX { //小程序微信支付
|