|
|
@@ -7,6 +7,8 @@ import (
|
|
|
"fohow.com/apps/models/cent_model"
|
|
|
"fohow.com/apps/models/sys_config"
|
|
|
"fohow.com/libs/lib_redis"
|
|
|
+ "net/http"
|
|
|
+
|
|
|
// "fmt"
|
|
|
"strconv"
|
|
|
// "time"
|
|
|
@@ -811,7 +813,7 @@ func (self *OrderController) Operate() {
|
|
|
}
|
|
|
//先处理退单
|
|
|
if operate == order_model.OPERATE_CANCEL && o.Status == order_model.STATUS_UNPAY {
|
|
|
- //已支付订单移除未支付队列
|
|
|
+ //移除未支付队列
|
|
|
cancelKey := lib_redis.GetOrderCancelList()
|
|
|
lib_redis.ThrowOutRedisList(cancelKey, o.OrderId)
|
|
|
if o.CouponPrice > 0 {
|
|
|
@@ -833,6 +835,9 @@ func (self *OrderController) Operate() {
|
|
|
remark := fmt.Sprintf("取消订单退佣金")
|
|
|
new(balance_model.CashBalance).Create(o.WxUserId, o.PaiedCash, source, o.OrderId, remark)
|
|
|
}
|
|
|
+ } else if operate == order_model.OPERATE_CANCEL && o.Status == order_model.STATUS_PROCESSING {
|
|
|
+ //发起退款流程
|
|
|
+ go self.httpRequest(o.WxUserId, o.TotalPrice, o.OrderId, o.TradeNo)
|
|
|
}
|
|
|
|
|
|
if operate == order_model.OPERATE_CONFIRM && o.Status == order_model.STATUS_DISPATCH {
|
|
|
@@ -926,3 +931,25 @@ func (self *OrderController) OrderCommend() {
|
|
|
}
|
|
|
self.ServeJSON()
|
|
|
}
|
|
|
+
|
|
|
+func (self *OrderController) httpRequest(wxId, total int64, orderId, transactionId string) {
|
|
|
+
|
|
|
+ refund := new(order_model.OrderRefund).Create(wxId, total, orderId, transactionId)
|
|
|
+
|
|
|
+ url := "http://127.0.0.1:25565/railsadmin/order/refund/"
|
|
|
+
|
|
|
+ if refund != nil {
|
|
|
+ // 构造请求 URL
|
|
|
+ reqURL := fmt.Sprintf("%s?id=%d", url, refund.Id)
|
|
|
+
|
|
|
+ // 发送 GET 请求
|
|
|
+ resp, err := http.Get(reqURL)
|
|
|
+ if err != nil {
|
|
|
+ beego.BeeLogger.Error("httpRequest order refund err=[%s]", err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ defer resp.Body.Close()
|
|
|
+ }
|
|
|
+
|
|
|
+ return
|
|
|
+}
|