Files
jx-callback/controllers/jx_order2.go
2019-11-29 10:35:38 +08:00

95 lines
4.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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
})
}
// @Title 查询网络打印机状态
// @Description 查询网络打印机状态
// @Param token header string true "认证token"
// @Param storeID query int true "门店ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetAvailableDeliverTime [get]
func (c *JxOrderController) GetAvailableDeliverTime() {
c.callGetAvailableDeliverTime(func(params *tJxorderGetAvailableDeliverTimeParams) (retVal interface{}, errCode string, err error) {
retVal, err = localjx.GetAvailableDeliverTime(params.Ctx, params.StoreID)
return retVal, "", err
})
}
// @Title 得到一个订单的支付信息
// @Description 得到一个订单的支付信息
// @Param token header string true "认证token"
// @Param vendorOrderID query string true "订单号,如果此项不为空,忽略其它所有查询条件"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetOrderPay [get]
func (c *JxOrderController) GetOrderPay() {
c.callGetOrderPay(func(params *tJxorderGetOrderPayParams) (retVal interface{}, errCode string, err error) {
retVal, err = localjx.GetOrderPay(params.Ctx, params.VendorOrderID)
return retVal, "", err
})
}
// @Title 查询自己的订单
// @Description 查询自己的订单
// @Param token header string true "认证token"
// @Param vendorOrderID query string false "订单号,如果此项不为空,忽略其它所有查询条件"
// @Param keyword query string false "查询关键字"
// @Param fromDate query string false "开始日期包含格式2006-01-02如果订单号为空此项必须要求"
// @Param toDate query string false "结束日期包含格式2006-01-02如果订单号为空此项必须要求"
// @Param statuss query string false "订单状态列表[1,2,3],缺省不限制"
// @Param offset query int false "结果起始序号以0开始缺省为0"
// @Param pageSize query int false "结果页大小缺省为50-1表示全部"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetMyOrders [get]
func (c *JxOrderController) GetMyOrders() {
c.callGetMyOrders(func(params *tJxorderGetMyOrdersParams) (retVal interface{}, errCode string, err error) {
retVal, err = localjx.GetMyOrders(params.Ctx, params.FromDate, params.ToDate, params.MapData, params.Offset, params.PageSize)
return retVal, "", err
})
}