提现城市分成比例
This commit is contained in:
@@ -17,17 +17,23 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CreateOrder(ctx *jxcontext.Context, orderType, price int) (orderID string, err error) {
|
func CreateOrder(ctx *jxcontext.Context, orderType, price int, lng, lat float64) (orderID string, err error) {
|
||||||
var (
|
var (
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
order *model.Order
|
order *model.Order
|
||||||
)
|
)
|
||||||
|
address, dCode, cCode, err := getAddressInfoFromCoord(db, lng, lat)
|
||||||
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: orderType,
|
||||||
Status: model.OrderStatusWait4Pay,
|
Status: model.OrderStatusWait4Pay,
|
||||||
PayPrice: price,
|
PayPrice: price,
|
||||||
|
Lng: lng,
|
||||||
|
Lat: lat,
|
||||||
|
Address: address,
|
||||||
|
DistrictCode: dCode,
|
||||||
|
CityCode: cCode,
|
||||||
}
|
}
|
||||||
dao.WrapAddIDCULEntity(order, ctx.GetUserName())
|
dao.WrapAddIDCULEntity(order, ctx.GetUserName())
|
||||||
dao.Begin(db)
|
dao.Begin(db)
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
CashPercentage = 90
|
|
||||||
|
|
||||||
sigKey = "sign"
|
sigKey = "sign"
|
||||||
sigTypeMd5 = "MD5"
|
sigTypeMd5 = "MD5"
|
||||||
sigTypeSha256 = "HMAC-SHA256"
|
sigTypeSha256 = "HMAC-SHA256"
|
||||||
@@ -132,11 +130,15 @@ func (p *PayHandler) CreateRefund() (err error) {
|
|||||||
Desc: "冲天猴儿app提现到账",
|
Desc: "冲天猴儿app提现到账",
|
||||||
SpbillCreateIP: p.Ctx.GetRealRemoteIP(),
|
SpbillCreateIP: p.Ctx.GetRealRemoteIP(),
|
||||||
}
|
}
|
||||||
//1元以下免费,以上收取10%手续费
|
//1元以下免费,以上收取对应城市手续费
|
||||||
|
place, err := dao.GetPlaceByCode(dao.GetDB(), p.Order.CityCode)
|
||||||
|
if err != nil || place == nil {
|
||||||
|
return fmt.Errorf("未找到该城市!code:%v", p.Order.CityCode)
|
||||||
|
}
|
||||||
if p.Order.PayPrice < 100 {
|
if p.Order.PayPrice < 100 {
|
||||||
param.Amount = p.Order.PayPrice
|
param.Amount = p.Order.PayPrice
|
||||||
} else {
|
} else {
|
||||||
param.Amount = p.Order.PayPrice * CashPercentage / 100 //手续费10%
|
param.Amount = p.Order.PayPrice * place.DividePercentage / 100 //手续费10%
|
||||||
}
|
}
|
||||||
if authInfo, err := p.Ctx.GetV2AuthInfo(); err == nil && authInfo.GetAuthType() == weixin.AuthTypeWxApp {
|
if authInfo, err := p.Ctx.GetV2AuthInfo(); err == nil && authInfo.GetAuthType() == weixin.AuthTypeWxApp {
|
||||||
param.OpenID = authInfo.GetAuthID()
|
param.OpenID = authInfo.GetAuthID()
|
||||||
|
|||||||
@@ -58,6 +58,11 @@ type Order struct {
|
|||||||
PrepayID string `orm:"column(prepay_id);size(48)" json:"prepayID"` // 下单后,支付前,支付方生成的事务ID
|
PrepayID string `orm:"column(prepay_id);size(48)" json:"prepayID"` // 下单后,支付前,支付方生成的事务ID
|
||||||
OriginalData string `orm:"type(text)" json:"-"`
|
OriginalData string `orm:"type(text)" json:"-"`
|
||||||
Comment string `orm:"size(255)" json:"comment"` //备注
|
Comment string `orm:"size(255)" json:"comment"` //备注
|
||||||
|
Lng float64 `json:"lng"`
|
||||||
|
Lat float64 `json:"lat"`
|
||||||
|
CityCode int `orm:"default(0)" json:"cityCode"` //提交订单时用户所在城市
|
||||||
|
DistrictCode int `orm:"default(0)" json:"districtCode"`
|
||||||
|
Address string `orm:"size(255)" json:"address"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *Order) TableUnique() [][]string {
|
func (v *Order) TableUnique() [][]string {
|
||||||
|
|||||||
@@ -46,12 +46,14 @@ func (c *OrderController) Cash() {
|
|||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param type formData int true "支付类型/账单类型"
|
// @Param type formData int true "支付类型/账单类型"
|
||||||
// @Param price formData int true "支付金额"
|
// @Param price formData int true "支付金额"
|
||||||
|
// @Param lng formData float64 true "经纬度"
|
||||||
|
// @Param lat formData float64 true "经纬度"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
// @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, err = cms.CreateOrder(params.Ctx, params.Type, params.Price)
|
retVal, err = cms.CreateOrder(params.Ctx, params.Type, params.Price, params.Lng, params.Lat)
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user