aa
This commit is contained in:
@@ -344,12 +344,11 @@ func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType
|
||||
return orderPay, err
|
||||
}
|
||||
|
||||
func Pay4User(ctx *jxcontext.Context, thingID, payType int, vendorPayType string) (orderPay *model.OrderPay, err error) {
|
||||
func Pay4User(ctx *jxcontext.Context, thingID int, vendorOrderID string, payType int, vendorPayType string) (orderPay *model.OrderPay, err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
order *model.GoodsOrder
|
||||
dicountCards []*model.DiscountCard
|
||||
vendorOrderID string
|
||||
db = dao.GetDB()
|
||||
order *model.GoodsOrder
|
||||
dicountCards []*model.DiscountCard
|
||||
)
|
||||
switch payType {
|
||||
case model.PayTypeTL_DiscountCard:
|
||||
@@ -2431,7 +2430,39 @@ func RefreshCouponsStatus(ctx *jxcontext.Context) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func CreateStoreAcctOrder(ctx *jxcontext.Context, orderType, storeID, price int) (acctOrder *model.AcctOrder, err error) {
|
||||
func CreateStoreAcctOrder(ctx *jxcontext.Context, orderType, storeID, price int) (vendorOrderID string, err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
storeAcct = &model.StoreAcct{
|
||||
StoreID: storeID,
|
||||
}
|
||||
)
|
||||
if err = dao.GetEntity(db, storeAcct, "StoreID"); err != nil && dao.IsNoRowsError(err) {
|
||||
//新增门店账单
|
||||
dao.WrapAddIDCULEntity(storeAcct, ctx.GetUserName())
|
||||
dao.CreateEntity(db, storeAcct)
|
||||
}
|
||||
|
||||
return acctOrder, err
|
||||
order := &model.GoodsOrder{
|
||||
VendorOrderID: utils.Int64ToStr(jxutils.GenOrderNo()),
|
||||
UserID: ctx.GetUserID(),
|
||||
StoreID: storeID,
|
||||
OrderType: orderType,
|
||||
Status: model.OrderStatusWait4Pay,
|
||||
ActualPayPrice: int64(price),
|
||||
OrderCreatedAt: time.Now(),
|
||||
VendorID: model.VendorIDJX,
|
||||
}
|
||||
dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db)
|
||||
panic(r)
|
||||
}
|
||||
}()
|
||||
if err = dao.CreateEntity(db, order); err != nil {
|
||||
dao.Rollback(db)
|
||||
}
|
||||
dao.Commit(db)
|
||||
return order.VendorOrderID, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user