|
|
@@ -4,6 +4,7 @@ import (
|
|
|
"fmt"
|
|
|
"fohow.com/apps/models/base_config"
|
|
|
"github.com/astaxie/beego"
|
|
|
+ "time"
|
|
|
|
|
|
"fohow.com/apps/models/balance_model"
|
|
|
"fohow.com/apps/models/user_model"
|
|
|
@@ -11,16 +12,28 @@ import (
|
|
|
)
|
|
|
|
|
|
//充值成功发放佣金
|
|
|
-func PatchRechargeBalance(oId, totalFee int64) {
|
|
|
+func PatchRechargeBalance(oId, totalFee int64, transactionId string) {
|
|
|
|
|
|
beego.BeeLogger.Warn("*******PatchRechargeBalance Begin oId:%d", oId)
|
|
|
|
|
|
order := balance_model.GetBalanceOrderById(oId, true)
|
|
|
-
|
|
|
if order == nil || order.State == int64(1) {
|
|
|
beego.BeeLogger.Error("充值订单状态错误或者不存在%d", oId)
|
|
|
return
|
|
|
}
|
|
|
+ payWay := ""
|
|
|
+ if len(transactionId) > 0 {
|
|
|
+ payWay = balance_model.PAY_WAY_TYPE_SERVICE_WXPAY
|
|
|
+ }
|
|
|
+ order.PaiedPrice = totalFee
|
|
|
+ order.State = 1
|
|
|
+ order.TradeNo = transactionId
|
|
|
+ order.PayWay = payWay
|
|
|
+ order.PaiedAt = time.Now().Unix()
|
|
|
+ if err := order.Save(); err != nil {
|
|
|
+ beego.BeeLogger.Error("weixinpay async return. save oId=%s fail", order.OrderId)
|
|
|
+ return
|
|
|
+ }
|
|
|
recharge(order.WxUserId, order.UserId, order.TotalPrice, order.OrderId)
|
|
|
wxUser := user_model.GetWxUserById(order.WxUserId, false)
|
|
|
if wxUser != nil {
|