提现城市分成比例
This commit is contained in:
@@ -17,17 +17,23 @@ import (
|
||||
"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 (
|
||||
db = dao.GetDB()
|
||||
order *model.Order
|
||||
)
|
||||
address, dCode, cCode, err := getAddressInfoFromCoord(db, lng, lat)
|
||||
order = &model.Order{
|
||||
OrderID: utils.Int64ToStr(jxutils.GenOrderNo()),
|
||||
UserID: ctx.GetUserID(),
|
||||
Type: orderType,
|
||||
Status: model.OrderStatusWait4Pay,
|
||||
PayPrice: price,
|
||||
OrderID: utils.Int64ToStr(jxutils.GenOrderNo()),
|
||||
UserID: ctx.GetUserID(),
|
||||
Type: orderType,
|
||||
Status: model.OrderStatusWait4Pay,
|
||||
PayPrice: price,
|
||||
Lng: lng,
|
||||
Lat: lat,
|
||||
Address: address,
|
||||
DistrictCode: dCode,
|
||||
CityCode: cCode,
|
||||
}
|
||||
dao.WrapAddIDCULEntity(order, ctx.GetUserName())
|
||||
dao.Begin(db)
|
||||
|
||||
@@ -21,8 +21,6 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
CashPercentage = 90
|
||||
|
||||
sigKey = "sign"
|
||||
sigTypeMd5 = "MD5"
|
||||
sigTypeSha256 = "HMAC-SHA256"
|
||||
@@ -132,11 +130,15 @@ func (p *PayHandler) CreateRefund() (err error) {
|
||||
Desc: "冲天猴儿app提现到账",
|
||||
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 {
|
||||
param.Amount = p.Order.PayPrice
|
||||
} 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 {
|
||||
param.OpenID = authInfo.GetAuthID()
|
||||
|
||||
@@ -58,6 +58,11 @@ type Order struct {
|
||||
PrepayID string `orm:"column(prepay_id);size(48)" json:"prepayID"` // 下单后,支付前,支付方生成的事务ID
|
||||
OriginalData string `orm:"type(text)" json:"-"`
|
||||
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 {
|
||||
|
||||
@@ -46,12 +46,14 @@ func (c *OrderController) Cash() {
|
||||
// @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)
|
||||
retVal, err = cms.CreateOrder(params.Ctx, params.Type, params.Price, params.Lng, params.Lat)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user