Files
jx-callback/controllers/jx_order2.go
2019-11-20 15:55:09 +08:00

47 lines
1.8 KiB
Go

package controllers
import (
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/partner/purchase/jx/localjx"
"github.com/astaxie/beego"
)
type JxOrderController struct {
beego.Controller
}
// @Title 创建京西商城订单
// @Description 创建京西商城订单
// @Param token header string true "认证token"
// @Param jxOrder formData string true "订单信息"
// @Param addressID formData int64 true "配送地址ID"
// @Param createType formData int false "创建类型, 0:预创建, 1:创建"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /CreateOrder [post]
func (c *JxOrderController) CreateOrder() {
c.callCreateOrder(func(params *tJxorderCreateOrderParams) (retVal interface{}, errCode string, err error) {
var jxOrder *localjx.JxOrderInfo
if err = utils.UnmarshalUseNumber([]byte(params.JxOrder), &jxOrder); err == nil {
retVal, err = localjx.CreateOrder(params.Ctx, jxOrder, int64(params.AddressID), params.CreateType)
}
return retVal, "", err
})
}
// @Title 请求支付京西商城订单
// @Description 请求支付京西商城订单
// @Param token header string true "认证token"
// @Param vendorOrderID formData string true "订单ID"
// @Param payType formData int true "支付类型"
// @Param vendorPayType formData string true "平台支付类型"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /Pay4Order [post]
func (c *JxOrderController) Pay4Order() {
c.callPay4Order(func(params *tJxorderPay4OrderParams) (retVal interface{}, errCode string, err error) {
retVal, err = localjx.Pay4Order(params.Ctx, utils.Str2Int64(params.VendorOrderID), params.PayType, params.VendorPayType)
return retVal, "", err
})
}