get orders
This commit is contained in:
@@ -124,43 +124,43 @@ func (p *PayHandler) CreateRefund() (err error) {
|
||||
case model.PayTypeWX:
|
||||
//企业付款(提现)
|
||||
if p.VendorPayType == model.VendorPayTypeCompanyPay {
|
||||
param := &wxpayapi.TransfersParam{
|
||||
PartnerTradeNo: p.Order.OrderID,
|
||||
CheckName: wxpayapi.CheckName,
|
||||
Desc: "冲天猴儿app提现到账",
|
||||
SpbillCreateIP: p.Ctx.GetRealRemoteIP(),
|
||||
}
|
||||
//1元以下免费,以上收取对应城市手续费
|
||||
place, err := dao.GetPlaceByCode(dao.GetDB(), p.Order.CityCode)
|
||||
if err != nil || place == nil {
|
||||
return fmt.Errorf("未找到该城市!code:%v", p.Order.CityCode)
|
||||
}
|
||||
if p.Order.PayPrice < 100 {
|
||||
param.Amount = p.Order.PayPrice
|
||||
} else {
|
||||
param.Amount = p.Order.PayPrice * place.DividePercentage / 100 //手续费
|
||||
}
|
||||
if authInfo, err := p.Ctx.GetV2AuthInfo(); err == nil {
|
||||
param.OpenID = authInfo.GetAuthID()
|
||||
}
|
||||
globals.SugarLogger.Debugf("CreateRefund wx param: %v", utils.Format4Output(param, false))
|
||||
result, err2 := api.WxpayAPI.Transfers(param)
|
||||
if err2 == nil {
|
||||
p.Order.PayFinishedAt = utils.Str2Time(result.PaymentTime)
|
||||
p.Order.Comment = result.DeviceInfo
|
||||
p.Order.OriginalData = utils.Format4Output(result, true)
|
||||
if result.ReturnMsg == "" {
|
||||
p.Order.Status = model.OrderStatusFinished
|
||||
} else {
|
||||
p.Order.Status = model.OrderStatusCanceled
|
||||
}
|
||||
dao.UpdateEntity(dao.GetDB(), p.Order)
|
||||
if result.ReturnMsg == "" {
|
||||
err = OnCashFinished(p.Order)
|
||||
}
|
||||
} else {
|
||||
return err2
|
||||
}
|
||||
// param := &wxpayapi.TransfersParam{
|
||||
// PartnerTradeNo: p.Order.OrderID,
|
||||
// CheckName: wxpayapi.CheckName,
|
||||
// Desc: "冲天猴儿app提现到账",
|
||||
// SpbillCreateIP: p.Ctx.GetRealRemoteIP(),
|
||||
// }
|
||||
// //1元以下免费,以上收取对应城市手续费
|
||||
// place, err := dao.GetPlaceByCode(dao.GetDB(), p.Order.CityCode)
|
||||
// if err != nil || place == nil {
|
||||
// return fmt.Errorf("未找到该城市!code:%v", p.Order.CityCode)
|
||||
// }
|
||||
// if p.Order.PayPrice < 100 {
|
||||
// param.Amount = p.Order.PayPrice
|
||||
// } else {
|
||||
// param.Amount = p.Order.PayPrice * place.DividePercentage / 100 //手续费
|
||||
// }
|
||||
// if authInfo, err := p.Ctx.GetV2AuthInfo(); err == nil {
|
||||
// param.OpenID = authInfo.GetAuthID()
|
||||
// }
|
||||
// globals.SugarLogger.Debugf("CreateRefund wx param: %v", utils.Format4Output(param, false))
|
||||
// result, err2 := api.WxpayAPI.Transfers(param)
|
||||
// if err2 == nil {
|
||||
// p.Order.PayFinishedAt = utils.Str2Time(result.PaymentTime)
|
||||
// p.Order.Comment = result.DeviceInfo
|
||||
// p.Order.OriginalData = utils.Format4Output(result, true)
|
||||
// if result.ReturnMsg == "" {
|
||||
// p.Order.Status = model.OrderStatusFinished
|
||||
// } else {
|
||||
// p.Order.Status = model.OrderStatusCanceled
|
||||
// }
|
||||
// dao.UpdateEntity(dao.GetDB(), p.Order)
|
||||
// if result.ReturnMsg == "" {
|
||||
// err = OnCashFinished(p.Order)
|
||||
// }
|
||||
// } else {
|
||||
// return err2
|
||||
// }
|
||||
} else if p.VendorPayType == model.VendorPayTypeTransferAccount {
|
||||
p.Order.PayFinishedAt = time.Now()
|
||||
p.Order.Comment = "手动转账"
|
||||
|
||||
@@ -57,3 +57,18 @@ func (c *OrderController) CreateOrder() {
|
||||
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,
|
||||
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.ControllerComments{
|
||||
Method: "Pay",
|
||||
|
||||
Reference in New Issue
Block a user