|
|
@@ -133,28 +133,28 @@ func fail(eg *xorm.Engine, canalMsg *md.ZhiosGuideStoreOrder) error { |
|
|
|
sess := eg.NewSession() |
|
|
|
defer sess.Close() |
|
|
|
sess.Begin() |
|
|
|
m, _ := db.FreeProductByID(eg, canalMsg.ItemId, canalMsg.Pvd) |
|
|
|
//m, _ := db.FreeProductByID(eg, canalMsg.ItemId, canalMsg.Pvd) |
|
|
|
//直接退回账号了 定制 |
|
|
|
storeOrder := db.GuideStoreOrderSess(sess, utils.StrToInt64(canalMsg.Oid)) |
|
|
|
if m != nil { |
|
|
|
if storeOrder != nil && utils.StrToFloat64(storeOrder.DeductPrice) > 0 && storeOrder.DeductState == 1 { |
|
|
|
coinId := db.SysCfgGetWithDb(eg, canalMsg.Mid, "guide_store_coin_id") |
|
|
|
err := UpdateUserVirtualCoinFinValidAndInterFlow(sess, |
|
|
|
utils.AnyToString(storeOrder.DeductPrice), "商品("+storeOrder.Gid+")退款退回", "0", 1, storeOrder.StoreId, utils.StrToInt(coinId), 114, utils.StrToInt64(canalMsg.Oid)) |
|
|
|
if err != nil { |
|
|
|
sess.Rollback() |
|
|
|
return err |
|
|
|
} |
|
|
|
storeOrder.DeductPrice = "0" |
|
|
|
storeOrder.DeductState = 2 |
|
|
|
storeOrder.State = 4 |
|
|
|
_, err = sess.Where("id=?", storeOrder.Id).Update(storeOrder) |
|
|
|
if err != nil { |
|
|
|
sess.Rollback() |
|
|
|
return err |
|
|
|
} |
|
|
|
//if m != nil { |
|
|
|
if storeOrder != nil && utils.StrToFloat64(storeOrder.DeductPrice) > 0 && storeOrder.DeductState == 1 { |
|
|
|
coinId := db.SysCfgGetWithDb(eg, canalMsg.Mid, "guide_store_coin_id") |
|
|
|
err := UpdateUserVirtualCoinFinValidAndInterFlow(sess, |
|
|
|
utils.AnyToString(storeOrder.DeductPrice), "商品("+storeOrder.Gid+")退款退回", "0", 1, storeOrder.StoreId, utils.StrToInt(coinId), 114, utils.StrToInt64(canalMsg.Oid)) |
|
|
|
if err != nil { |
|
|
|
sess.Rollback() |
|
|
|
return err |
|
|
|
} |
|
|
|
storeOrder.DeductPrice = "0" |
|
|
|
storeOrder.DeductState = 2 |
|
|
|
storeOrder.State = 4 |
|
|
|
_, err = sess.Where("id=?", storeOrder.Id).Update(storeOrder) |
|
|
|
if err != nil { |
|
|
|
sess.Rollback() |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
//} |
|
|
|
sess.Commit() |
|
|
|
return nil |
|
|
|
} |
|
|
|