85 lines
3.4 KiB
Go
85 lines
3.4 KiB
Go
package controllers
|
||
|
||
import (
|
||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||
"github.com/astaxie/beego"
|
||
)
|
||
|
||
type OrderController struct {
|
||
beego.Controller
|
||
}
|
||
|
||
// @Title 支付
|
||
// @Description 支付
|
||
// @Param token header string true "认证token"
|
||
// @Param orderID formData string true "订单号"
|
||
// @Param payType formData int true "支付平台类型"
|
||
// @Param vendorPayType formData string true "平台支付类型"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /Pay [post]
|
||
func (c *OrderController) Pay() {
|
||
c.callPay(func(params *tOrderPayParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.Pay(params.Ctx, params.OrderID, params.PayType, params.VendorPayType)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 提现
|
||
// @Description 提现
|
||
// @Param token header string true "认证token"
|
||
// @Param orderID formData string true "订单号"
|
||
// @Param payType formData int true "支付平台类型"
|
||
// @Param vendorPayType formData string true "平台支付类型"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /Cash [post]
|
||
func (c *OrderController) Cash() {
|
||
c.callCash(func(params *tOrderCashParams) (retVal interface{}, errCode string, err error) {
|
||
errCode, err = cms.Cash(params.Ctx, params.OrderID, params.PayType, params.VendorPayType)
|
||
return retVal, errCode, err
|
||
})
|
||
}
|
||
|
||
// @Title 创建订单
|
||
// @Description 创建订单
|
||
// @Param token header string true "认证token"
|
||
// @Param type formData int true "支付类型/账单类型"
|
||
// @Param price formData int true "支付金额"
|
||
// @Param lng formData float64 true "经纬度"
|
||
// @Param lat formData float64 true "经纬度"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /CreateOrder [post]
|
||
func (c *OrderController) CreateOrder() {
|
||
c.callCreateOrder(func(params *tOrderCreateOrderParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.CreateOrder(params.Ctx, params.Type, params.Price, params.Lng, params.Lat)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 查询订单提现申请
|
||
// @Description 查询订单提现申请
|
||
// @Param token header string true "认证token"
|
||
// @Param orderID query string false "订单号"
|
||
// @Param orderType query int false "订单类型,1为支付,2为提现"
|
||
// @Param cityCodes query string false "城市code列表"
|
||
// @Param fromTime query string false "开始时间"
|
||
// @Param toTime query string false "结束时间"
|
||
// @Param keyword query string false "关键字"
|
||
// @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 /GetOrders [get]
|
||
func (c *OrderController) GetOrders() {
|
||
c.callGetOrders(func(params *tOrderGetOrdersParams) (retVal interface{}, errCode string, err error) {
|
||
var cityCodes []int
|
||
if err = jxutils.Strings2Objs(params.CityCodes, &cityCodes); err == nil {
|
||
retVal, err = cms.GetOrders(params.Ctx, params.OrderID, params.OrderType, cityCodes, params.FromTime, params.ToTime, params.Keyword, params.Offset, params.PageSize)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|