|
|
@ -211,13 +211,6 @@ func (t *GoodCtl) Order() { |
|
|
|
} |
|
|
|
|
|
|
|
var expireAt = time.Now().Add(30 * time.Second).Unix() |
|
|
|
res, err := pay_service.UnifiedOrder("欧轩互动-直播商品", user.Openid, int(price+int(option.PostFee*100)), |
|
|
|
4, userId, activity.Id, expireAt) |
|
|
|
if err != nil { |
|
|
|
session.Rollback() |
|
|
|
t.CheckErr(err) |
|
|
|
} |
|
|
|
|
|
|
|
count, err := session.Where("is_delete=0").Count(&models.CustomerOrder{}) |
|
|
|
if err != nil { |
|
|
|
session.Rollback() |
|
|
@ -231,11 +224,10 @@ func (t *GoodCtl) Order() { |
|
|
|
AreaId: area.Id, |
|
|
|
AreaName: area.Name, |
|
|
|
RehearsalId: activity.RehearsalId, |
|
|
|
OutTradeNo: res["out_trade_no"].(string), |
|
|
|
BuyerId: user.Id, |
|
|
|
TotalAmount: float64(price)/100 + option.PostFee, |
|
|
|
PayAmount: float64(price)/100 + option.PostFee, |
|
|
|
Status: 0, |
|
|
|
Status: 1, |
|
|
|
Type: 1, // 直播订单
|
|
|
|
Receiver: param.Name, |
|
|
|
Address: param.Address, |
|
|
@ -244,6 +236,19 @@ func (t *GoodCtl) Order() { |
|
|
|
ExpireTime: expireAt, |
|
|
|
Postage: option.PostFee, |
|
|
|
} |
|
|
|
amount := price + int(option.PostFee*100) |
|
|
|
if amount > 0.00 { |
|
|
|
res, err := pay_service.UnifiedOrder("欧轩互动-直播商品", user.Openid, amount, 4, userId, |
|
|
|
activity.Id, expireAt) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
session.Rollback() |
|
|
|
t.CheckErr(err) |
|
|
|
} |
|
|
|
order.OutTradeNo = res["out_trade_no"].(string) |
|
|
|
order.Status = 0 |
|
|
|
} |
|
|
|
|
|
|
|
_, err = session.InsertOne(&order) |
|
|
|
if err != nil { |
|
|
|
session.Rollback() |
|
|
|