Files
jx-callback/controllers/order_controller.go
邹宗楠 57d94f82ed 1
2022-11-24 13:48:52 +08:00

233 lines
10 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/jx-callback/business/jxstore/cms"
"git.rosy.net.cn/jx-callback/business/jxstore/financial"
"git.rosy.net.cn/jx-callback/business/jxutils"
beego "github.com/astaxie/beego/adapter"
)
type OrderController struct {
beego.Controller
}
// Pay 订单支付
// @Title 支付
// @Description 支付
// @Param token header string true "认证token"
// @Param orderID formData string true "订单号"
// @Param payType formData int true "支付平台类型"
// @Param vendorPayType formData string true "平台支付类型"
// @Param orderType formData string true "订单类型member会员express快递recharge充值,telephoneBill充话费"
// @Param appId formData string true "appId"
// @Param isChoose formData int true "-1:未选中余额抵消 1余额抵消"
// @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, params.AppId, params.IsChoose)
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 "平台支付类型"
// @Param orderType formData string true "订单类型member会员express快递recharge充值"
// @Param appId formData string true "appId"
// @Param isChoose formData int true "-1:未选中余额抵消 1余额抵消"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /PayByBalance [post]
func (c *OrderController) PayByBalance() {
c.callPayByBalance(func(params *tOrderPayByBalanceParams) (retVal interface{}, errMsg string, err error) {
retVal, _, err = cms.PayByBalance(params.Ctx, params.OrderID, params.IsChoose, params.PayType, params.VendorPayType, params.AppId)
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 orderType formData int true "订单类型1为发任务2为冲会员3为发快递6-需要充值到余额购买的方式,7-话费充值"
// @Param way formData string true "认证方式"
// @Param price formData int true "支付金额"
// @Param lng formData float64 true "经纬度"
// @Param lat formData float64 true "经纬度"
// @Param mobile formData string false "充值电话"
// @Param flowCode formData string false "业务代码"
// @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, errCode, err = cms.CreateOrder(params.Ctx, params.Type, params.OrderType, params.Way, params.Price, params.Lng, params.Lat, params.Mobile, params.FlowCode)
return retVal, errCode, err
})
}
// @Title 查询订单提现申请
// @Description 查询订单提现申请
// @Param token header string true "认证token"
// @Param orderID query string false "订单号"
// @Param userID query string false "用户ID"
// @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.UserID, params.OrderType, cityCodes, params.FromTime, params.ToTime, params.Keyword, params.Offset, params.PageSize)
}
return retVal, "", err
})
}
// @Title 完成提现订单
// @Description 完成提现订单
// @Param token header string true "认证token"
// @Param orderIDs formData string true "订单号列表"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /FinishedCashOrders [post]
func (c *OrderController) FinishedCashOrders() {
c.callFinishedCashOrders(func(params *tOrderFinishedCashOrdersParams) (retVal interface{}, errCode string, err error) {
var orderIDs []string
if err = jxutils.Strings2Objs(params.OrderIDs, &orderIDs); err == nil {
err = cms.FinishedCashOrders(params.Ctx, orderIDs)
}
return retVal, "", err
})
}
// @Title 支付统计
// @Description 支付统计
// @Param token header string true "认证token"
// @Param userID query string false "用户id"
// @Param pop query int false "1为你邀请的0为全部"
// @Param cityCodes query string false "城市id列表"
// @Param mobile query string false "用户手机,必须全匹配"
// @Param fromTime query string false "消费开始时间"
// @Param toTime query string false "消费结束时间"
// @Param orderTypes query string false "1为发任务2为冲会员3为发快递,4为一件代发支付"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetPayStatistics [get]
func (c *OrderController) GetPayStatistics() {
c.callGetPayStatistics(func(params *tOrderGetPayStatisticsParams) (retVal interface{}, errCode string, err error) {
var cityCodes, orderTypes []int
if err = jxutils.Strings2Objs(params.CityCodes, &cityCodes, params.OrderTypes, &orderTypes); err == nil {
retVal, err = cms.GetPayStatistics(params.Ctx, params.UserID, params.Pop, cityCodes, params.Mobile, params.FromTime, params.ToTime, orderTypes)
}
return retVal, "", err
})
}
// @Title 经营分析图表
// @Description 经营分析图表
// @Param token header string true "认证token"
// @Param cityCodes query string false "城市id列表"
// @Param fromTime query string true "开始时间"
// @Param toTime query string true "结束时间"
// @Param jobIDs query string false "任务IDs"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetManageStatisticsImg [get]
func (c *OrderController) GetManageStatisticsImg() {
c.callGetManageStatisticsImg(func(params *tOrderGetManageStatisticsImgParams) (retVal interface{}, errCode string, err error) {
var cityCodes, jobIDs []int
if err = jxutils.Strings2Objs(params.CityCodes, &cityCodes, params.JobIDs, &jobIDs); err == nil {
retVal, err = cms.GetManageStatisticsImg(params.Ctx, cityCodes, params.FromTime, params.ToTime, jobIDs)
}
return retVal, "", err
})
}
// @Title 经营分析任务列表
// @Description 经营分析任务列表
// @Param token header string true "认证token"
// @Param cityCodes query string false "城市id列表"
// @Param fromTime query string false "开始时间"
// @Param toTime query string false "结束时间"
// @Param jobIDs query string false "任务IDs"
// @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 /GetManageStatisticsJob [get]
func (c *OrderController) GetManageStatisticsJob() {
c.callGetManageStatisticsJob(func(params *tOrderGetManageStatisticsJobParams) (retVal interface{}, errCode string, err error) {
var cityCodes, jobIDs []int
if err = jxutils.Strings2Objs(params.CityCodes, &cityCodes, params.JobIDs, &jobIDs); err == nil {
retVal, err = cms.GetManageStatisticsJob(params.Ctx, cityCodes, params.FromTime, params.ToTime, jobIDs, params.Offset, params.PageSize)
}
return retVal, "", err
})
}
// @Title 查询我的推广订单
// @Description 查询我的推广订单
// @Param token header string true "认证token"
// @Param statuss query string false "状态s"
// @Param vendorID query int false "-1 全部"
// @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 /GetMyUnionOrders [get]
func (c *OrderController) GetMyUnionOrders() {
c.callGetMyUnionOrders(func(params *tOrderGetMyUnionOrdersParams) (retVal interface{}, errCode string, err error) {
var statuss []int
if err = jxutils.Strings2Objs(params.Statuss, &statuss); err == nil {
retVal, err = cms.GetMyUnionOrders(params.Ctx, statuss, params.VendorID, params.Offset, params.PageSize)
}
return retVal, "", err
})
}
// @Title 联盟订单结算
// @Description 联盟订单结算
// @Param token header string true "认证token"
// @Param vendorIDs query string false "平台IDs"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /SettleUnionOrders [post]
func (c *OrderController) SettleUnionOrders() {
c.callSettleUnionOrders(func(params *tOrderSettleUnionOrdersParams) (retVal interface{}, errCode string, err error) {
var vendorIDs []int
if err = jxutils.Strings2Objs(params.VendorIDs, &vendorIDs); err == nil {
err = financial.SettleUnionOrders(params.Ctx, vendorIDs)
}
return retVal, "", err
})
}