aa
This commit is contained in:
@@ -20,7 +20,7 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CreateOrder(ctx *jxcontext.Context, orderType int, way string, price int, lng, lat float64) (orderID, errCode string, err error) {
|
func CreateOrder(ctx *jxcontext.Context, type1, orderType int, way string, price int, lng, lat float64) (orderID, errCode string, err error) {
|
||||||
var (
|
var (
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
order *model.Order
|
order *model.Order
|
||||||
@@ -29,7 +29,7 @@ func CreateOrder(ctx *jxcontext.Context, orderType int, way string, price int, l
|
|||||||
if err = auth2.CheckWeixinminiAuthBind(ctx.GetUserID()); err != nil {
|
if err = auth2.CheckWeixinminiAuthBind(ctx.GetUserID()); err != nil {
|
||||||
return "", errCode, err
|
return "", errCode, err
|
||||||
}
|
}
|
||||||
if orderType == model.OrderTypeCash {
|
if type1 == model.OrderTypeCash {
|
||||||
//如果用户没有对应账单信息就给他生成一条
|
//如果用户没有对应账单信息就给他生成一条
|
||||||
userBill, err := dao.GetUserBill(db, ctx.GetUserID(), "")
|
userBill, err := dao.GetUserBill(db, ctx.GetUserID(), "")
|
||||||
if userBill == nil {
|
if userBill == nil {
|
||||||
@@ -51,7 +51,8 @@ func CreateOrder(ctx *jxcontext.Context, orderType int, way string, price int, l
|
|||||||
order = &model.Order{
|
order = &model.Order{
|
||||||
OrderID: utils.Int64ToStr(jxutils.GenOrderNo()),
|
OrderID: utils.Int64ToStr(jxutils.GenOrderNo()),
|
||||||
UserID: ctx.GetUserID(),
|
UserID: ctx.GetUserID(),
|
||||||
Type: orderType,
|
Type: type1,
|
||||||
|
OrderType: orderType,
|
||||||
Way: way,
|
Way: way,
|
||||||
Status: model.OrderStatusWait4Pay,
|
Status: model.OrderStatusWait4Pay,
|
||||||
PayPrice: price,
|
PayPrice: price,
|
||||||
|
|||||||
@@ -189,16 +189,40 @@ type GetPayStatisticsResult struct {
|
|||||||
CashIncome int `json:"cashIncome"` //提现收益
|
CashIncome int `json:"cashIncome"` //提现收益
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetPayStatistics(db *DaoDB, userID string, pop int, cityCodes []int, mobile string, fromTime, toTime time.Time, consumeTypes []int) (getPayStatisticsResult *GetPayStatisticsResult, err error) {
|
func GetPayStatistics(db *DaoDB, userID string, pop int, cityCodes []int, mobile string, fromTime, toTime time.Time, orderTypes []int) (getPayStatisticsResult *GetPayStatisticsResult, err error) {
|
||||||
sqlParams := []interface{}{}
|
sqlParams := []interface{}{}
|
||||||
sql := `
|
sql := `
|
||||||
SELECT a.*
|
SELECT a.*
|
||||||
FROM user a
|
FROM user a
|
||||||
|
`
|
||||||
|
if mobile != "" {
|
||||||
|
if pop == 1 {
|
||||||
|
sql += " JOIN user e ON e.moblie = ? AND a.pop_user = e.user_id"
|
||||||
|
sqlParams = append(sqlParams, mobile)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sql += `
|
||||||
WHERE 1 = 1
|
WHERE 1 = 1
|
||||||
`
|
`
|
||||||
if userID != "" {
|
if userID != "" {
|
||||||
sql += " AND a.user_id = ?"
|
if pop == 1 {
|
||||||
sqlParams = append(sqlParams, userID)
|
sql += " AND a.pop_user = ?"
|
||||||
|
sqlParams = append(sqlParams, userID)
|
||||||
|
} else {
|
||||||
|
sql += " AND a.user_id = ?"
|
||||||
|
sqlParams = append(sqlParams, userID)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if mobile != "" {
|
||||||
|
if pop == 0 {
|
||||||
|
sql += " AND a.mobile = ?"
|
||||||
|
sqlParams = append(sqlParams, mobile)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(cityCodes) > 0 {
|
||||||
|
sql += ` AND a.city_code IN ` + GenQuestionMarks(len(cityCodes)) + `)`
|
||||||
|
sqlParams = append(sqlParams, cityCodes)
|
||||||
|
}
|
||||||
|
err = GetRow(db, &getPayStatisticsResult, sql, sqlParams)
|
||||||
return getPayStatisticsResult, err
|
return getPayStatisticsResult, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,14 +21,13 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
OrderTypeAddressErr = -1 //地址异常订单
|
|
||||||
OrderTypeNormal = 0 //普通订单
|
|
||||||
OrderTypeMatter = 1 //物料订单
|
|
||||||
OrderTypeSupplyGoods = 2 //进货订单
|
|
||||||
OrderTypeDefendPrice = 3 //守价订单
|
|
||||||
|
|
||||||
OrderTypePay = 1 //支付
|
OrderTypePay = 1 //支付
|
||||||
OrderTypeCash = 2 //提现
|
OrderTypeCash = 2 //提现
|
||||||
|
|
||||||
|
OrderTypePublishJob = 1 //发布任务
|
||||||
|
OrderTpyeMember = 2 //充值会员
|
||||||
|
OrderTypeDelivery = 3 //发快递
|
||||||
|
OrderTpyeDropShipping = 4 //一件代发交钱
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -50,9 +49,10 @@ var (
|
|||||||
type Order struct {
|
type Order struct {
|
||||||
ModelIDCUL
|
ModelIDCUL
|
||||||
|
|
||||||
OrderID string `orm:"column(order_id)" json:"orderID"` //订单号
|
OrderID string `orm:"column(order_id)" json:"orderID"` //订单号
|
||||||
UserID string `orm:"column(user_id);size(48)" json:"userID"` //用户ID
|
UserID string `orm:"column(user_id);size(48)" json:"userID"` //用户ID
|
||||||
Type int `json:"type"` //订单类型
|
Type int `json:"type"`
|
||||||
|
OrderType int `json:"orderType"` //订单类型
|
||||||
Way string `json:"way"` //weixinapp ,weixinmini
|
Way string `json:"way"` //weixinapp ,weixinmini
|
||||||
Status int `json:"status"` //订单状态,待支付2,已支付5,支付成功110,支付失败115
|
Status int `json:"status"` //订单状态,待支付2,已支付5,支付成功110,支付失败115
|
||||||
PayPrice int `json:"payPrice"` //支付金额
|
PayPrice int `json:"payPrice"` //支付金额
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ func (c *OrderController) Cash() {
|
|||||||
// @Description 创建订单
|
// @Description 创建订单
|
||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param type formData int true "支付类型/账单类型"
|
// @Param type formData int true "支付类型/账单类型"
|
||||||
|
// @Param orderType formData int true "订单类型,1为发任务,2为冲会员,3为发快递"
|
||||||
// @Param way formData string true "认证方式"
|
// @Param way formData string true "认证方式"
|
||||||
// @Param price formData int true "支付金额"
|
// @Param price formData int true "支付金额"
|
||||||
// @Param lng formData float64 true "经纬度"
|
// @Param lng formData float64 true "经纬度"
|
||||||
@@ -55,7 +56,7 @@ func (c *OrderController) Cash() {
|
|||||||
// @router /CreateOrder [post]
|
// @router /CreateOrder [post]
|
||||||
func (c *OrderController) CreateOrder() {
|
func (c *OrderController) CreateOrder() {
|
||||||
c.callCreateOrder(func(params *tOrderCreateOrderParams) (retVal interface{}, errCode string, err error) {
|
c.callCreateOrder(func(params *tOrderCreateOrderParams) (retVal interface{}, errCode string, err error) {
|
||||||
retVal, errCode, err = cms.CreateOrder(params.Ctx, params.Type, params.Way, params.Price, params.Lng, params.Lat)
|
retVal, errCode, err = cms.CreateOrder(params.Ctx, params.Type, params.OrderType, params.Way, params.Price, params.Lng, params.Lat)
|
||||||
return retVal, errCode, err
|
return retVal, errCode, err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -111,15 +112,15 @@ func (c *OrderController) FinishedCashOrders() {
|
|||||||
// @Param mobile query string false "用户手机,必须全匹配"
|
// @Param mobile query string false "用户手机,必须全匹配"
|
||||||
// @Param fromTime query string false "消费开始时间"
|
// @Param fromTime query string false "消费开始时间"
|
||||||
// @Param toTime query string false "消费结束时间"
|
// @Param toTime query string false "消费结束时间"
|
||||||
// @Param consumeTypes query string false "1为发任务,2为冲会员,3为发快递"
|
// @Param orderTypes query string false "1为发任务,2为冲会员,3为发快递,4为一件代发支付"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
// @router /GetPayStatistics [get]
|
// @router /GetPayStatistics [get]
|
||||||
func (c *OrderController) GetPayStatistics() {
|
func (c *OrderController) GetPayStatistics() {
|
||||||
c.callGetPayStatistics(func(params *tOrderGetPayStatisticsParams) (retVal interface{}, errCode string, err error) {
|
c.callGetPayStatistics(func(params *tOrderGetPayStatisticsParams) (retVal interface{}, errCode string, err error) {
|
||||||
var cityCodes, consumeTypes []int
|
var cityCodes, orderTypes []int
|
||||||
if err = jxutils.Strings2Objs(params.CityCodes, &cityCodes, params.ConsumeTypes, &consumeTypes); err == nil {
|
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, consumeTypes)
|
retVal, err = cms.GetPayStatistics(params.Ctx, params.UserID, params.Pop, cityCodes, params.Mobile, params.FromTime, params.ToTime, orderTypes)
|
||||||
}
|
}
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -637,6 +637,15 @@ func init() {
|
|||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetPayStatistics",
|
||||||
|
Router: `/GetPayStatistics`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "Pay",
|
Method: "Pay",
|
||||||
|
|||||||
Reference in New Issue
Block a user