get orders
This commit is contained in:
@@ -124,43 +124,43 @@ func (p *PayHandler) CreateRefund() (err error) {
|
|||||||
case model.PayTypeWX:
|
case model.PayTypeWX:
|
||||||
//企业付款(提现)
|
//企业付款(提现)
|
||||||
if p.VendorPayType == model.VendorPayTypeCompanyPay {
|
if p.VendorPayType == model.VendorPayTypeCompanyPay {
|
||||||
param := &wxpayapi.TransfersParam{
|
// param := &wxpayapi.TransfersParam{
|
||||||
PartnerTradeNo: p.Order.OrderID,
|
// PartnerTradeNo: p.Order.OrderID,
|
||||||
CheckName: wxpayapi.CheckName,
|
// CheckName: wxpayapi.CheckName,
|
||||||
Desc: "冲天猴儿app提现到账",
|
// Desc: "冲天猴儿app提现到账",
|
||||||
SpbillCreateIP: p.Ctx.GetRealRemoteIP(),
|
// SpbillCreateIP: p.Ctx.GetRealRemoteIP(),
|
||||||
}
|
// }
|
||||||
//1元以下免费,以上收取对应城市手续费
|
// //1元以下免费,以上收取对应城市手续费
|
||||||
place, err := dao.GetPlaceByCode(dao.GetDB(), p.Order.CityCode)
|
// place, err := dao.GetPlaceByCode(dao.GetDB(), p.Order.CityCode)
|
||||||
if err != nil || place == nil {
|
// if err != nil || place == nil {
|
||||||
return fmt.Errorf("未找到该城市!code:%v", p.Order.CityCode)
|
// return fmt.Errorf("未找到该城市!code:%v", p.Order.CityCode)
|
||||||
}
|
// }
|
||||||
if p.Order.PayPrice < 100 {
|
// if p.Order.PayPrice < 100 {
|
||||||
param.Amount = p.Order.PayPrice
|
// param.Amount = p.Order.PayPrice
|
||||||
} else {
|
// } else {
|
||||||
param.Amount = p.Order.PayPrice * place.DividePercentage / 100 //手续费
|
// param.Amount = p.Order.PayPrice * place.DividePercentage / 100 //手续费
|
||||||
}
|
// }
|
||||||
if authInfo, err := p.Ctx.GetV2AuthInfo(); err == nil {
|
// if authInfo, err := p.Ctx.GetV2AuthInfo(); err == nil {
|
||||||
param.OpenID = authInfo.GetAuthID()
|
// param.OpenID = authInfo.GetAuthID()
|
||||||
}
|
// }
|
||||||
globals.SugarLogger.Debugf("CreateRefund wx param: %v", utils.Format4Output(param, false))
|
// globals.SugarLogger.Debugf("CreateRefund wx param: %v", utils.Format4Output(param, false))
|
||||||
result, err2 := api.WxpayAPI.Transfers(param)
|
// result, err2 := api.WxpayAPI.Transfers(param)
|
||||||
if err2 == nil {
|
// if err2 == nil {
|
||||||
p.Order.PayFinishedAt = utils.Str2Time(result.PaymentTime)
|
// p.Order.PayFinishedAt = utils.Str2Time(result.PaymentTime)
|
||||||
p.Order.Comment = result.DeviceInfo
|
// p.Order.Comment = result.DeviceInfo
|
||||||
p.Order.OriginalData = utils.Format4Output(result, true)
|
// p.Order.OriginalData = utils.Format4Output(result, true)
|
||||||
if result.ReturnMsg == "" {
|
// if result.ReturnMsg == "" {
|
||||||
p.Order.Status = model.OrderStatusFinished
|
// p.Order.Status = model.OrderStatusFinished
|
||||||
} else {
|
// } else {
|
||||||
p.Order.Status = model.OrderStatusCanceled
|
// p.Order.Status = model.OrderStatusCanceled
|
||||||
}
|
// }
|
||||||
dao.UpdateEntity(dao.GetDB(), p.Order)
|
// dao.UpdateEntity(dao.GetDB(), p.Order)
|
||||||
if result.ReturnMsg == "" {
|
// if result.ReturnMsg == "" {
|
||||||
err = OnCashFinished(p.Order)
|
// err = OnCashFinished(p.Order)
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
return err2
|
// return err2
|
||||||
}
|
// }
|
||||||
} else if p.VendorPayType == model.VendorPayTypeTransferAccount {
|
} else if p.VendorPayType == model.VendorPayTypeTransferAccount {
|
||||||
p.Order.PayFinishedAt = time.Now()
|
p.Order.PayFinishedAt = time.Now()
|
||||||
p.Order.Comment = "手动转账"
|
p.Order.Comment = "手动转账"
|
||||||
|
|||||||
@@ -57,3 +57,18 @@ func (c *OrderController) CreateOrder() {
|
|||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Title 查询订单提现申请
|
||||||
|
// @Description 查询订单提现申请
|
||||||
|
// @Param token header string true "认证token"
|
||||||
|
// @Param orderID query string false "订单号"
|
||||||
|
// @Param orderType query int false "订单类型,1为支付,2为提现"
|
||||||
|
// @Param keyword query string false "关键字"
|
||||||
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
// @router /GetOrders [get]
|
||||||
|
func (c *OrderController) GetOrders() {
|
||||||
|
c.callGetOrders(func(params *tOrderGetOrdersParams) (retVal interface{}, errCode string, err error) {
|
||||||
|
return retVal, "", err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -466,6 +466,15 @@ func init() {
|
|||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetOrders",
|
||||||
|
Router: `/GetOrders`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "Pay",
|
Method: "Pay",
|
||||||
|
|||||||
Reference in New Issue
Block a user