package controllers import ( "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/jxutils" "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 fromStoreID formData int fasle "物料配送门店" // @Param createType formData int false "创建类型, 0:预创建, 1:创建" // @Param isDeliverySelf formData bool false "是否是自提单" // @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, params.FromStoreID, params.IsDeliverySelf) } 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 vendorOrderID formData string true "订单ID" // @Param reason formData string true "原因" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult // @router /BuyerCancelOrder [post] func (c *JxOrderController) BuyerCancelOrder() { c.callBuyerCancelOrder(func(params *tJxorderBuyerCancelOrderParams) (retVal interface{}, errCode string, err error) { retVal, err = localjx.BuyerCancelOrder(params.Ctx, utils.Str2Int64(params.VendorOrderID), params.Reason) 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 }) } // @Title 查询自己的售后单 // @Description 查询自己的售后单 // @Param token header string true "认证token" // @Param vendorOrderID query string false "订单号,如果此项不为空,忽略其它所有查询条件" // @Param afsOrderID query string false "售后单号" // @Param userID query string false "用户ID" // @Param fromTime query string false "开始日期(包含),格式(2006-01-02),如果订单号为空此项必须要求" // @Param toTime query string false "结束日期(包含),格式(2006-01-02),如果订单号为空此项必须要求" // @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 /GetMyAfsOrders [get] func (c *JxOrderController) GetMyAfsOrders() { c.callGetMyAfsOrders(func(params *tJxorderGetMyAfsOrdersParams) (retVal interface{}, errCode string, err error) { retVal, err = localjx.GetMyAfsOrders(params.Ctx, params.VendorOrderID, params.AfsOrderID, params.UserID, params.FromTime, params.ToTime, params.Offset, params.PageSize) return retVal, "", err }) } // @Title 查询自己的订单状态数量信息 // @Description 查询自己的订单状态数量信息 // @Param token header string true "认证token" // @Param fromDate query string false "开始日期(包含),格式(2006-01-02),如果订单号为空此项必须要求" // @Param toDate query string false "结束日期(包含),格式(2006-01-02),如果订单号为空此项必须要求" // @Param statuss query string false "订单状态列表[1,2,3],缺省不限制" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult // @router /GetMyOrderCountInfo [get] func (c *JxOrderController) GetMyOrderCountInfo() { c.callGetMyOrderCountInfo(func(params *tJxorderGetMyOrderCountInfoParams) (retVal interface{}, errCode string, err error) { timeList, err := jxutils.BatchStr2Time(params.FromDate, params.ToDate) if err == nil { var statuss []int if err = jxutils.Strings2Objs(params.Statuss, &statuss); err == nil { retVal, err = localjx.GetMyOrderCountInfo(params.Ctx, timeList[0], timeList[1], statuss) } } return retVal, "", err }) } // @Title 每日订单打款 // @Description 每日订单打款 // @Param token header string true "认证token" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult // @router /AutoPayForPopluarMan [post] func (c *JxOrderController) AutoPayForPopluarMan() { c.callAutoPayForPopluarMan(func(params *tJxorderAutoPayForPopluarManParams) (retVal interface{}, errCode string, err error) { err = localjx.AutoPayForPopluarMan(params.Ctx) return retVal, "", err }) } // @Title 订单打款 // @Description 订单打款 // @Param token header string true "认证token" // @Param vendorOrderID formData string true "订单ID" // @Param userID formData string true "userID" // @Param price formData int true "钱" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult // @router /PayForPopluarMan [post] func (c *JxOrderController) PayForPopluarMan() { c.callPayForPopluarMan(func(params *tJxorderPayForPopluarManParams) (retVal interface{}, errCode string, err error) { err = localjx.PayForPopluarMan(params.Ctx, params.VendorOrderID, params.UserID, params.Price) return retVal, "", err }) } // @Title 查询物料订单状态 // @Description 查询物料订单状态 // @Param token header string true "认证token" // @Param vendorOrderID query string true "订单ID" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult // @router /GetMatterOrderStatus [get] func (c *JxOrderController) GetMatterOrderStatus() { c.callGetMatterOrderStatus(func(params *tJxorderGetMatterOrderStatusParams) (retVal interface{}, errCode string, err error) { retVal, err = localjx.GetMatterOrderStatus(params.Ctx, params.VendorOrderID) return retVal, "", err }) } // @Title 刷新所有物料订单状态 // @Description 刷新所有物料订单状态 // @Param token header string true "认证token" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult // @router /RefreshAllMatterOrderStatus [put] func (c *JxOrderController) RefreshAllMatterOrderStatus() { c.callRefreshAllMatterOrderStatus(func(params *tJxorderRefreshAllMatterOrderStatusParams) (retVal interface{}, errCode string, err error) { err = localjx.RefreshAllMatterOrderStatus(params.Ctx) return retVal, "", err }) } // @Title 重发物料订单 // @Description 重发物料订单 // @Param token header string true "认证token" // @Param vendorOrderID formData string true "订单ID" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult // @router /SendFailedMatterOrder [post] func (c *JxOrderController) SendFailedMatterOrder() { c.callSendFailedMatterOrder(func(params *tJxorderSendFailedMatterOrderParams) (retVal interface{}, errCode string, err error) { err = localjx.SendFailedMatterOrder(params.Ctx, params.VendorOrderID) return retVal, "", err }) }